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