Audio Sound Filtering

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,

I have some doubts about how to implement a solution for the app that I explain below:
  • I want to filter specific audio sounds (truck, trumpet...) with an arduino and a microphone (amplifier + microphone).
  • The main idea is taking samples for a short time (a few seconds), analyze the sound in frequency, and know if it is from an audio source or another.
  • I have characterized my target sounds in three frequencial components (Hz), with their amplitude (dB). And I only want to compare the sound measured with these components but I can't split them from audio samples I have taken.
I read about doing it with 'ffft' library, but for the moment I don't know how to implement it. Could someone tell me how to do it?

Is there another solution for this app?

Regards.

Post

It will need to be a little more involved than you think:

http://scikit-learn.org/dev/auto_exampl ... ation.html

(not that I've tried myself, but your idea is not likely to work well, it's not that simple, it will only work to filter out specific frequencies, i.e. a trumpet playing the note A for example.)
~stratum~

Post

Problem 1: discomposition of sound into it's fundamentals. I guess three bands is not enough for real-world usage. so FFFT seems up to the job. Google further!

Problem 2: use output of 1) for pattern recognition. There are some good books about the subject you can buy. Google further!
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

Hi,

thanks everyone!

I have tried FFT library for arduino.
Now my doubt is how can I read, save and compare the sound measured with a 'pre-defined' one?

I know there are several best options for doing this task, but I want to try doing it with Arduino. I'm not looking for doing a perfect system, only one which allow me to compare sounds and give a positive detection if sound is similar.

I know there are a lot of parameters to take in mind, but for this application I want to abstract the most I can from them.

Regards.

Post

yolco wrote:Now my doubt is how can I read, save and compare the sound measured with a 'pre-defined' one?
Unfortunately there is no free lunch. Hence: http://www.amazon.com/s/?field-keywords ... ecognition

As for read and save on the Arduino: http://arduino.cc/en/Reference/FileRead and http://arduino.cc/en/Reference/FileWrite
volco wrote: I know there are several best options for doing this task, but I want to try doing it with Arduino.
Best is a superlative. This means if an option is best no other option is better. So by definition there can only be one best option never several.
volco wrote: I know there are a lot of parameters to take in mind, but for this application I want to abstract the most I can from them.
That is sub-process of pattern recognition called feature extraction and feature selection. You should really read a book about it. It's not as simple as 89Hz = Bus, 102Hz = Sports car ... it's actually much more complicated.

The most simple "comparison" you could try is comparing the spectra of the sounds. You could normalize all FFT bins (norm_fft_bin = fft_bin / (sum over fft_bin[0...N])) then compare each fft bin of each sound and if they are within a specific threshold they match if not they don't.
If you don't know how you can do what I explained you should start doing your homework. That means first learn how to code the Arduino platform. Then learn how to do basic DSP. Then learn basic pattern recognition. Then tackle your problem.

Otherwise you might as well hire someone to solve your problem. However given the task is very complicated that will be very expensive.

Post

yolco wrote:Hi,
Now my doubt is how can I read, save and compare the sound measured with a 'pre-defined' one?
I guess I have misunderstood the problem. If that's what you want to do, instead of filtering out an unwanted sound from a certain source (the way I had understood), then that's probably what you want:

http://en.wikipedia.org/wiki/Dynamic_time_warping

That's one of the oldest algorithms in speech recognition, and as always while there is no free lunch and that it may not work well for your application, I guess it's a short cut that you'd appreciate before reading a whole book on pattern recognition, and by all means read that book too and if you can understand anything out of that mess, I'll be here to listen what you have learnt, because I couldn't understand much of it. If you happen to see things like support vector machines, banach/hilbert spaces, and other high dimensional stuff along with some bayesian probability stuff that is presented like some kind of boolean logic/arithmetic on its own, it's never too late to close the book and return to the algorithm above:)

Before jumping right in and trying to implement dynamic time warping, you should also have a look at http://en.wikipedia.org/wiki/K-means_clustering
That is one of the things you may use to be able to extact anything meaningful from fft data, but before even thinking about using fft, you should probably have a look at also http://en.wikipedia.org/wiki/Mel-frequency_cepstrum as an example for a feature extactor for speech data, as fft output data is a feature vector that you won't really would like to use, it's too "high dimensional", and it's difficult to try to define a useful 'distance function' between such high dimensional vectors.

Not that any of this stuff will fit exactly, but these are just some pointers into the kind of stuff you should be looking at.

and if you couldn't relate anything in this post to your problem, then this may work as a starting point http://www.cs.cornell.edu/Courses/cs475 ... abiner.pdf no it doesn't talk about dynamic time warping, it is about hidden markov models, which is a more efficient replacement for dynamic time warping. The reference list at the end of that paper should include almost anything that is relevant.

Good luck, and don't forget that I do not know the stuff I am talking about, I have just tried my chance with it and have quited later, so none of the above links will lead to a quick solution, but just will give a sense of the stuff that you need to deal with.. and one last thing, most of this post assumes that you need to deal with a signal that is characterized by a pattern that changes in time, and if you can get rid of that requirement then there may be a simpler solution...
~stratum~

Post

Hi,

thanks all!

Your answers are helpful for me.
I know I have a lot to read for understanding 'better' the DST concept.

For the beginning I only want to recognise some specific sound patterns, nor filtering unwanted sounds neither real speech recognition.

I'm going to start reading @stratum links, and then trying to work with FFT and arduino.

I'll have to work hard!

Regards.

Post

Hi again,

I'm still working on it. I've been reading more about DSP and FFT, but know I have to implement it on code, and although I know how to do it, it's being hard to me doing it.

I want to be available of taking samples for a while (1 second or less), do the FFT of these samples, and compare them with a pattern previouslyu stored in memory (EEPROM or FLASH). If a true check is given back, I have to switch on a led. It's a way of doing a sound security system (password).

Regards.

Post

yolco wrote:Hi again,

I'm still working on it. I've been reading more about DSP and FFT, but know I have to implement it on code, and although I know how to do it, it's being hard to me doing it.

...

Regards.
http://wiki.openmusiclabs.com/wiki/ArduinoFFT

http://interface.khm.de/index.php/lab/e ... rocessing/

Post

yolco wrote:It's a way of doing a sound security system (password).
aah, this depicts the scope of the project nicely.

i use fft code from dspguide.com. it's not as fast, but it's easy to understand and implement.

once you get the fft working, you'll probably find it's the best solution. using bandpass filters and peak followers would be less robust and laughable for any real security situation, but sometimes humour is useful.
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.

Post Reply

Return to “DSP and Plugin Development”