effect of wavetable on the spectral evolution of karplus ... · time evolution of the spectrum of...

11
IOSR Journal of VLSI and Signal Processing (IOSR-JVSP) Volume 6, Issue 6, Ver. III (Nov. - Dec. 2016), PP 01-11 e-ISSN: 2319 4200, p-ISSN No. : 2319 4197 www.iosrjournals.org DOI: 10.9790/4200-0606030111 www.iosrjournals.org 1 | Page Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes Venkata Krishna Rao M Professor, Dept of Electronics & Communications Engineering & Principal, Joginapally B.R. Engineering College, Hyderabad, India Abstract: The Karplus-Strong (KS) algorithm is the popular audio synthesis algorithm which synthesizes the sound of a plucked string at low computational complexity. Though it was classified as a wavetable synthesis technique, later it was shown to be a special case of more general physical modeling technique. A plucked string sound is rich in harmonics, slowly looses the higher harmonics and eventually reaches a steady state single tone signal. In this paper a systematic study is carried out to investigate the effect of wavetable on the time evolution of the spectrum of KS generated guitar notes. The results of this study are useful for the synthesis and classification of virtual instruments that use plucked strings, and also in melody extraction from instrumental music. Keywords: guitar notes; plucked string; audio synthesis; fret board; STFT analysis, spectral peak tracking I. Introduction The KarplusStrong (KS) algorithm is a very low complexity technique for synthesizing the sounds of a plucked string without any justification of the physical processing associated with the plucking a string. When a terminated string of a musical instrument is plucked, it vibrates with high energy producing a complex sound wave. Here complex means having strong and significant number of harmonics. The fundamental frequency of these harmonics is determined mainly by the string mass and tension. Due to air friction the string slowly loses its energy, the magnitude of oscillations gradually reduces; thus the wave becoming lesser complex i.e. with fewer harmonics and smaller amplitudes. As time progresses, all harmonics die leaving only the fundamental mode of oscillations resulting in a pure tone signal, and eventually the vibration of stops, once all the pluck energy is lost [1]. In scenario of a real instrument e.g. guitar, the vibrating string is stopped by finger and the string corresponding to the next note is plucked. Thus in general the waveforms corresponding to the notes of a musical phrase are truncated, except for the last note for which the full decayed waveform can be visualized. Guitar Fret Board Each musical instrument uses a standard octave and is normally operated over certain number of octaves above and below the standard octave, based on the pitch range of characteristic sounds that can be produced by the instrument. [2]. A standard acoustic guitar is string based instrument with 6 strings named E, A, D, G, B and Ė in the ascending order of the pitches produced. The pitch is basically determined by the mass and tension of the string. The fingerboard of a guitar has frets i.e. the raised strips of hard material arranged perpendicular to the strings. The frets allows the player stop the string consistently in the same location and with same force, and don't too much dampen the string vibrations as much as fingers alone do. This helps the notes to decay gracefully when the player stops a string in order to end the current note and wishes to start next note. The number of frets varies from instrument to instrument based on the octaves covered and accordingly the cost. The fretboard or fingerboard frequencies of a 20 fret guitar are given in Table 1. Related Work The algorithm for synthesizing a plucked string sound was originally proposed by Karplus and Strong [3] and later extended by Jaffe and Smith [4], in which deeper understanding and justification in relation to physical process was provided. In [4,5], the theory of digital waveguides for modeling of acoustic systems, including plucked strings was introduced. Though it was originally proposed as a wavetable synthesis techniques, later it was shown to be physical modeling. Karjalainen et al. [6,7] discussed the bidirectional digital waveguide model of a vibrating string and showed how the extended KS algorithm can be derived from it. They derived a single delay line model from the bidirectional digital delay and showed that it is same as the extended version of KS algorithm. The naturalness of the sound depends on decay rates for the different harmonics. It was shown in [3] that the decay time of the n-th harmonic approximately varies in proportion to p 3 /n 2 , where p is the length of the wavetable or the delay line for the 2-point moving average loop filter. This rate changes if the loop filter is changed for example even for a 3-point moving average filter. Moreover, the dependence of decay rates

Upload: doanminh

Post on 14-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

IOSR Journal of VLSI and Signal Processing (IOSR-JVSP)

Volume 6, Issue 6, Ver. III (Nov. - Dec. 2016), PP 01-11

e-ISSN: 2319 – 4200, p-ISSN No. : 2319 – 4197

