Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyresidfp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyresidfp

Emulates the SID sound-chip

  • 0.14.0
  • PyPI
  • Socket score

Maintainers
1

pyresidfp

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

How to install

Requirements for installation from source:

  • compiler for ISO C++20
  • Python 3.9+ 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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc