Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Created February 13, 2013 07:47
Show Gist options
  • Save TooTallNate/4942956 to your computer and use it in GitHub Desktop.
Save TooTallNate/4942956 to your computer and use it in GitHub Desktop.
node-ogg + node-vorbis encoder example
/**
* Module dependencies.
*/
var ogg = require('ogg');
var vorbis = require('vorbis');
var oe = new ogg.Encoder();
var ve = new vorbis.Encoder();
// not yet implemented...
//ve.addComment('hello', 'world');
// `process.stdin` must be PCM float 32-bit signed little-endian samples, 2 channels, 44,100hz sample rate
// the `channels` and `sampleRate` will be configurable in the future
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);
@base698
Copy link

base698 commented Feb 13, 2013

Thanks. It doesn't look like it's implemented, got this error: TypeError: Object # has no method 'write'
at write (/Users/justinthomas/workspaces/node-ogg/node_modules/wav/node_modules/readable-stream/readable.js:405:24)
at flow (/Users/justinthomas/workspaces/node-ogg/node_modules/wav/node_modules/readable-stream/readable.js:415:7)

@base698
Copy link

base698 commented Feb 13, 2013

Or it's just erroring out somewhere in the wav library. Going to bed, if you need me to write a working example in any of the readme.md's let me know.

@TooTallNate
Copy link
Author

Documentation patches are always welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment