Bindings for PortAudio giving JavaScript access to sound card samples (mostly unmaintained)
Bindings for PortAudio giving JavaScript access to sound card samples (mostly unmaintained)
A C++ extension for node.js that gives javascript access to audio buffers and basic audio processing functionality
Right now, it's basically a node.js binding for PortAudio.
NOTE: Looking for help maintaining this repository!
Active contributors:
npm install node-core-audioBelow is the most basic use of the audio engine. We create a new instance of node-core-audio, and then give it our processing function. The audio engine will call the audio callback whenever it needs an output buffer to send to the sound card.
…// Alternatively, you can read/write samples to the sound card manually
var engine = coreAudio.createNewAudioEngine();
// Grab a buffer
var buffer = engine.read();
// Silence the 0th channel
for( var iSample=0; iSample<inputBuffer[0].length; ++iSample )
buffer[0][iSample] = 0.0;
// Send the buffer back to the sound card
engine.write( buffer );When you are writing code inside of your audio callback, you are operating on the processing thread of the application. This high priority environment means you should try to think about performance as much as possible. Allocations and other complex operations are possible, but dangerous.
IF YOU TAKE TOO LONG TO RETURN A BUFFER TO THE SOUND CARD, YOU WILL HAVE AUDIO DROPOUTS
The basic principle is that you should have everything ready to go before you enter the processing function. Buffers, objects, and functions should be created in a constructor or static function outside of the audio callback whenever possible. The examples in this readme are not necessarily good practice as far as performance is concerned.
The callback is only called if all buffers has been processed by the soundcard.
First things first
var coreAudio = require("node-core-audio");Create and audio processing function
function processAudio( inputBuffer ) {
// Just print the value of the first sample on the left channel
console.log( inputBuffer[0][0] );
}Initialize the audio engine and setup the processing loop
var engine = coreAudio.createNewAudioEngine();
engine.addAudioCallback( processAudio );General functionality
…MIT - See LICENSE file.
Copyright Mike Vegeto, 2013
No open issues yet, or sync has not completed.