funcgen – Function Generator for Audio Samples
Function Generator for Audio Samples
This implements the audiosample protocol (like RawSample or WAV) so it can be played by CircuitPython audio functions.
Basic waveform types are generated mathematically on the fly by FuncSample objects. Also a user-definable “SYNTH” function type is provided, which allows passing an array of 16-bit samples defining an arbitrary periodic waveform to be played back with variable frequency.
Additionally, a few post-processing effects are provided:
Envelope Control: To prevent ‘clicking’ which happens when you use the high-level play/stop functions, use env_attack() and env_release(). You can fully customize the “Attack, Decay, Sustain, Release (ADSR)” envelope settings!
Glide: You can “portmento” between notes easily.
Modulators: Patch-in user-defined LFO waveforms to modulate amplitude and/or frequency for tremolo or vibrato effects.