NodeJS native binding to libvorbis

npm install vorbis-superjoe
2 downloads in the last week
8 downloads in the last month


NodeJS native binding to libvorbis

Build Status

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


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


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

  // 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...



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.

// send the encoded Vorbis pages to the Ogg encoder

// write the produced Ogg file with Vorbis audio to `process.stdout`

See the examples directory for some more example code.


Decoder class

Encoder class

npm loves you