SynthBase Class

Synth Abstract Base Class

class spiegel.synth.synth_base.SynthBase(**kwargs)
Parameters
  • sampleRate (int, optional) – sampling rate for rendering audio, defaults to 44100

  • bufferSize (int, optional) – buffer size for rendering audio, defaults to 512

  • midiNote (int, optional) – midi note number used for rendering, 0-127, defaults to 40

  • midiVelocity (int, optional) – midi velocity used for rendering. 0-127, defaults to 127

  • noteLengthSecs (float, optional) – length of midi note in seconds, defaults to 1.0

  • renderLengthSecs (float, optional) – length that audio is rendered for in total, defaults to 2.5

  • overriddenParameters (list, optional) – a list of tuples containing the parameter index to override and the value to lock that parameter to, defaults to []

  • normaliseAudio (boolean, optional) – whether or not to normalize rendered audio, defaults to False

Variables
  • renderedPatch (boolean) – indicates whether a patch has been rendered yet, defaults to False

  • parameters (dict) – parameter indices and names

  • patch (list) – current patch values

abstract getAudio()

This method must be overridden and should return an audio buffer rendered durinf the last call to renderPatch.

Returns

An audio buffer of float audio samples with a value between -1 & 1

Return type

np.array

getParameters()

Returns parameters for the synth

Returns

A dictionary of parameters with the parameter index (int) as the key and the parameter name short description as the value

Return type

Dictionary

getPatch(skipOverridden=True)

Get current patch

Parameters

skipOverridden (bool, optional) – Indicates whether to remove overridden parameters from results, defaults to True

getRandomExample()

Returns audio from a new random patch

Returns

An audio buffer

Return type

np.array

abstract randomizePatch()

This method must be overridden and should have the effect of randomizing parameters of the synthesizer. Overridden methods should be uneffected by this randomization

abstract renderPatch()

Must be overridden. Should render audio for the currently loaded patch

setOverriddenParameters(parameters)

Override parameters with specific values

Parameters

parameters – List of parameter tuples with parameter index and parameter value that will be patched and then the parameter frozen.

abstract setPatch(parameters)

Must be overridden. Should update synth parameters to values indicated. Should not effect the overridden parameters.

Parameters

parameters (list) – A list of tuples. Tuples within the list must have the form (parameter_index, parameter_value) where parameter_index is an int with the parameter to modify and the parameter value is a float between 0-1. Can be a partial list of parameters for the synthesizer.