# lame

> NodeJS native bindings to libmp3lame & libmpg123.

Latest version **1.2.4** (published 2016-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install lame
pnpm add lame
yarn add lame
bun add lame
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2016-06-27 |
| First published | 2011-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 571 |
| Author | Nathan Rajlich |
| Maintainers | TooTallNate, linusu, tootallnate |
| Keywords | lame, mpg123, mp3, mpeg, mpg, encode, decode |

## Links

- npm: https://www.npmjs.com/package/lame
- Repository: https://github.com/TooTallNate/node-lame
- Homepage: https://github.com/TooTallNate/node-lame#readme
- Issues: https://github.com/TooTallNate/node-lame/issues
- npm.io page: https://npm.io/package/lame

## Dependencies (4)

- [nan](https://npm.io/package/nan.md) ^2.3.5
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [bindings](https://npm.io/package/bindings.md) ^1.2.1
- [readable-stream](https://npm.io/package/readable-stream.md) ^1.0.34

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 1.2.4 (latest) — 2016-06-27
- 1.2.3 — 2015-09-08
- 1.2.2 — 2015-05-02
- 1.2.1 — 2015-04-10
- 1.2.0 — 2015-03-06
- 1.1.2 — 2015-01-13
- 1.1.1 — 2014-07-28
- 1.1.0 — 2014-04-28
- 1.0.3 — 2013-08-28
- 1.0.2 — 2013-03-07
- 1.0.1 — 2012-12-22
- 1.0.0 — 2012-12-08
- 0.0.4 — 2012-04-12
- 0.0.3 — 2011-11-26
- 0.0.1 — 2011-11-12

## README

node-lame
=========
### NodeJS native bindings to libmp3lame & libmpg123
[![Build Status](https://travis-ci.org/TooTallNate/node-lame.svg?branch=master)](https://travis-ci.org/TooTallNate/node-lame)

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`:

``` bash
$ 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`:

``` javascript
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)...

---
_Source: https://npm.io/package/lame · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
