Description of Programs Using Different Techniques of Physcical Modeling of Music Instruments
Karplus-Strong Algorithm
The idea is almost the same as in the wavetable sound synthesis. That is playing sample of sound or waveform from a memory. Karplus-Strong algorithm in addition dynamicaly changes the content of the memory while it plays back. This is the main idea: the wavetable (memory) is filled with random values which are played back as a waveform (like a sine form in analog synthesizer). But every time the sound is read from memory the low-pass filter is applied. The content of the memory is changed. In the next cycle there are is the changed waveform played back. It goes on again.
For example sound of 200Hz has 200 hundred cycle changes in a second. That means that the waveform will be read 200 hundred times a second and the wave table will be overwritten the same number of times.
We can use any sound sample inicializing the wave table. The random values will make little differences even when the same pitch is generated. That makes the same effect as if playing real instrument - every sound even of the same pitch is original.
The whole result of this algorithm is a string like sounding instrument where the higher frequencies dies out fast while the bass frequencies continue to sound longer.
Waveguide Synthesis
In comparison to Karplus-Strong algorithm, waveguide synthesis is more sofisticated way how to model music instrument. The name suggests that we will concern the actual propagation of sound waves in instrument itself. This time we model two waves which are created on the string when its plucked. When a string is playing we see string oscilating up and down. In reality this effect is created by two waves which interfere with each other traveling accross the string. Those two waves are created when the string is plucked. Each of them is traveling opposite direction and changing their phases when its reflected on the fixed end of the string.
Waveguide Model of Sitar
This magic Indian instrument is characteristic for its strange buzzing sound. This effect is created when the vibrating string is softly touching ivory bone at one end. Moreover there is an effect of sympathetic strings resonating according to what is played. They are under the main seven string and they are not played with fingers. There is whole set of them, more than seven. The main seven strings are also very easy to bend thanks to the hollow neck and movable frets. This all features makes the real instrument sound so magic.
In the program I model string as in the waveguide synthesis. The difference is that this model has an obstacle added. Perry Cook uses the therm "waveguide model of a string with an obstacle". Thats the ivory bone at one end. This I solved with adding certain limit to a string displacement traveling around the delay lines. To be all understood well the important part is that the condition at the ends makes the reflecting displacement every time a little louder. The string runs in a feedback mode. When the limit is exceeded the value is set back to zero. It travels again along the delay lines and interferes with other values. It creates irregular ringing which finally with stronger feedback turns into regular buzzing.
As it is the case with all the instrument using waveguide synthesis its hard to "tune" them right. That means that it took lot of experimenting to set the right amount of feedback and to adjust the limit at the bridge just right. Thats why the experiment is nessecary. This technique is sometimes called selfoscilating synthesizer.
The model of the sitar could be much more complex. We could try to model bending of the strings or activating consonant strings when certain pitch is playing. Moreover it could all be done in real time. Than the player should have had appropriate interface and it would be almost the same hard to learn to play this virtual sitar as the real thing. In other point of view this virtual sitar could have had features which never existed in real. For example as much as consonat strings as desired, automatic string detuning while playing and so on. Thats the origin of the virtual music instruments inspired by real things. The reason why people get involved with this sound techniques is that the outcome is enough amazing to listen to. In addition the perception of real instruments is changed to our adventage. It must have been same amazing hearing this old instruments when they originated in the ancient times - real high-technology experience for the people then.
|
Programs are written in C++, compiled using Borland 3.1
sound samples are in MP3 format.
Karplus-Strong Algorithm
code:
karplus.cpp,
karplus.exe
sound examples:
spinet-bass.mp3
spinet-middle.mp3
spinet-treble.mp3
code description:
In the cyclical reading through wavetable filled with random values we make average of two neighbourhood values. The average value is written back into the wavetable replacing one of the used value. This is the realization of low-pass filter. It creates very realistic decaying sound of string instrument. It sounds somewhat like an ancient spinet.
The input are numbers specifying:
- lenght of the wavetable (this creates the pitch of the sound, longer wavetable means lower pitch)
- number of samples (one second file has 44100 samples)
We are additionaly asked how to fill the wavetable. One option is with random numbers, the other is with a sound file "sample.raw". It could be whatever sound. Only number of samples from the begining coresponding with lenght of the wavetable is loaded.
Than the random values are generated and fill the wavetable. Cycles are performed and sound saved.
The output is a file called spinet.wav and spinet.raw. Those files are MONO, 44kHz sample frequency, 16bits resolution.
|
Waveguide Synthesis
code:
waveguide.cpp,
waveguide.exe
sound examples:
one-pickup.mp3
two-pickups.mp3
bassfeedback.mp3
lfo.mp3
code description:
This model of string instrument is created using two delay lines. Delay line is represented by an array.
There are two delay lines each of them for one existing traveling wave. We fill the delay lines with generated primary impuls. This represents the initial string displacement. Than all the fun starts. We shift all the numbers which represents the string displacement around the delay lines.
The actual sound origins at the pick-up which is certain position on delays line where we are adding the traveling values and saving them into a sound file. The string displacements are made smaller every time they reflects on the string end. They change the phase - minus or plus sign. The amount of random numbers mixed in delay lines makes every sound original and there could be no prediction what aliquote frequencies will be created this time.
The input are numbers specifying:
- lenght of the delay lines (this creates the pitch of the sound, longer wavetable means lower pitch),
- number of samples (one second file has 44100 samples), the
- position of the pick-up on the delay line,
- amount of random numbers, and the
- shape of the initial impuls. Than the random values are generated and mixed with chosen type of impulse in the delay lines.
The last information to enter is the level of reflection created at the bridge. It could either influence how the sound decays or it could make a feedback effect. Cycles are performed and sound saved from the specified pick-up position.
The output is a file called spinet.wav and spinet.raw. Those files are MONO, 44kHz sample frequency, 16bits resolution.
|
Virtual Sitar
code:
sitar.cpp,
sitar.exe
sound examples:
sitar.mp3
bass-sitar.mp3
sitar-no-feedback.mp3
buzz-origin.mp3
lfo-sitar.mp3
code description:
This code is almost same as the basic waveguide model of the string. The difference is that the bridge condition is set into a feedback mode. If we are not careful enough the sound will reach the maximum values for digital sound of 16bit resolution. That is from -32768 to 32767, which are the values of signed word represented by two bytes. Such a sound file would be very hard to listen to. The next condition on the bridge is applied. Its the model of an obstacle. That means that everytime the string displacement exceeds certain level the displacement is set back to zero. With low feedback on the bridge this creates irregular ringing. With higher feedback the sound turns into a regular buzzing.
The input are numbers specifying:
- lenght of the delay lines (this creates the pitch of the sound, longer wavetable means lower pitch),
- number of samples (one second file has 44100 samples), the
- position of the pick-up on the delay line,
- amount of random numbers, and the
- shape of the initial impuls. Than the random values are generated and mixed with chosen type of impulse in the delay lines.
The last information to enter is the amount of feedback. Thats how fast the buzzing will occur. Cycles are performed and sound saved from the specified pick-up position.
The output is a file called sitar.wav and sitar.raw. Those files are MONO, 44kHz sample frequency, 16bits resolution.
|
Other projects:
- Australian Aboriginal Music Instrument Didjeridoo.
Designing and building original wooden instruments.
- Electronic Music Project: Evil Koala
Realtime didjeridoo recordings with original electronic music.
(both the same web site)
Contacts:
email: tajemnyoblud@hotmail.com
phone: +420-743825763
address: Ceske Budejovice, Kostelni 28, 37004, The Czech Republic
|