ADSREnvelope
(attack, decay, release, sustain_amplitude=0.5)¶A four part Attack, Decay, Suspend, Release envelope.
This is a four part ADSR envelope. The attack, decay, and release parameters should be provided in seconds. For example, a value of 0.1 would be 100ms. The sustain_amplitude parameter affects the sustain volume. This defaults to a value of 0.5, but can be provided on a scale from 0.0 to 1.0.
Parameters: |
|
---|
build_envelope
(sample_rate, duration)¶Digitar
(duration, frequency=440, decay=0.996, **kwargs)¶A procedurally generated guitar-like waveform.
A guitar-like waveform, based on the Karplus-Strong algorithm. The sound is similar to a plucked guitar string. The resulting sound decays over time, and so the actual length will vary depending on the frequency. Lower frequencies require a longer length parameter to prevent cutting off abruptly.
Parameters: |
|
---|
Envelope
¶Base class for ProceduralSource amplitude envelopes.
build_envelope
(sample_rate, duration)¶FM
(duration, carrier=440, modulator=440, mod_index=1, **kwargs)¶A procedurally generated FM waveform.
This is a simplistic frequency modulated waveform, based on the concepts by John Chowning. Basic sine waves are used for both frequency carrier and modulator inputs, of which the frequencies can be provided. The modulation index, or amplitude, can also be adjusted.
Parameters: |
|
---|
FlatEnvelope
(amplitude=0.5)¶A flat envelope, providing basic amplitude setting.
Parameters: | amplitude (float) – The amplitude (volume) of the wave, from 0.0 to 1.0. Values outside of this range will be clamped. |
---|
build_envelope
(sample_rate, duration)¶LinearDecayEnvelope
(peak=1.0)¶A linearly decaying envelope.
This envelope linearly decays the amplitude from the peak value to 0, over the length of the waveform.
Parameters: | peak (float) – The Initial peak value of the envelope, from 0.0 to 1.0. Values outside of this range will be clamped. |
---|
build_envelope
(sample_rate, duration)¶ProceduralSource
(duration, sample_rate=44800, sample_size=16, envelope=None)¶Base class for procedurally defined and generated waveforms.
Parameters: |
|
---|
get_audio_data
(num_bytes)¶Return num_bytes bytes of audio data.
save
(filename)¶Save the audio to disk as a standard RIFF Wave.
A standard RIFF wave header will be added to the raw PCM audio data when it is saved to disk.
Parameters: | filename (str) – The file name to save as. |
---|
seek
(timestamp)¶envelope
¶Sawtooth
(duration, frequency=440, **kwargs)¶A procedurally generated sawtooth waveform.
Parameters: |
|
---|
Silence
(duration, sample_rate=44800, sample_size=16, envelope=None)¶A silent waveform.
Sine
(duration, frequency=440, **kwargs)¶A procedurally generated sinusoid waveform.
Parameters: |
|
---|
Square
(duration, frequency=440, **kwargs)¶A procedurally generated square (or pulse) waveform.
Parameters: |
|
---|
TremoloEnvelope
(depth, rate, amplitude=0.5)¶A tremolo envelope, for modulation amplitude.
A tremolo envelope that modulates the amplitude of the waveform with a sinusoidal pattern. The depth and rate of modulation can be specified. Depth is calculated as a percentage of the maximum amplitude. For example: a depth of 0.2 and amplitude of 0.5 will fluctuate the amplitude between 0.4 an 0.5.
Parameters: |
|
---|
build_envelope
(sample_rate, duration)¶Triangle
(duration, frequency=440, **kwargs)¶A procedurally generated triangle waveform.
Parameters: |
|
---|
WhiteNoise
(duration, sample_rate=44800, sample_size=16, envelope=None)¶A white noise, random waveform.