Node.js native binding to libvorbis
JavaScript C++ Python
Latest commit 8381a11 Jul 7, 2016 @TooTallNate travis: don't test Node v3
Fails…
Failed to load latest commit information.
deps/libvorbis libvorbis: add mac ia32 config Feb 18, 2013
lib decoder: update to readable-stream v1 API Nov 9, 2013
src delete `binding.h` file Jan 21, 2016
test
.gitignore ignore only single letter .js files in the root Feb 13, 2013
.travis.yml travis: don't test Node v3 Jul 7, 2016
History.md Release 0.2.1 Jan 20, 2016
README.md update Node.js name Jan 28, 2016
binding.gyp Port to NAN Mar 2, 2015
common.gypi remove the find-ogg.js file Nov 14, 2012
index.js encoder: initial progress on the Encoder class Jan 27, 2013
package.json package: update deps Jul 7, 2016

README.md

node-vorbis

Node.js native binding to libvorbis

Build Status

This module provides Vorbis Encoder and Decoder classes compatible with node-ogg streams.

Installation

node-vorbis comes bundled with its own copy of libvorbis, so there's no need to have the library pre-installed on your system.

Simply compile and install node-vorbis using npm:

$ npm install vorbis

Example

Decoder example:

var fs = require('fs');
var ogg = require('ogg');
var vorbis = require('vorbis');
var file = __dirname + '/Hydrate-Kenny_Beltrey.ogg';

var od = new ogg.Decoder();
od.on('stream', function (stream) {
  var vd = new vorbis.Decoder();

  // the "format" event contains the raw PCM format
  vd.on('format', function (format) {
    // send the raw PCM data to stdout
    vd.pipe(process.stdout);
  });

  // an "error" event will get emitted if the stream is not a Vorbis stream
  // (i.e. it could be a Theora video stream instead)
  vd.on('error', function (err) {
    // maybe try another decoder...
  });

  stream.pipe(vd);
});

fs.createReadStream(file).pipe(od);

Encoder example:

var ogg = require('ogg');
var vorbis = require('vorbis');

var oe = new ogg.Encoder();
var ve = new vorbis.Encoder();

// not yet implemented...
ve.addComment('ARTIST', 'Bob Marley');

// `process.stdin` *MUST* be PCM float 32-bit signed little-endian samples.
// channels and sample rate are configurable but default to 2 and 44,100hz.
process.stdin.pipe(ve)

// send the encoded Vorbis pages to the Ogg encoder
ve.pipe(oe.stream());

// write the produced Ogg file with Vorbis audio to `process.stdout`
oe.pipe(process.stdout);

See the examples directory for some more example code.

API

Decoder class

Encoder class