Divooka Reference

Songs

7 nodes

On this page 7

Instrument Map

Function

An instrument map: what plays the drums and what plays every program not mapped. Map Instrument adds programs to it.

Signature
Map(fallback: Instrument, drums: Instrument) -> Instrument Map
InstrumentMap Map(Instrument fallback, Instrument drums)

Parameters

nametypedefaultdescription
fallbackInstrument—What plays any program not mapped; the default SoundFont's preset for it when not connected.
drumsInstrument—What plays the drums; the default SoundFont's kit when not connected.

Returns

MapInstrument Map
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Songs
Package
Music

Map Instrument

Function

A map with one more program given its own instrument: the song's bass on a synth, its strings on a sampler.

Signature
MapInstrument -> Instrument Map
    map: Instrument Map
    program: General Midi Instrument
    instrument: Instrument
InstrumentMap MapInstrument(
    InstrumentMap map,
    GeneralMidiInstrument program,
    Instrument instrument)

Parameters

nametypedefaultdescription
mapInstrument Map—The map so far; an empty one when not connected.
programGeneral Midi Instrument—The program the song names.
instrumentInstrument—What plays it.

Returns

MapInstrument Map
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Songs
Package
Music

MIDI Song Parts

Function

A MIDI file played part by part, at its own tempo.

Signature
MidiSongParts -> Song Part Array
    MIDI: MidiDocument
    map: Instrument Map
    tail: Number
    sampleRate: Integer
SongPart[] MidiSongParts(
    MidiDocument midi,
    InstrumentMap map,
    double tail = 1,
    int sampleRate = 44100)

Parameters

nametypedefaultdescription
MIDIMidiDocument—The MIDI document.
mapInstrument Map—The instrument map.
tailNumber1Seconds after the last note.
sampleRateInteger44100Output rate.

Returns

PartsSong Part Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Songs
Package
Music

MIDI Tempo

Function

The tempo a MIDI file starts at, for playing music read from it with From MIDI at the speed it was written.

Signature
MidiTempo(MIDI: MidiDocument) -> Number
double MidiTempo(MidiDocument midi)

Parameters

nametypedefaultdescription
MIDIMidiDocument—The MIDI document.

Returns

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

Play MIDI Song

Function

A MIDI file played as it is written - its own tempo changes and program changes - with every instrument on what the map gives it.

Signature
PlayMidiSong -> AudioBuffer
    MIDI: MidiDocument
    map: Instrument Map
    tail: Number
    sampleRate: Integer
AudioBuffer PlayMidiSong(
    MidiDocument midi,
    InstrumentMap map,
    double tail = 1,
    int sampleRate = 44100)

Parameters

nametypedefaultdescription
MIDIMidiDocument—The MIDI document.
mapInstrument Map—The instrument map; every program on the default SoundFont when not connected.
tailNumber1Seconds after the last note.
sampleRateInteger44100Output rate.

Returns

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

Play Song

Function

A piece of music played with every instrument it names, each on what the map gives it.

Signature
PlaySong -> AudioBuffer
    music: Music
    map: Instrument Map
    beatsPerMinute: Number
    tail: Number
    sampleRate: Integer
AudioBuffer PlaySong(
    Music music,
    InstrumentMap map,
    double beatsPerMinute = 120,
    double tail = 1,
    int sampleRate = 44100)

Parameters

nametypedefaultdescription
musicMusic—The piece.
mapInstrument Map—The instrument map; every program on the default SoundFont when not connected.
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
Songs
Package
Music

Song Parts

Function

A piece of music played part by part: one clip for each instrument it names and one for its drums, all as long as the song, ready for Arrange Song or a Mix Track each.

Signature
SongParts -> Song Part Array
    music: Music
    map: Instrument Map
    beatsPerMinute: Number
    tail: Number
    sampleRate: Integer
SongPart[] SongParts(
    Music music,
    InstrumentMap map,
    double beatsPerMinute = 120,
    double tail = 1,
    int sampleRate = 44100)

Parameters

nametypedefaultdescription
musicMusic—The piece.
mapInstrument Map—The instrument map.
beatsPerMinuteNumber120Quarter notes a minute.
tailNumber1Seconds after the last note.
sampleRateInteger44100Output rate.

Returns

PartsSong Part Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Songs
Package
Music