Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

### Exciting the Digitar String

A new pluck'' is obtained in the digitar algorithm by writing new random numbers into the waveform memory (the delay line in Fig.1). The fundamental frequency is approximately given by the sampling rate divided by the memory length , or . This relation is not exact because the two-point average adds a half-sample phase delay .5A more accurate formula is therefore (1)

This formula can be used as exact for practical purposes, but it is not exact in theory due to the slight decay per period caused by the two-point average.6

Figure 2 lists a Faust program implementing the digitar algorithm (adapted from the programming example karplus.dsp distributed with Faust), and Fig.3 shows the block diagram generated by faust for the resonator definition in Fig.2 (using the -svg command-line option, as discussed in the Faust intro ). If this Faust code is not self-explanatory, see  and/or .

 import("music.lib"); // define noise, SR, delay // MIDI-driven parameters: freq = nentry("freq Hz", 440, 20, 20000, 1); // Hz gain = nentry("gain", 1, 0, 10, 0.01); // 0 to 1 gate = button("gate"); // 0 or 1 // Excitation gate (convert gate to a one-period pulse): diffgtz(x) = (x-x') > 0; decay(n,x) = x - (x>0)/n; release(n) = + ~ decay(n); trigger(n) = diffgtz : release(n) : > (0.0); // Resonator: average(x) = (x+x')/2; P = SR/freq; resonator = (+ : delay(4096, P)) ~ (average); process = noise : *(gain) : *(gate : trigger(P)) : resonator; Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top