Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ability to append an fx chain to sox
  • Loading branch information
shama committed Dec 20, 2012
1 parent 8527632 commit cdfcc2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions index.js
Expand Up @@ -145,32 +145,32 @@ function mergeArgs (opts, args) {
}, []);
}

B.prototype.play = function (opts) {
B.prototype.play = function (opts, fx) {
// using the play command from http://sox.sourceforge.net/

var ps = spawn('play', mergeArgs(opts, {
'c' : this.channels.length,
'r' : this.rate,
't' : 's16',
}).concat('-'));
}).concat('-', fx || []));

this.pipe(ps.stdin);
return ps;
};

B.prototype.record = function (file, opts) {
B.prototype.record = function (file, opts, fx) {
// using the sox command from http://sox.sourceforge.net/
console.dir(mergeArgs(opts, {
'c' : this.channels.length,
'r' : this.rate,
't' : 's16',
}).concat('-', '-o', file));
}).concat('-', '-o', file, fx || []));

var ps = spawn('sox', mergeArgs(opts, {
'c' : this.channels.length,
'r' : this.rate,
't' : 's16',
}).concat('-', '-o', file));
}).concat('-', '-o', file, fx || []));

this.pipe(ps.stdin);
return ps;
Expand Down
7 changes: 5 additions & 2 deletions readme.markdown
Expand Up @@ -48,15 +48,18 @@ clips higher and lower values.
expects an integer output value in `[0,Math.pow(2,type)-1]`.


## b.play(opts)
## b.play(opts, fx)

Play the audio demo with the [play command](http://sox.sourceforge.net/).

You can also call `b.pipe()` to handle the output stream yourself.

`opts` are passed directly through to sox.

## b.record(file, opts)
`fx` is an array to append an effects chain to sox. ie,
`b.play({}, ['echos', '0.8', '0.7', '400.0', '0.25', '63.0', '0.3']);`

## b.record(file, opts, fx)

Save the audio stream to `file` using the
[sox command](http://sox.sourceforge.net/).
Expand Down

0 comments on commit cdfcc2b

Please sign in to comment.