0
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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... $\endgroup$ – Marcus Müller May 24 '18 at 8:37
  • $\begingroup$ since most musical notes have harmonics, you will want your notch or peak filter to be a comb filter. $\endgroup$ – robert bristow-johnson May 24 '18 at 9:25
  • $\begingroup$ @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. $\endgroup$ – James Brown May 25 '18 at 10:14
  • $\begingroup$ @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. $\endgroup$ – James Brown May 25 '18 at 10:15
  • $\begingroup$ @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. $\endgroup$ – Marcus Müller May 25 '18 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.