music.IteratorSynth¶
- class music.IteratorSynth(**statevars)[source]¶
Bases:
CanonicalSynthA synthesizer that iterates through arbitrary lists of variables.
Inherits from CanonicalSynth.
It adds no attributes of its own.
Examples
>>> isynth = M.IteratorSynth() >>> isynth.fundamental_frequency_sequence = [220, 400, 100, 500] >>> isynth.duration_sequence = [2, 1, 1.5] >>> isynth.vibrato_frequency_sequence = [3, 6.5, 10] >>> sounds = [] >>> for i in range(300): ... sounds += [isynth.renderIterate(tremolo_frequency=.2*i)] >>> import music.core.io >>> music.core.io.write_wav_mono(M.H(*sounds), "./example.wav")
- __init__(**statevars)¶
Initializes the synthesizer with given state variables.
- Parameters:
- **statevars
dict Arbitrary keyword arguments for state variables.
- **statevars
Methods
__init__(**statevars)Initializes the synthesizer with given state variables.
absorbState(**statevars)Absorb state variables.
adsrApply(audio_vec)Apply ADSR envelope to the audio vector.
adsrSetup([A, D, S, R, render_note, adsr_method])Setup ADSR parameters.
Iterates through the sequences of state variables.
rawRender(**statevars)Render the sound without applying ADSR.
render(**statevars)Render a note with given parameters.
render2(**statevars)Render the sound and apply ADSR.
renderIterate(**statevars)Renders a sound iteration with the given state variables.
synthSetup([table, vibrato_table, ...])Setup synth engine.
tremoloEnvelope([sonic_vector])Calculate the tremolo envelope.
Attributes
tablessampleratetablevibrato_tabletremolo_tablevibrato_depthvibrato_frequencytremolo_depthtremolo_frequencydurationfundamental_frequencyvibratotremoloASDRA_A_iD_iR_iiiLambda_ALambda_DLambda_Ra_Srender_noteadsr_method