| 1 |
// Listing 6.7 Simple plucked string physical model |
| 2 |
|
| 3 |
// Super simple Karplus-Strong plucked string |
| 4 |
Impulse imp => Delay str => dac; |
| 5 |
|
| 6 |
// connect 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 |
| 16 |
1.0 => imp.next; // (1) Tells the impulse to output a |
| 17 |
// 1.0 (only for the next sample) |
| 18 |
|
| 19 |
// let the string "ring" a bit |
| 20 |
5.0 :: second => now; |