NodeJS native bindings to libmp3lame & libmpg123
For all your async streaming MP3 encoding/decoding needs, there's
This module hooks into libmp3lame, the library that the
lame command uses, to
Decoder streams to NodeJS.
node-lame comes bundled with its own copy of
there's no need to have them installed on your system.
Simply compile and install
$ npm install lame
Here's an example of using
node-lame to encode some raw PCM data coming from
process.stdin to an MP3 file that gets piped to
var lame = ;// create the Encoder instancevar encoder =// inputchannels: 2 // 2 channels (left and right)bitDepth: 16 // 16-bit samplessampleRate: 44100 // 44,100 Hz sample rate// outputbitRate: 128outSampleRate: 22050mode: lameSTEREO // STEREO (default), JOINTSTEREO, DUALCHANNEL or MONO;// raw PCM data from stdin gets piped into the encoderprocessstdin;// the generated MP3 file gets piped to stdoutencoder;
examples directory for some more example code.
Decoder class is a
Stream subclass that accepts MP3 data written to it,
and outputs raw PCM data. It also emits a
"format" event when the format of
the MP3 file is determined (usually right at the beginning).
Encoder class is a
Stream subclass that accepts raw PCM data written to
it, and outputs a valid MP3 file. You must specify the PCM data format when
creating the encoder instance. Only 16-bit signed samples are currently
supported (rescale before passing to the encoder if necessary)...