www.iosrjournals.org

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 1 | Page

Effect of Wavetable on The Spectral Evolution of Karplus-Strong

Synthesized Guitar Notes

Venkata Krishna Rao M Professor, Dept of Electronics & Communications Engineering & Principal, Joginapally B.R. Engineering

College, Hyderabad, India

Abstract: The Karplus-Strong (KS) algorithm is the popular audio synthesis algorithm which synthesizes the

sound of a plucked string at low computational complexity. Though it was classified as a wavetable synthesis

technique, later it was shown to be a special case of more general physical modeling technique. A plucked

string sound is rich in harmonics, slowly looses the higher harmonics and eventually reaches a steady state

single tone signal. In this paper a systematic study is carried out to investigate the effect of wavetable on the

time evolution of the spectrum of KS generated guitar notes. The results of this study are useful for the synthesis

and classification of virtual instruments that use plucked strings, and also in melody extraction from

instrumental music.

Keywords: guitar notes; plucked string; audio synthesis; fret board; STFT analysis, spectral peak tracking

I. Introduction The Karplus–Strong (KS) algorithm is a very low complexity technique for synthesizing the sounds of

a plucked string without any justification of the physical processing associated with the plucking a string. When

a terminated string of a musical instrument is plucked, it vibrates with high energy producing a complex sound

wave. Here complex means having strong and significant number of harmonics. The fundamental frequency of

these harmonics is determined mainly by the string mass and tension. Due to air friction the string slowly loses

its energy, the magnitude of oscillations gradually reduces; thus the wave becoming lesser complex i.e. with

fewer harmonics and smaller amplitudes. As time progresses, all harmonics die leaving only the fundamental

mode of oscillations resulting in a pure tone signal, and eventually the vibration of stops, once all the pluck

energy is lost [1]. In scenario of a real instrument e.g. guitar, the vibrating string is stopped by finger and the

string corresponding to the next note is plucked. Thus in general the waveforms corresponding to the notes of a

musical phrase are truncated, except for the last note for which the full decayed waveform can be visualized.

Guitar Fret Board

Each musical instrument uses a standard octave and is normally operated over certain number of

octaves above and below the standard octave, based on the pitch range of characteristic sounds that can be

produced by the instrument. [2]. A standard acoustic guitar is string based instrument with 6 strings named E,

A, D, G, B and Ė in the ascending order of the pitches produced. The pitch is basically determined by the mass

and tension of the string. The fingerboard of a guitar has frets i.e. the raised strips of hard material arranged

perpendicular to the strings. The frets allows the player stop the string consistently in the same location and with

same force, and don't too much dampen the string vibrations as much as fingers alone do. This helps the notes

to decay gracefully when the player stops a string in order to end the current note and wishes to start next note.

The number of frets varies from instrument to instrument based on the octaves covered and accordingly the cost.

The fretboard or fingerboard frequencies of a 20 fret guitar are given in Table 1.

Related Work

The algorithm for synthesizing a plucked string sound was originally proposed by Karplus and Strong

[3] and later extended by Jaffe and Smith [4], in which deeper understanding and justification in relation to

physical process was provided. In [4,5], the theory of digital waveguides for modeling of acoustic systems,

including plucked strings was introduced. Though it was originally proposed as a wavetable synthesis

techniques, later it was shown to be physical modeling. Karjalainen et al. [6,7] discussed the bidirectional digital

waveguide model of a vibrating string and showed how the extended KS algorithm can be derived from it. They

derived a single delay line model from the bidirectional digital delay and showed that it is same as the extended

version of KS algorithm. The naturalness of the sound depends on decay rates for the different harmonics. It was

shown in [3] that the decay time of the n-th harmonic approximately varies in proportion to p3/n

2, where p is the

length of the wavetable or the delay line for the 2-point moving average loop filter. This rate changes if the loop

filter is changed for example even for a 3-point moving average filter. Moreover, the dependence of decay rates

Page 2: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 2 | Page

on the preloaded wavetable was not discussed.

Table 1. Guitar Fretboard frequencies String Number (Note)

Fret 1 (E) 2 (A) 3 (D) 4 (G) 5 (B) 6 (Ė ) 1

2

3 4

5

6 7

8

9 10

11

12 13

14

15 16

17

18 19

20

82.41

87.31

92.50 98.00

103.83

110.00 116.54

123.47

130.81 138.59

146.83

155.56 164.81

174.61

185.00 196.00

207.65

