| 1 |
// Listing 6.8 Better plucked string physical model, excited with noise |
| 2 |
|
| 3 |
// Better Karplus-Strong plucked string |
| 4 |
Noise pluck => Delay str => dac; |
| 5 |
|
| 6 |
// hook string back into itself |
| 7 |
str => str; |
| 8 |
|
| 9 |
// round-trip string delay, 100 Hz At 44.1k SRATE |
| 10 |
441.0 :: samp => str.delay; |
| 11 |
|
| 12 |
// set round-trip string gain to less than 1.0 |
| 13 |
0.98 => str.gain; |
| 14 |
|
| 15 |
// "pluck" the string for the right amount of time |
| 16 |
1.0 => pluck.gain; |
| 17 |
441.0 :: samp => now; |
| 18 |
|
| 19 |
// shut off the noise generator |
| 20 |
0.0 => pluck.gain; |
| 21 |
|
| 22 |
// let the string "ring" a bit |
| 23 |
5.0 :: second => now; |