Reputation: 617
is there a way to filter audio in android system? I am interested to get only the audio of a fixed frequency.
Upvotes: 4
Views: 7721
Reputation: 11469
Please do NOT use the FFT for this. That's amateur hour. (The FFT is a great tool with many great use-cases, but this is not one of them.) You most likely want to solve this problem using time domain filters. Here's a post to get you started writing your own filters in the time domain as easy as can be. However, a lot of people stumble on that since it's a bit specialized, so if you want to use something built-in to android, start with the equalizer audio effect.
Upvotes: 2
Reputation: 7315
As Dave says, the AudioRecord class is the easiest way. Often times, I will extend an AsyncTask that implements AudioRecord to read the audio buffer and push the buffer back to the UI thread for visualization (if needed).
Regarding the filtering of the audio, Android does not provide any built-in way of doing this. The way you would filter out certain frequencies is by taking the Fourier Transform of the sampled audio and then pulling out the frequencies of interest.
If you want more details on filtering, you should probably post a new SO question or wiki the Fast Fourier Transform (FFT). You might also look into JTransforms which is a great open source FFT library that runs wonderfully on Android.
Upvotes: 2
Reputation: 5173
If you get your audio via the AudioRecord class, then you'll have raw audio data that you could filter using whatever audio filter algorithm you have. Or are you looking for an audio filtering library?
Upvotes: 2