Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: extracting sin wave from audio data (Read 4372 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

extracting sin wave from audio data

hi,

I have a query regarding digital audio data. I want to seperate a 10 Hz sin wave from a digital audio data. sin wave of frequencies 10Hz and 20 Hz are explicitly added to the audio data for some purpose.

i treid using filters but as i am getting lot of trouble designing and implementing the filter , as the sampling freq is fixed to be 44.1KHz and cant be changed.

Please suggest me some other method. Also will resonance will be a better solution.

Thanks in advance
Anshul

extracting sin wave from audio data

Reply #1
Quote
I have a query regarding digital audio data. I want to seperate a 10 Hz sin wave from a digital audio data. sin wave of frequencies 10Hz and 20 Hz are explicitly added to the audio data for some purpose.

i treid using filters but as i am getting lot of trouble designing and implementing the filter , as the sampling freq is fixed to be 44.1KHz and cant be changed.

Please suggest me some other method. Also will resonance will be a better solution.

There are many options. The simplest (but least effective) is to use resonant (IIR) filters tuned at 10 and 20 Hz. Another (better) is to use FFT's on windows that should be at least one second long. If you really need lots of precision and fast response, the best algorithm would probably be the MUSIC algorithm. However, it requires stuff like computation of eigenvalue/vectors and it's much more complex (both in terms of code and CPU). So only try that if all else fails.

extracting sin wave from audio data

Reply #2
what are you using to implement the filter?


People usually use IIR filters at such low frequencies, because FIR must be very long. But with modern computers, and off-line (i.e. not real time) processing, this isn't such an issue.


If you want near-perfect isolation of 10Hz from 20Hz, the time resolution will be quite poor. A couple of cycles ringing at 10Hz is 1/5th of a second.


You say you can't change the sample rate. Some processing tools (e.g. Cool Edit, MATLAB, etc etc) will simply let you lie about the sampling rate. So, say it's 176.4kHz sampled audio. Then your 10Hz becomes 40Hz, and 20Hz becomes 80Hz. These are in the audio range that most software is made to deal with. Note that it doesn't make the calculation easier at all - the filters are just as difficult (identical, in fact), but it does bring everything into the range of the GUI of these programs, so you can at least see what you're doing.


The quickest to program (but slowest to execute) would be to use a very long FIR filter. A carefully designed IIR filter would be much better - can't you make a standard design stable at these frequencies?

I'm assuming that there's nothing of interest below 10Hz, and that you can just high or low pass at ~ 15Hz. Is it more complicated than this? What are you trying to do?

Cheers,
David.

extracting sin wave from audio data

Reply #3
I wonder if this would be possible:  Using something like Cool Edit, copy the track to a new one, (running side-by-side), invert its phase, do a simple filter above, say, 15hz on the inverted one, mix the two together.

Or something like that.  Perhaps shift the frequency higher before processing, to bring it all up into the audio range first, like 2Bdecided said.

Dex

extracting sin wave from audio data

Reply #4
Quote
The quickest to program (but slowest to execute) would be to use a very long FIR filter. A carefully designed IIR filter would be much better - can't you make a standard design stable at these frequencies?

Just a little precision:  to meet given requirements a carefully designed IIR filter will be shorter than a carefully designed FIR. However, if you can afford the processing time a FIR filter will always be superior (or equal).

 

extracting sin wave from audio data

Reply #5
I meant better, as in faster execution speed. Thanks for clarifying it, though I probably had the following in mind too...

I would expect the pre/post ring on the filter to be unmanageable, given that it should be linear phase filter (hence FIR), with a sharp cut off (which he seems to want) at such a low frequency. I'd expect him to choose to sacrifice the phase and sharpness of cut off, in order to reduce the ringing - this would make some IIR design optimal. I know you can make an FIR filter with any phase response you want, but if we're not going with linear phase, it makes sense to try a simpler IIR filter design.

Until Anshul tells us more, this is just guesswork! And I'm wary of teaching my grandmother to suck eggs.

Cheers,
David.