MCPcopy Create free account
hub / github.com/TooTallNate/node-lame

github.com/TooTallNate/node-lame @v1.2.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.4 ↗ · + Follow
2,780 symbols 6,346 edges 364 files 673 documented · 24% updated 2y ago★ 57041 open issues

Browse by type

Functions 2,298 Types & classes 482
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

node-lame

NodeJS native bindings to libmp3lame & libmpg123

Build Status

For all your async streaming MP3 encoding/decoding needs, there's node-lame! This module hooks into libmp3lame, the library that the lame command uses, to provide Encoder and Decoder streams to NodeJS.

Installation

node-lame comes bundled with its own copy of libmp3lame and libmpg123, so there's no need to have them installed on your system.

Simply compile and install node-lame using npm:

$ npm install lame

Example

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 process.stdout:

var lame = require('lame');

// create the Encoder instance
var encoder = new lame.Encoder({
  // input
  channels: 2,        // 2 channels (left and right)
  bitDepth: 16,       // 16-bit samples
  sampleRate: 44100,  // 44,100 Hz sample rate

  // output
  bitRate: 128,
  outSampleRate: 22050,
  mode: lame.STEREO // STEREO (default), JOINTSTEREO, DUALCHANNEL or MONO
});

// raw PCM data from stdin gets piped into the encoder
process.stdin.pipe(encoder);

// the generated MP3 file gets piped to stdout
encoder.pipe(process.stdout);

See the examples directory for some more example code.

API

Decoder class

The 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

The 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)...

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 1,815
Method 483
Class 275
Enum 207

Languages

C68%
C++31%
C#1%
TypeScript1%

Modules by API surface

deps/lame/libmp3lame/set_get.c170 symbols
deps/lame/dshow/Mpegac.cpp90 symbols
deps/lame/libmp3lame/id3tag.c85 symbols
deps/mpg123/src/libmpg123/readers.c62 symbols
deps/mpg123/src/libmpg123/libmpg123.c59 symbols
deps/lame/ACM/tinyxml/tinyxml.h59 symbols
deps/lame/frontend/get_audio.c54 symbols
deps/lame/libmp3lame/lame.c44 symbols
deps/lame/misc/ath.c43 symbols
deps/mpg123/src/libmpg123/frame.c42 symbols
deps/lame/ACM/tinyxml/tinyxml.cpp41 symbols
deps/mpg123/src/mpg123.c40 symbols

For agents

$ claude mcp add node-lame \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page