Metadata-Version: 2.1
Name: pyresidfp
Version: 0.10.0
Summary: Emulates the SID sound-chip
Author-Email: Sebastian Klemke <pypi@nerdheim.de>
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: C++
Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
Classifier: Topic :: System :: Emulators
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 2 - Pre-Alpha
Project-URL: Homepage, https://github.com/pyresidfp/pyresidfp
Project-URL: Bug tracker, https://github.com/pyresidfp/pyresidfp/issues
Requires-Python: <4.0.0,>=3.8.0
Description-Content-Type: text/markdown

# pyresidfp

Emulates the SID sound-chip in software. The C++ emulation code was copied over from
[libsidplayfp](https://github.com/libsidplayfp/libsidplayfp).

## How to install

Requirements:
- compiler for ISO C++11
- Python 3 and header files


### From PyPI

Install the latest version using
```commandline
python -m pip install pyresidfp
```


### From cloned git repository 

Build from source and install using
```commandline
python -m pip install .
```

## Example

For the example, [NumPy](http://www.numpy.org/) and [soundcard](https://github.com/bastibe/SoundCard) python packages
are required. The example is ported from the section *Sample Sound Program*,
[Commodore 64 User's Guide](https://archive.org/embed/Commodore_64_Users_Guide_1982_Commodore), page 80:
```python
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
