berndporr / iirj

An efficient IIR filter library written in JAVA
Apache License 2.0
136 stars 36 forks source link

voice filter #9

Closed axet closed 6 years ago

axet commented 6 years ago

Hello!

I've tried to use your library to filter voice using bandPass(2, 16000, 1850, 1550) and it seems not working. Voice has a freqency from 300 up to 3000 and it should exclute music or with bandStop( same args ) exclude voice. But non of it seems working.

It is a bug, or voice filtering way more complicated?

BTW it is open-source android audio recrorder https://gitlab.com/axet/android-audio-recorder

berndporr commented 6 years ago

Music ranges from 20hz to 20kHz. Voice from 100hz to 10kHz so pretty much the same frequency range. What you want is a human brain in silicon which can detect voice amongst background noise and then remove the noise. That's called AI. So the filter has no bug. It's far more complicated and I'm not aware of a simple solution. If you find one then publish it on github. You'd be up for the noble prize.

axet commented 6 years ago

I'm talking about pure since here and pretty well known facts. No nobel here for me, yet. If you go to wikipedia, you will find out Voice has a very limited frequncy from 300 up to 3000 (or 200 to 3200) and most modern software (and hardware) using this trick to filter noice, music, and other unwanted stuff. For example journalists who taking interview in a loud places (they using same feq filters to remove music). Or skype which can filter your voice and boost it and lower the nocie of background.

https://en.wikipedia.org/wiki/Voice_frequency

I've tried to use lowpass filter and it works grate, but when I use bandpass it fails. Maybe something wrong here.

PS: yes, it looks like magic. but it works.

berndporr commented 6 years ago

Wikipedia is sadly wrong. The frequency range of human voice is as I've stated. Why don't you send a delta pulse through the bandpass and do a fft? If that shows up then I'd believe there is a bug. However, I tested it. -- I worked in radio, sound, etc all my life. Once speech is contaminated it's no longer salvageable with simple filters. You need smarter stuff. Skype is much smarter than a simple filter. Come back with the fft of an impulse response and if that looks odd I have look.