2
votes

I'm implementing a 'filter sweep' effect (I don't know if it's called like that). What I do is basically create a low-pass filter and make it 'move' along a certain frequency range.

To calculate the filter cut-off frequency at a given moment I use a user-provided linear function, which yields values between 0 and 1.

My first attempt was to directly map the values returned by the linear function to the range of frequencies, as in cf = freqRange * lf(x). Although it worked ok it looked as if the sweep ran much faster when moving through low frequencies and then slowed down during its way to the high frequency zone. I'm not sure why is this but I guess it's something to do with human hearing perceiving changes in frequency in a non-linear manner.

My next attempt was to move the filter's cut-off frequency in a logarithmic way. It works much better now but I still feel that the filter doesn't move at a constant perceived speed through the range of frequencies.

How should I divide the frequency space to obtain a constant perceived sweep speed?

Thanks in advance.

2
To get the sensory phenomenon you seek, I am guessing you want there to be a constant (steady) time interval between the corresponding notes in subsequent octaves. I.e., the interval between A2, A3, A4 all the same and also the same as the time delay between reaching B3 from B2, B4 from B3, etc. Although the sequence is A2B2C2D2E2F2G2A3..., it could be overly complicated, but if you get either the A's or the C's right, I think it will sound like a western scale progression. - Heath Hunnicutt

2 Answers

2
votes

The frequency sweep effect you're referring to is likely a wah-wah filter, named for the ubiquitous wah-wah pedal.

We hear frequency in terms of octaves, and sweeping through octaves with a logarithmic scale is the way to linearize it. Not to sound dismissive, but it sounds like what you're doing is physically and mathematically correct. (You should spent as much time between 200 and 400 Hz as you do between 2000 and 4000 Hz, etc.) You just don't like how it sounds. And that's quite okay on both counts -- audio is highly subjective.

To mix things up a bit, one option would be to try the Bark scale, which is based on psychoacoustics and the structure of the ear. As I understand it, this is designed to spend equal amounts of time in each of your ear's internal "bandpass filters".

You could always try a quadratic or cubic function between 0 and 1. Audio potentiometers often use a few piecewise quadratic or cubic sections to get their mapping.

1
votes

Winging it, but try this:

http://en.wikipedia.org/wiki/Physics_of_music#Scales "The following table shows the ratios between the frequencies of all the notes of the just major scale and the fixed frequency of the first note of the scale."

There is then a chart showing fractional values between 1 and 2, and if you tweak your timing to match, you may get what you wish. While the overall progression is still logarithmic, the stepping between each one should divide up into equal stepped 8ths (a bit jumpy).

Put another way, every half second adjust one note up. Each octave (I think) will cover twice the frequency range of the prior octave.

EDIT: Also, you'll find the frequencies here: http://en.wikipedia.org/wiki/Middle_C#Designation_by_octave (doesn't the programmer in you wish that C0 was exactly 16hz?)