Docs

Synth

The Synth Object grants access to the current Sound Generators internals (scoped). Depending on the type of Sound Generator, there are some function which will not work, because they are limited to a certain Processor type (You will get a error message if you try to use a illegal API call)


Class methods

addController

Adds a controller to the buffer.

Synth.addController(int channel, int number, int value, int timeStampSamples)



addEffect

Adds a effect (index = -1 to append it at the end).

Synth.addEffect( String type,  String id, int index)



addMessageFromHolder

Adds the event from the given holder and returns a event id for note ons.

Synth.addMessageFromHolder(var messageHolder)



addModulator

Adds a Modulator to the synth's chain. If it already exists, it returns the index.

Synth.addModulator(int chainId,  String type,  String id)



addNoteOff

Adds a note off to the buffer.

Synth.addNoteOff(int channel, int noteNumber, int timeStampSamples)



addNoteOn

Adds a note on to the buffer.

Synth.addNoteOn(int channel, int noteNumber, int velocity, int timeStampSamples)



addPitchFade

Adds a pitch fade to the given event ID.

Synth.addPitchFade(int eventId, int fadeTimeMilliseconds, int targetCoarsePitch, int targetFinePitch)



addToFront

Adds the interface to the Container's body (or the frontend interface if compiled)

Synth.addToFront(bool addToFront)



addVolumeFade

Fades all voices with the given event id to the target volume (in decibels).

Synth.addVolumeFade(int eventId, int fadeTimeMilliseconds, int targetVolume)



deferCallbacks

Defers all callbacks to the message thread (midi callbacks become read-only).

Synth.deferCallbacks(bool makeAsynchronous)



getAllModulators

Returns an array of all modulators that match the given regex.

Synth.getAllModulators(String regex)



getAttribute

Returns the attribute of the parent synth.

Synth.getAttribute(int attributeIndex)



getAudioSampleProcessor

Returns the child synth with the supplied name.

Synth.getAudioSampleProcessor( String name)



getChildSynth

Returns the child synth with the supplied name.

Synth.getChildSynth( String name)



getChildSynthByIndex

Returns the child synth with the given index.

Synth.getChildSynthByIndex(int index)



getEffect

Returns the Effect with the supplied name. Can only be called in onInit(). It looks also in all child processors.

Synth.getEffect( String name)



getIdList

Searches the child processors and returns a list with every ID of the given type.

Synth.getIdList( String type)



getMidiPlayer

Creates a reference to the given MIDI player.

Synth.getMidiPlayer( String playerId)



getMidiProcessor

Returns the MidiProcessor with the supplied name. Can not be the own name!

Synth.getMidiProcessor( String name)



getModulator

Returns the Modulator with the supplied name. Can be only called in onInit. It looks also in all child processors.

Synth.getModulator( String name)



getModulatorIndex

Returns the index of the Modulator in the chain with the supplied chainId

Synth.getModulatorIndex(int chainId,  String id)



getNumChildSynths

Returns the number of child synths. Works with SynthGroups and SynthChains.

Synth.getNumChildSynths()



getNumPressedKeys

Returns the number of pressed keys (!= the number of playing voices!).

Synth.getNumPressedKeys()



getRoutingMatrix

Creates a reference to the routing matrix of the given processor.

Synth.getRoutingMatrix( String processorId)



getSampler

Returns the first sampler with the name name.

Synth.getSampler( String name)



getSlotFX

Returns the first slot with the given name.

Synth.getSlotFX( String name)



getTableProcessor

Returns the table processor with the given name.

Synth.getTableProcessor( String name)



getTimerInterval

Returns the current timer interval in seconds.

Synth.getTimerInterval()



isKeyDown

Checks if the given key is pressed.

Synth.isKeyDown(int noteNumber)



isLegatoInterval

Checks if any key is pressed.

Synth.isLegatoInterval()



isSustainPedalDown

Returns true if the sustain pedal is pressed.

Synth.isSustainPedalDown()



isTimerRunning

Checks if the timer for this script is running.

Synth.isTimerRunning()



noteOff

Sends a note off message. The envelopes will tail off.

Synth.noteOff(int noteNumber)



noteOffByEventId

Sends a note off message for the supplied event ID. This is more stable than the deprecated noteOff() method.

Synth.noteOffByEventId(int eventId)



noteOffDelayedByEventId

Sends a note off message for the supplied event ID with the given delay in samples.

Synth.noteOffDelayedByEventId(int eventId, int timestamp)



playNote

Plays a note and returns the event id. Be careful or you get stuck notes!

Synth.playNote(int noteNumber, int velocity)



playNoteWithStartOffset

Plays a note and returns the event id with the given channel and start offset.

Synth.playNoteWithStartOffset(int channel, int number, int velocity, int offset)



removeEffect

Removes the given effect.

Synth.removeEffect(var effect)



removeModulator

Removes the modulator.

Synth.removeModulator(var mod)



sendController

Sends a controller event to the synth.

Synth.sendController(int controllerNumber, int controllerValue)



sendControllerToChildSynths

The same as sendController (for backwards compatibility)

Synth.sendControllerToChildSynths(int controllerNumber, int controllerValue)



setAttribute

Sets an attribute of the parent synth.

Synth.setAttribute(int attributeIndex, float newAttribute)



setClockSpeed

Sets the internal clock speed.

Synth.setClockSpeed(int clockSpeed)



setMacroControl

Sets one of the eight macro controllers to the newValue.

Synth.setMacroControl(int macroIndex, float newValue)



setModulatorAttribute

Sets a ModulatorAttribute.

Synth.setModulatorAttribute(int chainId, int modulatorIndex, int attributeIndex, float newValue)



setShouldKillRetriggeredNote

If set to true, this will kill retriggered notes (default).

Synth.setShouldKillRetriggeredNote(bool killNote)



setVoiceGainValue

Applies a gain factor to a specified voice.

Synth.setVoiceGainValue(int voiceIndex, float gainValue)



setVoicePitchValue

Applies a pitch factor (0.5 ... 2.0) to a specified voice.

Synth.setVoicePitchValue(int voiceIndex, double pitchValue)



startTimer

Starts the timer of the synth.

Synth.startTimer(double seconds)



stopTimer

Stops the timer of the synth. You can call this also in the timer callback.

Synth.stopTimer()