220.00 233.08

246.94

110.00

116.54

123.47 130.81

138.59

146.83 155.56

164.81

174.61185.00

196.00

207.65 220.00

233.08

246.94261.63

277.18

293.66 311.13

329.63

146.83

155.56

164.81 174.61

185.00

196.00 207.65

220.00

233.08 246.94

261.63

277.18 293.66

311.13

329.63 349.23

369.99

392.00 415.30

440.00

196.00

207.65

220.00 233.08

246.94

261.63 277.18

293.66

311.13 329.63

349.23

369.99 392.00

415.30

440.00 466.16

493.88

523.25 554.37

587.33

246.94

261.63

277.18 293.66

311.13

329.63 349.23

369.99

392.00 415.30

440.00

466.16 493.88

523.25

554.37 587.33

622.25

659.26 698.46

739.99

329.63

349.23

369.99 392.00

415.30

440.00 466.16

493.88

523.25 554.37

587.33

622.25

659.26

698.46

739.99 783.99

830.61

880.00 932.33

987.77

Though the steady state signal generated by the KS algorithm evolves to be a pure tone of single

frequency, the signal at initial stages is a basically transient-like which is rich in harmonics decaying

subsequently. No results are available in the literature how exactly the wavetable effects the number of

harmonics and their amplitudes during the transient phase. In this study, different waveforms: (1). a DC wave,

(2). a sine wave, (3). a sawtooth wave, (4). a linear frequency sweep, (5). a quadratic frequency sweep and (6).

a harmonic sinusoid (7). Uniform Random (8). Uniform Random Binary and (9). Gaussian Random are

considered as wavetables. The track lengths (i.e. the track duration till the time instant falls below a threshold)

of harmonics is investigated.

The second point is about the periodicity of wavetable filling the delay buffer. In general the buffer is

initially loaded with a single cycle of a wavetable (one of the above signals). If more than one period of

wavetable is used to fill the delay line buffer, what effect it has both on the spectrum evolution and subjective

quality of sound. These issues are investigated. The results of this study are useful for the synthesis and

classification of virtual instruments that use plucked strings. The results are also useful in melody extraction

from guitar music. First the guitar notes of 6 strings and 20 frets are simulated using KS algorithm considering

the tone fundamental frequencies of Table 1. The notes are synthesized, filling the delay buffer with different

types and periods of wavetables. STFT analysis is carried out on the simulated signals. The effect of wavetable

on the spectral evolution (can also be called as timbre) are investigated.

The paper is organized as follows. In section II the basic Karplus-Strong model of a vibrating string

and the equivalent single delay line model is presented. In section III the techniques of STFT analysis, the

spectrogram and are spectral peak tracking are discussed. Section IV describes the details of simulations and the

result analysis. Conclusions of the study and scope of future work are discussed in section V.

II. Karplus-Strong Algorithm The Karplus-Strong algorithm [3,4] simulates the physical process of a pucked string in steps as explained

below:

1. A buffer is initialized with a set of discrete random samples to represent the initial energy the string gets by

the plucking.

2. A sample is read out from the buffer sequentially, filtered and stored in the same location from which it was

read. In original KS algorithm, a filter that averages the current and previous value was used.

3. The process is repeated until the last sample of the buffer is consumed. At this point the buffer is filled with

a new set of random values. If the gain of the filter is less than unity, the maximum amplitude of this new

set would be less than that of the previous set. If the filter is low pass, the amplitudes of higher harmonics

of new set are reduced compared to those of the previous buffer content.

4. The new contents of the buffer are again modified using the same filter used in steps 2 and 3. The process is

continued for the required note duration. Thus if the note is long in time, the decayed waveform can be fully

visualized, else a truncated waveform results.

Page 3: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 3 | Page

The block diagram of the Karplus-Strong synthesis technique is shown in Fig 1.

Figure 1. Basic Karplus-Strong plucked string model

Initially the switch is in position 1 and the delay line buffer is loaded with the low pass filtered

wideband signal e.g. white noise. The low pass filter essentially band limits the noise. Then the switch is

changed to position 2 and the processing of buffer contents starts. The modifier in the feedback loop applies a

signal processing operation on the buffer contents, thus continuously modifying the contents based on the type

of modifier operation. The signal flow diagram of KS model [3,4,8,9,10] is shown in Fig 2. The loop filter

𝐻(𝑧) acts as the modifier which is basically a low pass filter and the L-sample delay block represents the delay

