chippy - API documentation¶
- class
chippy.
Synthesizer
(framerate=44100, amplitude=1.0)¶
add_wave_header
(pcm_data)¶Add a RIFF standard Wave header to raw PCM data
Parameters: pcm_data – A bytestring of raw PCM data. Returns: A fully formed Wave object with correct file header, ready to be saved to disk or used directly.
adsr_envelope
(attack, decay, release, length, sustain_level=0.5)¶An Attack, decay, sustain, release envelope.
Parameters:
- attack – The attack rate in seconds.
- decay – The decay rate in seconds.
- release – The release rate in seconds.
- length – The total length in seconds. Must be larger than
the attack, decay, and release rates combined. :param sustain_level: The sustain amplitude, on a scale from 0.0 to 1.0. :return: A finite iterator for the length provided.
- static
composite_generator
(*generators)¶Creates a composited generator of all input generators.
Parameters: generators – Two or more wave generators. Returns: A new generator with the summed value of the input generators.
- static
flat_envelope
(amplitude)¶A flat envelope, which has essentially no effect.
Parameters: amplitude – The flat amplitude to return. Returns: An infinite repeat of the amplitude provided.
linear_decay_envelope
(length, peak=1.0)¶A simple linear decay envelope.
Parameters:
- length – The total length in seconds.
- peak – The initial peak amplitude, on a scale of 0.0 to 1.0.
Returns: A finite iterator for the length provided.
- static
save_raw_pcm
(pcm_data, file_name='rawpcm.wav')¶Save raw PCM data to disk, removing RIFF header if any.
Parameters:
- pcm_data – A bytestring of raw PCM data.
- file_name – Desired file name. Defaults to “rawpcm.wav”.
save_wave
(pcm_data, file_name='riffwave.wav')¶Add a RIFF Wave header to raw PCM data, and save to disk.
Parameters:
- pcm_data – A bytestring of raw PCM data.
- file_name – Desired file name. Defaults to “riffwave.wav”.