Code Monkey home page Code Monkey logo

pyresidfp

Emulates the SID sound-chip in software. The C++ emulation code was copied over from libsidplayfp.

How to install

Requirements:

  • compiler for ISO C++11
  • Python 3 and header files

From PyPI

Install the latest version using

python -m pip install pyresidfp

From cloned git repository

Build from source and install using

python -m pip install .

Example

For the example, NumPy and soundcard python packages are required. The example is ported from the section Sample Sound Program, Commodore 64 User's Guide, page 80:

from datetime import timedelta
import numpy as np
import soundcard as sc
from pyresidfp import SoundInterfaceDevice, Voice, ControlBits, Tone

# program SID
sid = SoundInterfaceDevice()
sid.Filter_Mode_Vol = 15             # Maximum volume
sid.attack_decay(Voice.ONE, 190)     # 800 ms attack, 15 s decay
sid.sustain_release(Voice.ONE, 248)  # sustain peak, 300 ms release
sid.tone(Voice.ONE, Tone.C4)
sid.control(Voice.ONE, ControlBits.TRIANGLE | ControlBits.GATE)

# sample attack phase
attack_phase = timedelta(seconds=0.32)
raw_samples = sid.clock(attack_phase)

# reprogram SID for release phase and sample
release_phase = timedelta(seconds=0.3)
sid.control(Voice.ONE, ControlBits.TRIANGLE)
raw_samples.extend(sid.clock(release_phase))

# convert audio format and play
samples = np.array(raw_samples, dtype=np.float32) / 2.0**15
spkr = sc.default_speaker()
spkr.play(data=samples, samplerate=int(sid.sampling_frequency), channels=1)

Credits

We like to thank all contributors of libsidplayfp, especially:

  • Dag Lem: Designed and programmed complete emulation engine.
  • Antti S. Lankila: Distortion simulation and calculation of combined waveforms
  • Ken Händel: source code conversion to Java
  • Leandro Nini: port to c++, merge with reSID 1.0

pyresidfp's Projects

pyresidfp icon pyresidfp

MOS 6581 / MOS 8580 (SID) emulation for Python 3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.