views:

157

answers:

2

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.

+1  A: 

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?)

Autocracy
If I understood you well, I should apply linear progression within octaves, but logarithmic progression between them?
Trap
As a programmer I find it REALLY disturbing it being 16352 instead of 16384 :)
Trap
Well, while the overall progression is logarithmic between any given note across two octaves, the progression isn't exactly logarithmic across different notes within the same octave. Of course, perception for a true sweep may also vary from that...Let me see about pointing you a little differently: try matching your sweep to these different curves and see which one suits best. http://en.wikipedia.org/wiki/A-weighted
Autocracy
+1  A: 

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.

jbarlow
Before trying the Bark scale I started to play with cubic and quadratic functions as you suggested and I have to say that the results are very similar to those produced by Adobe Audition :)
Trap