0

I'd like to make a filter which essentially masks the spectrum except for frequencies around music notes in the standard tempered scale, i.e. $frequency \in 110 \times 2^\frac{i}{12}, 10 \le i \le 64$, in the case of a violin. The passband around each note should be narrow, perhaps 1% of the space between notes. The idea is that the sound of a violin will be loudest when the played note is in tune, and quieter when not quite hitting the correct note.

What would be the best way to do this? I was thinking perhaps a series connection of 10 comb filters, with the final output subtracted from the input signal. The filter for the $2^\frac{7}{12}\approx1.5$ will be covered by the comb filter $F_c\times 3, F_c\times 6, etc.$, albeit a little out of tune.

Another way would be 55 notch/peaking filters. Would these be best in series or parallel?

Is there a better way?

The solution will be done using 16 or 32 bit fixed-point on a microcontroller, depending on what sounds good enough. I'll try for $F_s$=44kHz, 16bit audio in/out.

Thanks, James

  • 1% of the inter-note space is really narrow. Now, a sequence of 10 simple feedforward comb filters is simply a 10-nonzero-tap-FIR filter. If you go for general FIRs, these filters will be humongous, not 10 taps! Also, comb filters are periodic in frequency domain, wheres your frequencies aren't equidistant, so I don't think this would work out. So, filterbank? But computationally, 55 of these very steep filters will be too much of a challenge for a microcontroller... – Marcus Müller May 24 '18 at 08:37
  • since most musical notes have harmonics, you will want your notch or peak filter to be a comb filter. – robert bristow-johnson May 24 '18 at 09:25
  • @MarcusMüller Thanks for the reply. I know 1% is really narrow. As long as there is an audible peak at the note frequency, then it's good. I guess I didn't think very well about the comb filter being locked to fractions of the sample frequency.. oops. So I'll have a go with 55 parallel notch filters subtracting from the input signal, I guess. On a 72MHz Arm M3, that's >61 instructions per filter (4 adds, 5 multiplies, 2 shifts), if I drop down to Fs=22kHz. – James Brown May 25 '18 at 10:14
  • @robertbristow-johnson I'll see if I can get away with just picking the fundamental; it doesn't have to sound great, just tell when a note is in tune. – James Brown May 25 '18 at 10:15
  • @JamesBrown I'd recommend what rbj pointed out: make it a filterbank, but make it a bank of comb filters! That way, you incorporate the harmonics. Other than that, still sounds like you'd rather detect the frequency and react to that than going the filter route. – Marcus Müller May 25 '18 at 10:48
  • @MarcusMüller but there's no rolloff with a comb filter, and that will mean wrong notes that coincide with another's harmonic will be amplified as if they were correct. Is detecting a frequency before applying a specific filter going to work well? Will it cause jumping between filters, or applying the wrong filters, if these harmonics are strong, or the note is sufficiently out of tune? Unfortunately, the last DSP exposure I had was during a course 15 years ago :( – James Brown May 26 '18 at 06:00
  • Hm, that's true; you could remedy that by convolving your comb filter with kind of a relaxed band pass, but you'd lose the computationally advantageous structure of the comb :( – Marcus Müller May 26 '18 at 06:11

0 Answers0