| @@ -1,17 +1,24 @@ |
| 1 | // chuck this with other shreds to record to file | 1 | // chuck this with other shreds to record to file |
| 2 | // example> chuck foo.ck bar.ck rec.ck | 2 | // example> chuck foo.ck bar.ck rec.ck |
| 3 | // (see also rec-auto-stereo.ck) | 3 | // (see also rec-auto-stereo.ck) |
| 4 | | 4 | // |
| 5 | // arguments: rec:<filename> | 5 | // arguments: rec:<filename> |
| 6 | | 6 | |
| | 7 | // filename |
| | 8 | string filename; |
| 7 | // get name | 9 | // get name |
| 8 | me.arg(0) => string filename; | 10 | if( me.args() > 0 ) me.arg(0) => filename; |
| 9 | if( filename.length() == 0 ) "foo.wav" => filename; | 11 | // default |
| | 12 | if( filename == "" ) "foo.wav" => filename; |
| 10 | | 13 | |
| 11 | // pull samples from the dac | 14 | // pull samples from the dac |
| 12 | dac => Gain g => WvOut w => blackhole; | 15 | dac => Gain g => WvOut w => blackhole; |
| 13 | // this is the output file name | 16 | // this is the output file name |
| 14 | filename => w.wavFilename; | 17 | filename => w.wavFilename; |
| | 18 | // optionally specify bit depth |
| | 19 | // (filename, IO.INT24) => w.wavFilename; |
| | 20 | |
| | 21 | // print |
| 15 | <<<"writing to file:", "'" + w.filename() + "'">>>; | 22 | <<<"writing to file:", "'" + w.filename() + "'">>>; |
| 16 | // any gain you want for the output | 23 | // any gain you want for the output |
| 17 | .5 => g.gain; | 24 | .5 => g.gain; |