buffer of size L samples. The input signal 𝑥(𝑛) is basically a sample from delay buffer. With a sampling

frequency of 𝐹𝑠, the frequency of the steady state tone is 𝐹𝑠 𝐿 which is also the fundamental frequency of the

set of harmonics that evolve during the transition phase. It may be noted down that the harmonics evolve due to

the comb filtering inherent in the feedback operation around the L-sample delay buffer.

Figure 2. Signal flowgraph of Karplus-Strong algorithm

The original KS string model used a 2-point moving average for loop filter operation. Thus the difference

equation for the combined L-sample delay and the loop filter becomes

𝑦 𝑛 = 𝑥 𝑛 +𝑦 𝑛 − 𝐿 + 𝑦 𝑛 − 𝐿 − 1

2 (1)

In the extended algorithm [4], a three point moving average filter was proposed. The difference equation for

combined L-sample delay and three point average filter is given by

𝑦 𝑛 = 𝑥 𝑛 +𝑦 𝑛 − 𝐿 + 2𝑦 𝑛 − 𝐿 − 1 + 𝑦 𝑛 − 𝐿 − 2

4 2

In this study both filters are used. The magnitude responses of the two loop filters in combination with

the L-sample delay are shown in Fig 3 for the delay buffer lengths L=150 and L=71. For a sampling frequency

of 44100Hz, the fundamental frequency (Fs/L ) of note generated by KS algorithm is 294Hz (Fig 1a) and

612.13Hz (Fig 1b) respectively. Again for each note, responses of both 2-point and 3-point average filters are

plotted in Blue and Red colors respectively. In each case the decay of combs for 3-point filter is faster (red). It

may noted down that the frequencies correspond to the Notes G (8-th fret) and Note Ė (12-th fret) respectively.

From table, we get the actual frequencies 𝐹1 as 293.66Hz and 622.25Hz respectively. The delay line length L

required to generate these tones is 𝐹𝑠 𝐹1 i.e. 150.1737 and 70.8718 samples respectively. After rounding we

get L as 150 and 71 respectively. Then the frequencies (𝐹𝑠 𝐿) that are generated for these values of L

respectively are 294Hz and 621.13Hz as given in Fig 3. In next section we discuss the details of the simulations

and the result analysis.

x(n) y(n)

Z–L H(z)

Page 4: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 4 | Page

Figure 3. Magnitude Response of the combination of L-sample delay and Loop Filter (a). for Note G and 8-th

fret, 293.66 Hz (b). for Note Ė and 12-th fret, 622.25Hz.

III. Short Term Spectral Analysis As the spectral content of KS synthesized sound continuously changes, a short term analysis of the

spectrum [11,12] using the short time fourier transform (STFT) is considered. First the input signal y(n) is

divided into overlapping frames each of size N, with 50% overlap. Each frame is multiplied by a window

function w(k) such as a hamming window of same size N and analyzed by using the Fast Fourier Transform. A

matrix S is formed by arranging STFT coefficients as columns. This matrix is popularly known as a

spectrogram and is given by

𝑆 𝑘, 𝑙 =1

𝑀𝑊𝑛𝑁 𝑦 𝑛 + 𝑙𝑀 𝑤 𝑛 𝑒−𝑗2𝜋𝑛𝑘

𝑁

𝑁−1

𝑛=0

2

0 ≤ 𝑘 ≤ 𝐾 − 1, 0 ≤ 𝑙 ≤ 𝐿 − 1 (3)

where k is the frequency index, l is the time frame index, M is the hop size, K is the total number of

frequency bins of ones-sided STFT, L is the total number of frames contained in the signal and 𝑊𝑛 is the

window energy, used to normalize the window function 𝑤 𝑛

Spectral Peak Detection And Tracking

A peak detection algorithm [13] is applied on each column of the spectrogram matrix S. A quadratic

interpolation algorithm [14] is used for the accurate estimation of peak location.All the peaks in spectrogram

whose amplitude is greater than a threshold (globalTH) are considered significant. The peaks in successive

columns are generally correlated and hence, connectivity of these peaks is established using the constraints:

1. The shift of a peak from i-th column to (i+1)-st cannot be more than Δ Hz.

2. The amplitude change of a peak from i-th column to (i+1)-st cannot be more than Astep dB.

If any of the previously found peaks does satisfy the above constraints, the track is terminated in the current

frame. If a new peak that is not in the previously found list appears in the current frame, a new track is initiated.

