Divooka Reference

Format

8 nodes

On this page 8

Change Speed

Function

Plays a clip faster or slower, the way a tape or a record does - pitch and tempo change together.

Signature
ChangeSpeed(audio: AudioBuffer, factor: Number) -> AudioBuffer
AudioBuffer ChangeSpeed(AudioBuffer audio, double factor = 1.5)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to change.
factorNumber1.5How much faster: above 1 speeds up, below 1 slows down.

Returns

AudioAudioBuffer

Remarks

A factor of 2 is twice as fast and an octave higher; 0.5 is half speed and an octave lower.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

From Samples

Function

A one-channel clip made from an array of numbers from -1 to 1, one per sample.

Signature
FromSamples -> AudioBuffer
    samples: Number Array
    sampleRate: Integer
AudioBuffer FromSamples(
    double[] samples,
    int sampleRate = 44100)

Parameters

nametypedefaultdescription
samplesNumber Array—The samples, in order.
sampleRateInteger44100How many of them make a second.

Returns

AudioAudioBuffer

Remarks

Values beyond -1 and 1 are clipped when the clip is stored.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

Pan

Function

Places a clip between the left and right speakers.

Signature
Pan(audio: AudioBuffer, position: Number) -> AudioBuffer
AudioBuffer Pan(AudioBuffer audio, double position = 0)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to place.
positionNumber0-1 is fully left, 0 the centre, 1 fully right.

Returns

AudioAudioBuffer

Remarks

A mono clip is panned at constant power - at the centre each side is 3 dB down, so it sounds as loud wherever it is placed. A stereo clip is balanced instead: the side it moves away from is turned down and the near side is left alone, so at the centre it passes through unchanged.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

Resample

Function

Converts a clip to another sample rate without changing how it sounds.

Signature
Resample(audio: AudioBuffer, sampleRate: Integer) -> AudioBuffer
AudioBuffer Resample(AudioBuffer audio, int sampleRate = 48000)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to convert.
sampleRateInteger48000The new number of samples per second.

Returns

AudioAudioBuffer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

To Mono

Function

Mixes every channel of a clip down to one.

Signature
ToMono(audio: AudioBuffer) -> AudioBuffer
AudioBuffer ToMono(AudioBuffer audio)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to mix down.

Returns

AudioAudioBuffer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

To Samples

Function

One channel of a clip as an array of numbers from -1 to 1, one per sample - for arithmetic the toolbox has no node for.

Signature
ToSamples(audio: AudioBuffer, channel: Integer) -> Number Array
double[] ToSamples(AudioBuffer audio, int channel = 0)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to read.
channelInteger0Which channel, counting from 0; 0 is the left of a stereo clip.

Returns

SamplesNumber Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

To Standard

Function

Converts a clip to the platform's standard 44.1 kHz stereo segment, which some other toolboxes ask for.

Signature
ToStandard(audio: AudioBuffer) -> StandardAudioSegment
StandardAudioSegment ToStandard(AudioBuffer audio)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to convert.

Returns

AudioStandardAudioSegment
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing

To Stereo

Function

Gives a clip two channels: a mono clip is heard equally on both sides, and a clip with more than two keeps its first two.

Signature
ToStereo(audio: AudioBuffer) -> AudioBuffer
AudioBuffer ToStereo(AudioBuffer audio)

Parameters

nametypedefaultdescription
audioAudioBuffer—The clip to convert.

Returns

AudioAudioBuffer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Format
Package
Audio Processing