| 1 |
// Listing 6.12 Simple reverb using three Delay UGens |
| 2 |
|
| 3 |
// Direct sound |
| 4 |
adc => Gain input => dac; // (1) Direct signal from adc to dac (through Gain) |
| 5 |
1.0 => input.gain; |
| 6 |
|
| 7 |
// Delay lines to model walls + ceiling |
| 8 |
// (2) adc to dac via three delay lines in parallel |
| 9 |
input => Delay d1 => dac; |
| 10 |
input => Delay d2 => dac; |
| 11 |
input => Delay d3 => dac; |
| 12 |
|
| 13 |
// Hook delay lines back to themselves |
| 14 |
// (3) Closes each delay loop (hook output to input) |
| 15 |
d1 => d1; |
| 16 |
d2 => d2; |
| 17 |
d3 => d3; |
| 18 |
|
| 19 |
// set feedback/loss on all delay lines |
| 20 |
0.6 => d1.gain => d2.gain => d3.gain; // (4) Can set all three delay |
| 21 |
// gains in one line of code |
| 22 |
|
| 23 |
// allocate memory and set delay lengths |
| 24 |
0.06 :: second => d1.max => d1.delay; // (5) Can set max and delay |
| 25 |
0.08 :: second => d2.max => d2.delay; // all in one line of code each |
| 26 |
0.10 :: second => d3.max => d3.delay; |
| 27 |
|
| 28 |
// Enjoy the room you built! |
| 29 |
while (1) { |
| 30 |
1.0 :: second => now; |
| 31 |
} |