lowpass
Simple nodejs Audio manipulation library, based on node-wav
This module offers basics nodejs manipuji
- LowPass : fast and basic (moving average-based) low pass filter
- Cutter : Basic Stream to handle mp3 streams
- Wav2energy : Transform
- getBPM : soundstretch wrapper for nodejs
- getBuildUp : Build-up detection (when music energy is more than a defined threshold)
Combined with node-lame it can also manage mp3 files.
Installation
Install through npm:
$ npm install lowpass
Example
Here's how you would use the lowpass filter on a standard PCM WAVE file out of the speakers using node-wav and node-speaker :
var fs = ;var wav = ;var Speaker = ;var LowPass = LowPass;var file = fs;var reader = ;var speaker lowpass;// the "format" event gets emitted at the end of the WAVE headerreader;// pipe the WAVE file to the Reader instancefile;
Same example with mp3 file and the node-lame package
var fs = ;var wav = ;var Speaker = ;var LowPass = LowPass;var file = fs;var lame = ;var speaker lowpass;// start reading the MP3 file from the inputvar decoder = ;// we have to wait for the "format" event before we can start encodingdecoder;// and start transferring the datafile;{speaker = format;lowPass =format : format;// write the decoded MP3 into the lowpass filter then the speakerdecoder;};
LowPass()
The LowPass
class accepts the data from node-wav outputs the raw
audio data transformed by the low pass.
it has the following options :
var LowPass = LowPass;//First formformat : format //format from node-wav, mandatory optionmovAvLength : 128 // moving average window;//Second Formformat : format //format from node-wav, mandatory optionmovAvLength : 152 // Hz;
By default the cut-off correspond to a 128 length moving average window. For a 44100 sampleRate, it is equivalent to 152Hz low pass filter.
getBPM()
The getBPM
function call soundstretch utility to get the BPM of a song.
var getBPM = getBPM;;
Be carefull, soundstretch must be installed in your system.
Other tools
See examples
Thanks
Thanks to TooTallNate for the published libraries