Digital waveguide sythesis
Posted: Thu Mar 06, 2014 9:51 pm
Here is a project I've been working on several months now and I might need a little help with it.
What is Digital waveguide synthesis?
It is a synthesis technique that digitally simulates wave propagation through instrument (in this case string). Sound in string is created by creating an excitation sound (by a pick, finger, bow, hammer,...) that propagates both directions through the string, bounces at string terminations and therefore travels back and forth (cycles around the string). as it travels and bounces it is damped and dispersed each time it passes the cycle. These damping and dispersion effects can be simulated by a filter with desired amplitude (to simulate the damping) and phase (to simulate dispersion) response.
Waves traveling both directions are identical and their interference is the actual vibration of the string we observe. This interference can be simulated by comb filters, however, because the string is linear system (basically also a feedback comb filter) it can be directly imprinted to the excitation. Also the impulse response of all reflection, dispersion and filtering is imprinted on it (the resonance of the body of instrument, reverb of room, response of microphone etc.).
How do I obtain the filter response and the excitation impulse?
This is the tricky part, that my schematic tries to do. First you enter the wave to analyze - recording of a string that is plucked - and a pitch of the sound. The analyzer compares the wave and a copy of the wave delayed by a period. By the least squares method that I posted earlier it estimates the filter. The string model is finished at this point. The excitation pulse can be recreated by sending the original wave trough inverse string model (feedforward instead of feedback topology).
What are the limitations?
Real world string vibrates in 3 dimensions (vertical, horizontal and lateral). These 3 separate waves are damped differently (for example because bridge is more rigid to horizontal movement than vertical). That means they decay differently too. To make it even more complicated, every one of these vibrations "bleeds" to the other dimensions too... that makes total of 6 filters in the schematic to analyze. Result is for example that string has fast decay at the start (vertical waves get damped quickly) and a long sustain afterwards (horizontal waves are damped less) Also the wave propagation is not perfectly linear (the vibrations get distorted) so even more black magic is happening...
My waveguide modeler
EDIT: 20.3.2014
My model uses simplified version of 2 dimensional string vibration. First model is fed with the excitation impulse and decays faster, at the same time it bleeds to second model which decays slower.
To use this string modeler, first load a wave file, which have to be a recording of a plucked string. I recommend using metal pick (for example coin) to capture the model, because it is richer in high frequencies - so the modeler has more info to work with. Now enter the exact pitch of the recording. Next elect filter order for both first and second model. Enter start times (in samples) and analysis lengths for both models. the first model corresponds to the start (attack) of the wave, so it should start from 0 by default. Second model corresponds to the late (decay) part of the wave - should be set around half second or second. Default analysis lengths (in the schematic named end point - sorry for the confusedness) are around 10000. Now click Analyze waveguide (click twice - first analysis attempt fails due to trigger errors in my schematic - I'll fix that one day...). On the screen you should see the excitation impulse wave (green) and amplitude (damping) and phase (dispersion) response of one of the models. You can switch between the model responses on the right.
Now your Model is fully ready and you can compare it with original wave by switching (upper right corner) between original and model and clicking replay.
EDIT: 22.3.2014
I've added save feature to both - excitator impulse which is basically a wav file. And also for the model - which is also stored as a wav file, however it is not actually a wave. First sample is an order of the filter, followed by the coefficients followed by order of second filter and corresponding coefficients.
I also created a simple waveguide synthesizer, that can load these excitators and models. sounds quite fine actually...
What is Digital waveguide synthesis?
It is a synthesis technique that digitally simulates wave propagation through instrument (in this case string). Sound in string is created by creating an excitation sound (by a pick, finger, bow, hammer,...) that propagates both directions through the string, bounces at string terminations and therefore travels back and forth (cycles around the string). as it travels and bounces it is damped and dispersed each time it passes the cycle. These damping and dispersion effects can be simulated by a filter with desired amplitude (to simulate the damping) and phase (to simulate dispersion) response.
Waves traveling both directions are identical and their interference is the actual vibration of the string we observe. This interference can be simulated by comb filters, however, because the string is linear system (basically also a feedback comb filter) it can be directly imprinted to the excitation. Also the impulse response of all reflection, dispersion and filtering is imprinted on it (the resonance of the body of instrument, reverb of room, response of microphone etc.).
How do I obtain the filter response and the excitation impulse?
This is the tricky part, that my schematic tries to do. First you enter the wave to analyze - recording of a string that is plucked - and a pitch of the sound. The analyzer compares the wave and a copy of the wave delayed by a period. By the least squares method that I posted earlier it estimates the filter. The string model is finished at this point. The excitation pulse can be recreated by sending the original wave trough inverse string model (feedforward instead of feedback topology).
What are the limitations?
Real world string vibrates in 3 dimensions (vertical, horizontal and lateral). These 3 separate waves are damped differently (for example because bridge is more rigid to horizontal movement than vertical). That means they decay differently too. To make it even more complicated, every one of these vibrations "bleeds" to the other dimensions too... that makes total of 6 filters in the schematic to analyze. Result is for example that string has fast decay at the start (vertical waves get damped quickly) and a long sustain afterwards (horizontal waves are damped less) Also the wave propagation is not perfectly linear (the vibrations get distorted) so even more black magic is happening...
My waveguide modeler
EDIT: 20.3.2014
My model uses simplified version of 2 dimensional string vibration. First model is fed with the excitation impulse and decays faster, at the same time it bleeds to second model which decays slower.
To use this string modeler, first load a wave file, which have to be a recording of a plucked string. I recommend using metal pick (for example coin) to capture the model, because it is richer in high frequencies - so the modeler has more info to work with. Now enter the exact pitch of the recording. Next elect filter order for both first and second model. Enter start times (in samples) and analysis lengths for both models. the first model corresponds to the start (attack) of the wave, so it should start from 0 by default. Second model corresponds to the late (decay) part of the wave - should be set around half second or second. Default analysis lengths (in the schematic named end point - sorry for the confusedness) are around 10000. Now click Analyze waveguide (click twice - first analysis attempt fails due to trigger errors in my schematic - I'll fix that one day...). On the screen you should see the excitation impulse wave (green) and amplitude (damping) and phase (dispersion) response of one of the models. You can switch between the model responses on the right.
Now your Model is fully ready and you can compare it with original wave by switching (upper right corner) between original and model and clicking replay.
EDIT: 22.3.2014
I've added save feature to both - excitator impulse which is basically a wav file. And also for the model - which is also stored as a wav file, however it is not actually a wave. First sample is an order of the filter, followed by the coefficients followed by order of second filter and corresponding coefficients.
I also created a simple waveguide synthesizer, that can load these excitators and models. sounds quite fine actually...