| 1 |
// name: wvout-24bit.ck |
| 2 |
// desc: example of writing 24-bit audio files using WvOut |
| 3 |
// |
| 4 |
// requires: chuck-1.5.0.1 or higher |
| 5 |
// date: Summer 2023 |
| 6 |
|
| 7 |
// output |
| 8 |
SndBuf buffy => WvOut wout => blackhole; |
| 9 |
// monitor the audio |
| 10 |
buffy => dac; |
| 11 |
|
| 12 |
// load sound |
| 13 |
"special:dope" => buffy.read; |
| 14 |
|
| 15 |
// open WAV file to write to, with particular bit depth |
| 16 |
// possible bit depths include: |
| 17 |
// IO.INT16, IO.INT24, IO.INT32, IO.FLOAT32, IO.FLOAT64 |
| 18 |
("wvout-24bit.wav", IO.INT24) => wout.wavFilename; |
| 19 |
|
| 20 |
// print message |
| 21 |
cherr <= "outputting '" <= wout.filename() <= "'..." <= IO.nl(); |
| 22 |
|
| 23 |
// repeat 3 times |
| 24 |
repeat( 3 ) |
| 25 |
{ |
| 26 |
// seek to beginning |
| 27 |
0 => buffy.pos; |
| 28 |
// advance time |
| 29 |
buffy.samples()::samp => now; |
| 30 |
} |