Permalink
Browse files

examples: refactor floatpcm2mp3 example a bit

  • Loading branch information...
1 parent 9554dd2 commit dd84168e99cae96161fed1da7257d8fe56988096 @TooTallNate committed Dec 10, 2012
Showing with 6 additions and 16 deletions.
  1. +6 −16 examples/floatpcm2mp3.js
View
@@ -2,19 +2,9 @@ var fs = require('fs');
var lame = require('../');
var path = require('path');
-var encoder = new lame.Encoder({
- bitDepth: 32,
- float: true
-});
-
-encoder.on('end', function() {
-
- console.log('Encoding ended!');
-});
-
-var pcmInput = fs.createReadStream(path.resolve(__dirname, 'sample.float.pcm'));
-var mp3Out = fs.createWriteStream(path.resolve(__dirname, 'sample_pcm.mp3'));
-
-pcmInput.pipe(encoder);
-encoder.pipe(mp3Out);
-
+fs.createReadStream(path.resolve(__dirname, 'sample.float.pcm'))
+ .pipe(new lame.Encoder({ bitDepth: 32, float: true }))
+ .pipe(fs.createWriteStream(path.resolve(__dirname, 'sample_pcm.mp3')))
+ .on('close', function () {
+ console.error('done!')
+ });

0 comments on commit dd84168

Please sign in to comment.