<< Chapter < Page Chapter >> Page >
The basic Karplus-Strong plucked string algorithm must be modified with a continuously adjustable loop delay to produce an arbitrary pitch with high accuracy. An all-pass filter provides a continuously-adjustable fractional delay, and is an ideal device to insert into the closed loop. The delay characteristics of both the lowpass and all-pass filters are explored, and the modified digital filter coefficients are derived. The filter is then implemented as a LabVIEW "virtual musical instrument" (VMI) to be played from a MIDI file using "MIDI JamSession."
This module refers to LabVIEW, a software development environment that features a graphical programming language. Please see the LabVIEW QuickStart Guide module for tutorials and documentation that will help you:
•Apply LabVIEW to Audio Signal Processing
•Get started with LabVIEW
•Obtain a fully-functional evaluation edition of LabVIEW

Introduction

In the project activity of the prerequisite module Karplus-Strong Plucked String Algorithm , you undoubtedly noticed thatthe pitch accuracy of the basic Karplus-Strong algorithm needs improvement. For example, listen to the short MIDI test sequence ksdemo.mid rendered to audio with the basic algorithm using a sampling frequency of 20 kHz: ksdemo_20kHz.wav . The individual notes sound reasonable, but when the notes are played simultaneously as a chord, the pitch inaccuracy becomes noticeable.The accuracy gets worse at lower sampling frequencies such as 10 kHz: ksdemo_10kHz.wav ; increasing the sampling frequency improves the accuracy, as at 44.1 kHz: ksdemo_44kHz.wav , however, a discerning ear can still detect some problems.

The pitch of the plucked string tone is determined by the loop time, which must be made continuously variable in order to precisely control the pitch. In the basic algorithm, the length of the delay linedetermines the loop time, and the delay line can only be varied in integer amounts. The all-pass filter will be introduced and studied in this module as a means to introduce an adjustable fractional delay into the loop.

As a preview of the results that you can achieve, consider the same MIDI test sequence rendered to audio using the techniques introduced in this section: ks2demo_10kHz.wav and ks2demo_20kHz.wav .

Lowpass filter delay

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 MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8srps0lbbf9q8WrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfea0=yr0RYxir=Jbba9q8aq0=yq=He9q8qqQ8frFve9Fve9Ff0dmeaabaqaciGacaGaaeqabaWaaeaaeaaakeaacaWGMbWaaSbaaSqaaiaaicdaaeqaaaaa@3718@ :

f 0 = f S N MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOzamaaBaaaleaacaaIWaaabeaakiabg2da9maalaaabaGaamOzamaaBaaaleaacaWGtbaabeaaaOqaaiaad6eaaaaaaa@3AF8@

where 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 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

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Musical signal processing with labview -- subtractive synthesis. OpenStax CNX. Nov 07, 2007 Download for free at http://cnx.org/content/col10484/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Musical signal processing with labview -- subtractive synthesis' conversation and receive update notifications?

Ask