Calling all DSP experts
I’m trying to code a very simple comb filter using a Teensy board and the Audio Shield. I’m trying to copy something like the Resonator in Ableton. I’m having problems achieving the sort of sound I was expecting. I’m using the delay object included in the audio library, but setting the delay time so that it is tuned to resonate at a certain pitch, using this simple calculation.
float calculate_delay_time_ms( float resonant_frequency )
{
return 1000.0f / resonant_frequency;
}
The code is setup to have both a feed forward, and a feed back comb filter. Only the feed forward one is currently enabled. I’m not sure whether Ableton’s Resonator is feedback or feed forward, or a hybrid of the two (it also has many stages that can be individually tuned rather than one)? In testing with my guitar, I found the effect often resonated a semi-tone or even a tone above where I had intentionally tuned it, depending on where I had tuned it.
I thought this might be due to my guitar intonation, so I added some simple test tone code. What I would expect to see, is that when the test tone matches the frequency that the comb filter is tuned to, the amplitude would essentially double. But, testing on my (toy) oscilloscope, depending on what note it’s tuned to, the highest amplitude is indeed, often seen one tone up? I am seeing some amplitude increase at the expected frequency, but not as much as at 1 tone up. I suspect this is down to some error in my understanding of comb filters, but if someone more knowledgeable could point it out I’d be very appreciative!
Full code is here for reference…