Nidium provides a low level audio API, a powerful interface to play and process digital audio signal.

Nidium Audio system was designed from scratch and operates in its own separate thread.

It uses an AudioBuffer for sounds. The API supports loading audio file data in multiple formats, such as mp3, wav, ogg, wma, aac.

// The following snippet demonstrates loading and playing a sound sample:
// * Get the audio context with 'Audio.getContext()'
var dsp = Audio.getContext();

// * Create nodes using the `createNode()` method
var src = dsp.createNode("source", 0, 2);  // No input, 2 output channels
var out = dsp.createNode("target", 2, 0); // 2 input channels, No output

// * Connect the nodes using the 'AudioNode.connect()' method
dsp.connect(src.output[0], out.input[0]);
dsp.connect(src.output[1], out.input[1]);

// * Open a mp3 file"path/to/file.mp3");

// * And play it;

getContext([buffersize=0][, channels=2][, sampleRate=4]) (static)

Create or retrieve the current AudioContext.

If an argument is 0 or none arguments are providen, the best values are selected.

You can only have one AudioContext, if you call getContext multiple times with different parameters the previous AudioContext will become invalid. Calling getContext without arguments will return the current AudioContext.

buffersize (Integer)

Buffer size

channels (Integer)

Number of channels to use

sampleRate (Integer)

Sample rate

Returns: AudioContext

AudioContext instance

Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!