Quick sound synthesis without physical modeling in PD

From CCRMA Wiki
Revision as of 17:19, 24 March 2009 by Cweil (Talk | contribs)

Jump to: navigation, search

This is a quick tutorial on how to make some pleasant but complex sounding tones for use with either impulses or audio rate signals. Impulses are obviously the most simple of the options, and are still great to use for testing the patch, however if you simply want to use a tone as a signal to signify something in a patch or program, the impulse works well. This method works particularly well for unconventional setups, like using a sensor for audio rate input. This works well with that have a high signal voltage with a quick drop off, like a piezo, or even with sensors that have a relatively constant voltage ouput, such as an IR or hall-effect sensor.

But why?

For most applications using sensor, the standard sonification method is to design some sort of physical modeling (be it string modeling, wind instrument modeling, etc) to create the sound, using the sensor output only to deal with the envelope of the signal or the attack velocity. In that method, the decay, feedback, depth of tonality, etc all to be neatly designed, programmed and routed, which in Pd is no small feat. Along with that, however, our sense of expectation of sound may lead to disappointment if the sound isn't doing what you'd hoped...even if it sounds good! It can be an extremely difficult and time intensive process, which sometimes is worth it, but sometimes, just isn't necessary if it isn't part of the design concept.

The goal for this patch is to create a complex, pleasing tone that has natural sounding attack and decay without having to deal with feedback, delay lines, or any other complex process.

Thus, for time when you are more concerned about the physical interaction of whatever you have designed, but still want it to sound delightful, this method is quick and dirty, and can sound as pleasant or as raunchy as you'd like.

Basic Concept

A simple and computationally-light way to produce a delightful tone with natural attack AND decay is to take your input signal (be it from an impulse, such as PD's click~ object, or from the sensor input) and filter it. Any wide-band filter works to come extent- PD's bpf~, vpf~ and moog~ all work out quite well. A combination of high and low pass filters would also work, but it is much more tricky to set the parameters to make it sound pleasing.

Although I in general am a fan of the PD's in-house attempt at modeling Moog's ladder filter, it has a few problems for this use. First, it's computationally much more expensive, so utilized the way we plan to here it can bog the system down. Secondly, we are trying to avoid physical models, and while the ladder filter model isn't a physical model, it's got some more background complexity that feels a bit unfair to use. So for this implementation we'll stick with the a good old band-pass filter, the bpf~.

The trick here is slightly non-intuitive- normally, when given a frequency-rich signal, you try to keep as much of it as possible to make the sound rich and fulfilling. As it turns out, though, using that method in PD make the sound too muddy, and you don't get a natural decay sound. So instead, we will make the most of the bpf~'s Q parameter, and set the resonance at the band-pass's center frequency extremely, extremely high. When you first hear the numbers, it sounds crazy, but the end result is a very strongly pitched bell-like tone. The higher the value of Q, the sharper the attack and the longer the decay, which gives the sound a delightful sense of realism.

For most applications, values for Q might range between 1 and 5, and in more extreme cases could be up to 20. However, on paper, a Q of 20 should produce an extraordinary resonance that is highly directional and uncomfortable. But in this application, the higher Q just helps to sharpen the pitched quality of the impulse or input, sort of like a cymbal. While there are other frequencies going on underneath it, you primarily hear the band-pass' center frequency.

Thus, when used in this application, the value of Q will be between 75 and 1600 (!). If a single band-pass filter were being used, a Q of 1200-1600 seems to work best.

A simplified version of the signal flow is shown below:

(To be replaced with picture) adc/impulse -> bpf~ with center frequency X and Q y -> dac

With a high Q, this will already sound quite pleasant. However, the best implementation is to use a bank of band-pass filters, all run in parallel, with different center frequencies, such that when recombined the sound is much more harmonically dense.

Example:

(To be replaced with pictures) adc/impulse -> bpf~, X1, Y1 -> dac;

           -> bpf~, X2, Y1 -> dac;
           -> bpf~, X3, Y1 -> dac;

etc.

Generally speaking, a complex tone sounds best with 4-10 filters in parallel. It is not computationally expensive and thus shouldn't cause any problems when using audio rate signals.

The next step

Say you've found that this method work well for you, but you want to really refine the sound for a finished product. There are a number of steps you can take.

Vary the output gain for each band-pass. If you want it to emulate a signal with many overtones, varying the output gain in some fashion is a quick way. Pick a fundamental (or whichever frequency you would like to emphasis), and leave it alone. Then for all the other filters, use the *~ object to turn down the rest of the filters so that they are used more to color the unity-gain tone than to stand alongside it. You can make it as complex or as simple as you'd like, but quite often simple works well.

If you had four filters, for example, each one could be successively 25% less than the unity gain filter- 0.75, 0.50, 0.25, etc.

Vary the Q's for each band-pass. Another simple method for tuning the sound is to change the Q's of each bandpass. It can be as simple or as complex as you'd like, just like the gain. Also similiar to gain is that the filter with the highest Q will become the dominate tone (assuming unity gains; it is not clear where the trade-off between gain and Q is in this application).

I like to use about 8-10 filters per sound for a really rich tone, and I tend to use Q's between about 1600 for the fundamental down to about 75 for the last filter. The Q's might decay like 1600, 1400, 1200, 1000...250, 150, 75, for example. But you may tune them how you like. The filters with the higher Q will also take longer to decay, further reinforcing the particular frequency you want to be the strongest.

Producing subtly richer noises The standard method to chosing center-frequencies of the


Producing bell-like noises If you are sick of using the standard method for harmonic overtones (2/3/4/5/6x fundamental or 3/5/7x, etc.), another nice way to