/pyPSG

The pyPSG is PSG (Programmable sound generator. aka. AY-3-8910) simplified emulator implement by python.

Primary LanguagePythonThe UnlicenseUnlicense

pyPSG

The pyPSG is PSG (Programmable sound generator. aka. AY-3-8910) simplified emulator implement by python.

Requirements

  • python 3.7 (or later).

Functions

  • 3-channel square wave output.
  • 1-channel noise generator (Can be mixed with any square wave output channel).
  • Sample generation can specify any sampling rate (ex. 24KHz, 48KHz ... 192KHz).
  • The generated sample is floating point type (0.0 - 1.0).
  • Some feature are not implemented. For example, hardware envelope generator.

Files

Filename Description
pypsg.py PSG implementation module.
testpsg.py This is a test program for pypsg.Requires python-sounddevice library.
fbd.py Music sequencer using pypsg.
fbdplayer.py An executable module that uses the fbd module to play "fbd" files.
fbdwave.py An executable module that uses the fbd module to generate a .wav from a "fbd" file.
data/ There are music files that can be used with fbdplayer and fdbwave.

pypsg.SampleGenerator block diagram

pypsg-SampleGenerator

Usage

fbdplayer.py

Plays the "fbd" file specified by the first argument.

Requires janus, python-sounddevice library.

Example:

# python3(py) fbdplayer.py data/YS205.fbd

If you get "output underflow", try increasing the value of BUFFER_BLOCK_SIZE in fbdplayer.py.

fbdwave.py

Generates the wav file specified by the second argument from the "fbd" file specified by the first argument.

Example:

# python3(py) fbdwave.py data/YS205.fbd YS205.wav