Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.1.0
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (42 sloc) 1.328 kb

node-vorbis

NodeJS 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

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(stream);

  // 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...
  });
});

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

See the examples directory for some more example code.

API

Decoder class

Encoder class

Jump to Line
Something went wrong with that request. Please try again.