Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Node.js native bindings to libmp3lame & libmpg123

License

NotificationsYou must be signed in to change notification settings

FlatIO/node-lame

 
 

Repository files navigation

NodeJS native bindings to libmp3lame & libmpg123

For all your async streaming MP3 encoding/decoding needs, there'snode-lame!This module hooks into libmp3lame, the library that thelame command uses, toprovideEncoder andDecoder streams to NodeJS.

Installation

node-lame comes bundled with its own copy oflibmp3lame andlibmpg123, sothere's no need to have them installed on your system.

Simply compile and installnode-lame usingnpm:

$ npm install @flat/lame

Example

Here's an example of using@flat/node-lame to encode some raw PCM data coming fromprocess.stdin to an MP3 file that gets piped toprocess.stdout:

varlame=require('@flat/lame');// create the Encoder instancevarencoder=newlame.Encoder({// inputchannels:2,// 2 channels (left and right)bitDepth:16,// 16-bit samplessampleRate:44100,// 44,100 Hz sample rate// outputbitRate:128,outSampleRate:22050,mode:lame.STEREO// STEREO (default), JOINTSTEREO, DUALCHANNEL or MONO});// raw PCM data from stdin gets piped into the encoderprocess.stdin.pipe(encoder);// the generated MP3 file gets piped to stdoutencoder.pipe(process.stdout);

See theexamples directory for some more example code.

API

Decoder class

TheDecoder class is aStream subclass that accepts MP3 data written to it,and outputs raw PCM data. It also emits a"format" event when the format ofthe MP3 file is determined (usually right at the beginning).

Encoder class

TheEncoder class is aStream subclass that accepts raw PCM data written toit, and outputs a valid MP3 file. You must specify the PCM data format whencreating the encoder instance. Only 16-bit signed samples are currentlysupported (rescale before passing to the encoder if necessary)...

About

Node.js native bindings to libmp3lame & libmpg123

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++69.6%
  • JavaScript29.4%
  • Python1.0%

[8]ページ先頭

©2009-2025 Movatter.jp