Thus the trajectories of the spectral peaks are constructed and are later used for overlaying the tracks as line

plots on the spectrogram display

IV. Simulations And Result Analysis The Karplus-Strong algorithm shown in Figs 1 and 2 was implemented loading one or more cycles of

different wavetables, one at a time. The simulations are carried out in MATLAB environment using customized

programs except for the built-in functions: filter(b, a ,x) and FFT(x, nfft).

The wavetables used are (1). Sinusoid (F1) (2). Constant (DC) (3). Uniform Random U(-1,1) (4).

Gaussian Random N(0,1) (5). Uniform Random Binary: U(-1 or 1) (6). Linear Chirp: (100Hz - 22050Hz) (7).

Quadratic Chirp: (100Hz-22050Hz) (8). Sawtooth (F1) and (9).Harmonic Sinusoid (F1). All these waveforms

are self-explanatory and of unit amplitude except for Gaussian noise, which has zero mean and unity variance.

0 0.5 1 1.5 2

x 104

-50

0

50

100

Frequency (Hz)

(a)

Mag

nit

ud

e (d

B)

F1=294 Hz; WaveTableSize=150; CyclesInWaveTable=1

2-Point MA Filter

3-Point MA Filter

0 0.5 1 1.5 2

x 104

-50

0

50

Frequency (Hz)

(b)

Mag

nit

ud

e (d

B)

F1=621.13 Hz; WaveTableSize=71; CyclesInWaveTable=1

2-Point MA Filter

3-Point MA Filter

Page 5: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 5 | Page

In this case, most of the values are within 𝜇 ± 3𝜎 range i.e. [˗3, 3]. Hence, the Gaussian noise is normalized

with respect to maximum value to fall within the range [-1,1]. The Harmonic Sinusoid is another wideband

source which comprises the fundamental frequency F1 and all its harmonics between 0 and Fs/2 Hz. The guitar

notes are simulated using KS algorithm for all 6 strings: E,A,D,G,B and Ė, and for 20 frets for each string, thus

making a total of 120 cases (120 entries in Table 1). For each of this case (i.e. note frequency), 9 different

wavetables and for each wavetable again both 2-coefficient and 3- coefficient loop filters are used in synthesis.

Thus a total of 120 × 9 × 2 = 2160 signals are synthesized. In what follows the results of selective signals are

presented. It is observed that the harmonics decay faster for 3-coefficient filter comparing to 2-coefficient filter.

It is expected as the frquency response falls of combs observed in the Fig 3. Results are shown for 3-coefficient

loop filter only. The generated tones are also played using Matlab's soundsc() function to see the perceptual

quality of the note sounds.

Single period of U(-1,1) Wavetable

Fig 4 shows synthesized signal and its spectrogram for Note Ė and 12-th fret. The note frequency F1

from Table 1 is 622.25Hz, which requires L of 70.8718 samples. which is taken as 71. Thus the actual frequency

generated would be 621.13 Hz. A wavetable U(-1,1) of uniformly distributed random numbers between -1 and

1 is used. The wavetable has a length 71 samples i.e. one period fitting into the total delay line buffer. There are

13 harmonics between the 0 and 8000Hz with varying amplitudes. The amplitudes of all harmonics are large

initially and decays as time progresses. The fundamental has the largest initial amplitude and continue to sustain

during the total duration of 2 seconds, though its amplitude decays. However, all other harmonics decay faster

than the amplitude of the fundamental. As the harmonic number increases the decay is also fast. This can be

seen in Fig 4b, as brighter green/red lines on the blue background of the spectrogram. Except the fundamental,

which survives the total duration, all other harmonics die eventually. (please see the green lines).

Single period of Sawtoooth Wavetable

Fig 5. shows synthesized signal and its spectrogram for Note G and 8-th fret using a sawtooth

wavetable. The note frequency F1 from Table 1 is 293.66Hz, which requires L of 150.1737 samples taken as

150 after rounding. Thus the actual frequency generated would be 294Hz. Here the fundamental also decays to

zero level after 1 second, whereas the higher harmonics decay much faster. It mat also be noted that the spacing

between successive green/red traces is half that observed in Fig 4, because the fundamental 294Hz is

approximately half of 621.13Hz of Fig 4b.

Figure 4. (a). KS generated Waveform of Note Ė and 12-th fret (b). Its Spectrogram.

Multiple periods of U(-1,1) Wavetable

