music.IteratorSynth

class music.IteratorSynth(**statevars)[source]

Bases: CanonicalSynth

A 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:
**statevarsdict

Arbitrary keyword arguments for state variables.

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.

iterateElements()

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

tables

samplerate

table

vibrato_table

tremolo_table

vibrato_depth

vibrato_frequency

tremolo_depth

tremolo_frequency

duration

fundamental_frequency

vibrato

tremolo

A

S

D

R

A_

A_i

D_i

R_i

ii

Lambda_A

Lambda_D

Lambda_R

a_S

render_note

adsr_method

renderIterate(**statevars)[source]

Renders a sound iteration with the given state variables.

Parameters:
**statevars

Arbitrary keyword arguments for state variables.

Returns:
list

A list representing the rendered sound.

iterateElements()[source]

Iterates through the sequences of state variables.