Divooka Reference

Instruments

8 nodes

On this page 8

FM Instrument

Function

A General MIDI voice on an emulated OPL FM chip.

Signature
FmInstrument -> Instrument
    instrument: General Midi Instrument
    chip: OplChipType
Instrument FmInstrument(
    GeneralMidiInstrument instrument = GeneralMidiInstrument.AcousticGrandPiano,
    OplChipType chip = OplChipType.Opl3)

Parameters

nametypedefaultdescription
instrumentGeneral Midi InstrumentAcoustic grand pianoWhich voice.
chipOplChipTypeOpl3OPL2 or OPL3.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

Play Part

Function

Music played on one instrument, whatever instruments it names: a part, ready for the mixer.

Signature
PlayPart -> AudioBuffer
    music: Music
    instrument: Instrument
    beatsPerMinute: Number
    tail: Number
    sampleRate: Integer
AudioBuffer PlayPart(
    Music music,
    Instrument instrument,
    double beatsPerMinute = 120,
    double tail = 1,
    int sampleRate = 44100)

Parameters

nametypedefaultdescription
musicMusic—The part.
instrumentInstrument—What plays it.
beatsPerMinuteNumber120Quarter notes a minute.
tailNumber1Seconds after the last note.
sampleRateInteger44100Output rate.

Returns

AudioAudioBuffer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

Plucked Instrument

Function

A plucked string: each note a burst of noise ringing at its pitch, dying away high harmonics first, damped when the key lifts.

Signature
PluckedInstrument -> Instrument
    decay: Number
    brightness: Number
    release: Number
    gain: Number
Instrument PluckedInstrument(
    double decay = 3,
    double brightness = 0.6,
    double release = 0.08,
    double gain = 0.6)

Parameters

nametypedefaultdescription
decayNumber3Seconds for a held note to fall 60 dB.
brightnessNumber0.60 to 1: a soft finger to a hard pick; louder notes are brighter.
releaseNumber0.08Seconds a lifted note takes to be damped.
gainNumber0.6The voice's level.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

Preset Instrument

Function

Any preset of a SoundFont - another bank's variation, or a drum kit, which plays by key.

Signature
PresetInstrument -> Instrument
    preset: Sound Font Preset
    soundFont: Sound Font Bank
Instrument PresetInstrument(
    SoundFontPreset preset,
    SoundFontBank soundFont)

Parameters

nametypedefaultdescription
presetSound Font Preset—The preset, from Presets or Find Preset.
soundFontSound Font Bank—The font it belongs to; the default when not connected.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

Sampler Instrument

Function

A recording played at every pitch: the root note at its own speed, the rest faster or slower.

Signature
SamplerInstrument -> Instrument
    sample: AudioBuffer
    rootNote: Text
    attack: Number
    release: Number
    loop: Truth
Instrument SamplerInstrument(
    AudioBuffer sample,
    string rootNote = "C4",
    double attack = 0.002,
    double release = 0.1,
    bool loop = false)

Parameters

nametypedefaultdescription
sampleAudioBuffer—The recording.
rootNoteTextC4The note it sounds at, such as C4.
attackNumber0.002Seconds to fade in.
releaseNumber0.1Seconds to fade out after each note.
loopTruthFalseWhether a long note loops the recording.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

SoundFont Instrument

Function

A General MIDI instrument from a SoundFont.

Signature
SoundFontInstrument -> Instrument
    instrument: General Midi Instrument
    soundFont: Sound Font Bank
Instrument SoundFontInstrument(
    GeneralMidiInstrument instrument = GeneralMidiInstrument.AcousticGrandPiano,
    SoundFontBank soundFont)

Parameters

nametypedefaultdescription
instrumentGeneral Midi InstrumentAcoustic grand pianoWhich instrument.
soundFontSound Font Bank—The font; the default General MIDI one when not connected.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

Synth Instrument

Function

A subtractive synthesizer: detuned band-limited oscillators through a resonant ladder filter that the envelope opens.

Signature
SynthInstrument -> Instrument
    shape: Oscillator Shape
    detune: Number
    cutoff: Number
    resonance: Number
    filterEnvelope: Number
    attack: Number
    decay: Number
    sustain: Number
    release: Number
    gain: Number
Instrument SynthInstrument(
    OscillatorShape shape = OscillatorShape.Saw,
    double detune = 8,
    double cutoff = 600,
    double resonance = 0.3,
    double filterEnvelope = 2400,
    double attack = 0.005,
    double decay = 0.25,
    double sustain = 0.5,
    double release = 0.2,
    double gain = 0.4)

Parameters

nametypedefaultdescription
shapeOscillator ShapeSawThe oscillators' waveform.
detuneNumber8Cents between the two oscillators; 0 for one.
cutoffNumber600The filter's resting cutoff, hertz.
resonanceNumber0.30 to 1.
filterEnvelopeNumber2400Hertz the envelope opens the filter by.
attackNumber0.005Seconds to rise.
decayNumber0.25Seconds to settle.
sustainNumber0.5The level held, 0 to 1.
releaseNumber0.2Seconds to die away.
gainNumber0.4The voice's level.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music

Wavetable Instrument

Function

A wavetable synthesizer: each note plays the table at its pitch while the envelope sweeps the position, so the timbre moves as the note sounds.

Signature
WavetableInstrument -> Instrument
    table: Wavetable
    position: Number
    sweep: Number
    cutoff: Number
    attack: Number
    decay: Number
    sustain: Number
    release: Number
    gain: Number
Instrument WavetableInstrument(
    Wavetable table,
    double position = 0,
    double sweep = 0.6,
    double cutoff = 6000,
    double attack = 0.01,
    double decay = 0.4,
    double sustain = 0.6,
    double release = 0.3,
    double gain = 0.4)

Parameters

nametypedefaultdescription
tableWavetable—The waves; sine, triangle, saw and square when not connected.
positionNumber0Where across the waves a note rests, 0 to 1.
sweepNumber0.6How far the envelope moves the position at its peak.
cutoffNumber6000The lowpass cutoff, hertz.
attackNumber0.01Seconds to rise.
decayNumber0.4Seconds to settle.
sustainNumber0.6The level held, 0 to 1.
releaseNumber0.3Seconds to die away.
gainNumber0.4The voice's level.

Returns

InstrumentInstrument
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Instruments
Package
Music