In this section the results are presented for the case where the delay line buffer is loaded with the

multiple periods of a wavetable. Fig 6 shows the the spectrogram of the KS generated signal for Note Ė and

12-th fret i.e. for note frequency 622.25Hz. The actual frequency generated for the wavetable length of 71

samples would be would be 621.13 Hz as discussed earlier. In this case 2.4 periods of a shorter wavetable is

stuffed into the delay line buffer of length 71 samples. The length of the shorter wavetable is 71 2.4 ≈ 30

samples. The buffer now containes 2 full periods (60 samples) and another 11 samples from the third period.

Fig 7 shows the the spectrogram of the KS generated signal for Note Ė (12-th fret) but this time

filling full 3 periods of wavetable filling the delay buffer of 71 samples. Simlarly Fig 8 shows the the

spectrogram of the KS generated signal for Note G (8-th fret); 8 periods of wavetable filling the delay buffer.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

-0.5

0

0.5

1F1=622.25 Hz; WaveTableSize=71; CyclesInWaveTable=1; WaveTableType=Random U(-1,1)

Time(sec)

(a)

Am

pli

tud

eF

req

uen

cy(H

z)

Time(sec)

(b)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

2000

4000

6000

8000

Page 6: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 6 | Page

Figure 5. (a). KS generated Waveform of Note G and 8-th fret (b). Its Spectrogram for sawtooth wave.

In all three cases, it is observed that the higher harmonics attained larger amplitudes than the

fundamental during the transition duration. In steady state, however, only fundmental sustained but with lesser

amplitude compared to the case of single period of wavetable filling the buffer. Thus the sounds perceptually

resembled those of the higher notes, based on the fact that which harmonic has the maximum strength, which

again dependents upon the number of periods used in the wavetable. The synthesized note sound is subjectivelly

compared to the sound of the real guitar note in each case. Thus it appears that the conjecture of filling the

buffer with muliple copies of shorter wavetables [3,4] does not work, as it is changing the tone quality which is

not acceptable.

Spectral Evolution of KS synthesized Note 𝑬 for one cycle of a Wavetable

In this subsection, the results of the evolution of short term spectrum over time of a guitar note are

presented.. Fig 9 through Fig 13 show the gray scale spectrogram of the KS synthesized signal string 𝐄 8th fret

with fundamental frequency of 493.88 Hz. The spectral peak tracks are overlaid as thick lines above the

spectral peaks (black in color). The track length or duration is computed from 0 seconds to the time instant at

which the peak amplitude falls below a threshold, here 0.01% of the global maximum of the spectrogram i.e.

40dB below the global maximum. The frequency location and amplitudes of the spectral peaks are obtained as

described in section III. Fig 9 displays the gray scale spectrogram of the synthesized Note 𝐄 (8-th fret) signal

for single period of a Sinusoid wavtable. The significant spectral peaks are tracked and the tracks are plotted as

thick continuous lines overlayed on the spectrogram in fig 9a. There are peaks at seven frequencies at 466Hz,

511Hz, 613Hz, 714Hz, 759Hz, 1225Hz and 1837Hz. These peaks extend for durations of 232ms, 1219ms,

1985ms, 1219ms, 232ms, 360ms and 104ms respectively. Out of these 466Hz, 511Hz, 714Hz, 759Hz tracks

are artefacts around the main peak 613Hz and automaically discarded using the properties of symmetry and

equal durations around the longer main track. Finally peaks at three frequencies 613Hz, 1225Hz and 1837Hz

are taken as the valid tracks. Similar stray tracks are observed for the wavetables: Uniform Random U(-1,1),

Quadratic Chirp, Sawtooth and Harmonic Sinusoids. The lengths (durations) of the valid tracks are plotted for

the Note 𝐄 (8-th fret) for one period of nine different wavetables in Fig 14. For all wavetables, the longest track

is acquired by the fundmental frequency only. The number of harmonics including the fundamental are the

lowest i.e. 3 for Sinusoid wavetable. The 7th harmonic i.e. 4287Hz if exists has maximum length of 58ms for

Uniform Random Binary wavetable and is the smallest i.e. 4ms for Gaussian Random wavatable. Thus it is

observed that the number of significant the harmonics are strongly dependent on (i). the wavetable and (ii). the

number of cycles of wavetable filling the delay buffer..

V. Conclusions And Future Work In this study different waveforms starting from a simple DC signal to complex signals like a quadratic

