In the prerequisite module, the loop time was determined to be the product of the delay line length and the sampling interval.
The reciprocal of the loop time is the pitch (frequency) of the output signal
f
0
f
0
MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8srps0lbbf9q8WrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfea0=yr0RYxir=Jbba9q8aq0=yq=He9q8qqQ8frFve9Fve9Ff0dmeaabaqaciGacaGaaeqabaWaaeaaeaaakeaacaWGMbWaaSbaaSqaaiaaicdaaeqaaaaa@3718@
:
f
0
=
f
S
N
f
0
=
f
S
N
MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOzamaaBaaaleaacaaIWaaabeaakiabg2da9maalaaabaGaamOzamaaBaaaleaacaWGtbaabeaaaOqaaiaad6eaaaaaaa@3AF8@
(1)
where
f
S
f
S
MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOzamaaBaaaleaacaWGtbaabeaaaaa@372A@
is the sampling frequency in Hz and
N
N
MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOtaaaa@360E@
is the length of the delay line in samples. Because the delay line length must be an integer number of samples, the
pitch cannot be set arbitrarily.
Try the following exercises to explore this concept in more detail.
The sampling frequency is 40.00 kHz, and the length of the delay line is 40 samples.
What is the pitch of the output signal? If the delay line length is decreased by one sample,
what is the new pitch?
1000 Hz (40 kHz divided by 40 samples); 1026 Hz
The sampling frequency is 10.00 kHz, and the length of the delay line is 10 samples.
What is the pitch of the output signal? If the delay line length is decreased by one sample,
what is the new pitch?
1000 Hz (10 kHz divided by 10 samples); 1111 Hz
For each of the two exercises, the first pitch is exactly the same, i.e., 1000 Hz. However, the
change in pitch caused by decreasing the delay line by only one sample is substantial (1026 Hz compared
to 1111 Hz). But how perceptible is this difference? The module
Musical Intervals and the Equal-Tempered Scale includes a
LabVIEW interactive front panel that displays the frequency of each key on a standard 88-key piano.
Pitch C6 is 1046 Hz while pitch C♯6 (a half-step higher) is 1109 Hz. These values are similar
to the change from 1000 Hz to 1111 Hz caused by altering the delay line length by only one sample,
so the change is certainly very audible. The abrupt "jump" in frequency becomes less pronounced
at lower pitches where the delay line length is longer.
Flexibility to adjust the overall loop time in a
continuous fashion is required to improve pitch accuracy. Moreover, any sources of delay in the loop must be accurately known.
So far the delay of the low pass filter has been taken as zero, but in fact the low pass filter
introduces a delay of its own.
The Figure 1 screencast video describes first how to calculate
the delay of an arbitrary digital filter with transfer function
H(z)
H(z)
MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamisaiaacIcacaWG6bGaaiykaaaa@3860@
.
In general, therefore, the delay is the negated slope of the filter's phase function, and the
delay varies with frequency.
Now, consider the specific low pass filter used in the basic Karplus-Strong algorithm. The
filter coefficient "g" will be taken as 0.5, making the filter a true two-point averager:
H
LPF
(z)=
1+
z
−1
2
H
LPF
(z)=
1+
z
−1
2
MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamisamaaBaaaleaacaqGmbGaaeiuaiaabAeaaeqaaOGaaiikaiaadQhacaGGPaGaeyypa0ZaaSaaaeaacaaIXaGaey4kaSIaamOEamaaCaaaleqabaGaeyOeI0IaaGymaaaaaOqaaiaaikdaaaaaaa@414E@
(2)
The Figure 2 screencast video continues the discussion by
deriving the delay of the low pass filter of Equation 2.
Several techniques for working with complex
numbers in LabVIEW are presented and used to visualize the magnitude and
phase response of the filter.
Because the delay of the low pass filter is always 1/2, the pitch may be expressed more precisely as
f
0
=
f
S
N+
1
2
f
0
=
f
S
N+
1
2
MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOzamaaBaaaleaacaaIWaaabeaakiabg2da9maalaaabaGaamOzamaaBaaaleaacaWGtbaabeaaaOqaaiaad6eacqGHRaWkdaWcaaqaaiaaigdaaeaacaaIYaaaaaaaaaa@3D61@
(3)
While this result more accurately calculates the pitch, it does nothing to address the frequency
resolution problem.
"A multimedia educational resource for signal processing students and faculty."