frequency sweep and a harmonic sinusoid are considered as wavetables for synthesizing guitar notes using

Karplus-Strong (KS) algorithm. The lengths (durations) of fundamental and its harmonics are computed from

the spectrogram. It has been investigated how the type and periodicity of wavetable effects the spectrum

evolution over time i.e. track durations. The subjective quality of the note sound produced is assessed compared

to the sound of the real guitar note sound.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8-1

-0.5

0

0.5

F1=293.66 Hz; WaveTableSize=150; CyclesInWaveTable=1; WaveTableType=Sawtooth(F0=288.24Hz); Amp=1

Time(sec)

(a)

Am

pli

tud

eF

req

uen

cy

(Hz)

Time(sec)

(b)

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

2000

4000

6000

8000

Page 7: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 7 | Page

Figure 6. The spectrogram of the KS generated signal for Note Ė and 12-th fret; (2.4 periods of wavtable).

Figure 7. The spectrogram of the KS generated signal for Note Ė and 12-th fret (3 periods of wavetable 3)

Figure 8. The spectrogram of the KS generated signal for Note G and 8-th fret; (1.8 periods of wavtable)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

-0.5

0

0.5

1F1=622.25 Hz; WaveTableSize=71; CyclesInWaveTable=2.4; WaveTableType=Random U(-1,1)

Time(sec)

(a)

Am

pli

tud

eF

req

uen

cy(H

z)

Time(sec)

(b)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

2000

4000

6000

8000

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9-1

-0.5

0

0.5

F1=622.25 Hz; WaveTableSize=71; CyclesInWaveTable=3; WaveTableType=Random U(-1,1)

Time(sec)

(a)

Am

pli

tud

eF

req

uen

cy(H

z)

Time(sec)

(b)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

2000

4000

6000

8000

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

-0.5

0

0.5

1F1=293.66 Hz; WaveTableSize=150; CyclesInWaveTable=1.8; WaveTableType=Random U(-1,1)

Time(sec)

(a)

Am

pli

tud

eF

req

uen

cy(H

z)

Time(sec)

(b)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

2000

4000

6000

8000

Page 8: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 8 | Page

Figure 9. The spectrogram of the KS generated signal for Note 𝐄 and 8-th fret; 1.0 period of (a). wavetable-

Sinusoid (b). wavetable-DC

Figure 10. The spectrogram of the KS generated signal for Note 𝐄 and 8-th fret; 1.0 period of (a). wavetable-

Uniform Random (b). wavetable- Gaussian Random

The number of significant the harmonics is strongly dependent on type and periods of the wavetable

used to initialize the buffer. In case, multiple cycles of a waveform are used as wavetable, some of the higher

harmonics attained larger amplitudes than the fundamental, and hence their track durations are higher than that

of the fundamental. In this case, perceptually the generated note resembled relatively a higher note. Again

which harmonic gerts higher amplitude is dependent on the number of periods in the wavetable. Thus the

conjecture of filling the buffer with muliple copies of shorter wavetables for synthesizing a note using KS

algorithm does not work.

Work is in progress to quantify the decay rates of harmonics for different wavetable signals and for the

buffer containing multiple periods of a given wavetable. The results of this study are useful for the synthesis and

classification of virtual string instruments. Use of shorter wavetables emulating the longer buffers may reduce

the size of physical memory, if a means of controlling the amplitudes of higher harmonics is devised.

Time(sec)

(a)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Sinusoid

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Time(sec)

(b)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: DC

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Time(sec)

(a)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Uniform Random U(-1,1)

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Time(sec)

(b)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Gaussian Random N(0,1)

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Page 9: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 9 | Page

Figure 11. The spectrogram of the KS generated signal for Note 𝐄 and 8-th fret; 1.0 period of (a).

wavetable- Uniform Random Binary (b). wavetable- Linear Chirp: (100Hz - 22050Hz)

Figure 12. The spectrogram of the KS generated signal for Note 𝐄 and 8-th fret; 1.0 period of(a). wavetable-

Quadratic Chirp: (100Hz-22050Hz) (b). wavetable- Sawtooth (F1)

Figure 13. The spectrogram of the KS generated signal for Note 𝐄 and 8-th fret; 1.0 period of Harmonic

Sinusoid (F1)

Time(sec)

(a)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Uniform Random Binary:U(-1 or 1)

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Time(sec)

(b)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Linear Chirp:(100Hz-22050Hz)

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Time(sec)

(a)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Quadratic Chirp:(100Hz-22050Hz)

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Time(sec)

(b)

Fre

qu

ency

(Hz)

F1=493.88 Hz; String=e; Fret=8; WT: Sawtooth

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

1000

2000

3000

4000

5000

Page 10: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 10 | Page

Figure 13. The Track lengths for the KS generated signal for Note 𝐄 and 8-th fret; 1.0 period of different

wavetables

Table 2. Estimated Frequencies and their Track Durations for KS simulated Notes

for F1=493.88 Hz; String=e; Fret=8.

References [1]. R.A. Waldron Waves & Oscillations D. Van Nostrand Co. Inc. 1964

[2]. Neville H. Fletcher, Thomas Rossing, "The Physics of Musical Instruments", Second Edition, Springer, 1998

[3]. Kelvin Karplus and Alex Strong, "Digital Synthesis of Plucked-String and Drum Timbres," Computer Music Journal, vol. 7, No. 2, pp. 43-55, Summer 1983.

[4]. D. A. Jaffe, and J. O. Smith, "Extensions of the Karplus-Strong Plucked-String Algorithm," Computer Music Journal, vol. 7, No. 2,

1983, pp. 56-69. [5]. Smith, Julius O. , Physical Audio Signal Processing, W3K Publishing, http://books.w3k.org/, ISBN 978-0-9745607-2-4.

[6]. Karjalainen, M., V. Välimäki, and T. Tolonen. ”Plucked-String Models: From the Karplus–Strong Algorithmm to Digital

Waveguides and Beyond.” Computer Music Journal, Vol.22, No.3, 1998, pp.17–32. [7]. Vesa Valimaki, Jyri Huopaniemi, and matti Karjalainen, "Physical Modeling of Plucked String Instruments with Application to

Real-Time Sound Synthesis', Jounal of AES, 44(5), May 2014, pp.331-353

[8]. Mikael Laurson, et al., "Methods for Modeling Realistic Playing in Acoustic Guitar Synthesis", Computer Music Journal, Vol.25, No.2, pp. 38–49, 2001.

[9]. Laroche, J. and Jot, J.-M. (1992). Analysis/synthesis of quasi-harmonic sounds by use of the Karplus-Strong algorithm, Proc. 2nd

French Congr. on Acoust., France. Le Brun, M. (1979). Digital waveshaping synthesis, J. Audio Eng. Soc. 27(4): 250–266. [10]. Legge, K. A. and Fletcher, N. H. (1984). Nonlinear generation of missing modes on a vibrating string, J. Acoust. Soc. Am. 76(1):

5–12.

[11]. David B. Pisoni and Robert E. Remez (editors), "The Handbook of Speech Perception", Part-I chapter 1, Blackbell Publishing, 2006.

[12]. Thomas F. Quatieri, "Discrete-Time Speech Signal Processing: Principles and Practice", Chapter 3, Prentice Hall, 2001

500 1000 1500 2000 2500 3000 3500 4000 45000

200

400

600

800

1000

1200

1400

1600

1800

2000

Frequency(Hz)

Tra

ck

Len

gth

(m

s)

Sinusoid

DC

Uniform Random U(-1,1)

Gaussian Random N(0,1)

Uniform Random Binary:U(-1 or 1)

Linear Chirp:(100Hz-22050Hz)

Quadratic Chirp:(100Hz-22050Hz)

Sawtooth

Harmonic Sinusoid

Page 11: Effect of Wavetable on The Spectral Evolution of Karplus ... · time evolution of the spectrum of KS generated guitar notes. ... The fretboard or fingerboard frequencies of a 20 fret

Effect of Wavetable on The Spectral Evolution of Karplus-Strong Synthesized Guitar Notes

DOI: 10.9790/4200-0606030111 www.iosrjournals.org 11 | Page

[13]. Venkata Krishna Rao M, “Machine Analysis And Synthesis Of Spoken Telugu Vowels”, Third International Conference On

Computational Intelligence and Information Technology, CIIT 18-19 Oct. 2013, published by IET, pp. 93-104. DOI:

10.1049/cp.2013.2577, INSPEC Acc.No: 14542316 @IEEEexplore.

[14]. D. T alkin (1995), „A robust algorithm for pitch tracking (RAPT)‟, in Speech Coding and Synthesis (WB.Kleijn and K.K.Paliwal, eds.), Elsevier Science, chapter 14, pp. 495–518.