l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2008 Mar 11 10:10

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Marking Audio file based on Freq.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Marking Audio file based on Freq.

Alex Mandel wrote:
> Fun challenge if anyone is up for it.
> How do I locate all instances of a particular frequency in an audio file?

Audio file implies noise.... which implies matching, some form of FFT is
likely what you are looking for.  Are you sure you are looking for a single
frequency?  Not multiple tones?  Interference patterns?  Touch tones
are a combination of 6 frequencies I think (or something like that).

> Don't worry about format.
> Preferred solution will use Audacity, Octave, R or some other FOSS 
> software. More points the easier it is to use (really a Audacity plugin 
> at least in concept would be great)

How about python?

Say you have 256 samples of a waveform, we will generate it here since
you didn't post any actual wave forms:

Some initialization:
from Numeric import *
from FFT import *
import Gnuplot, Gnuplot.funcutils

Generate a sample waveform:
inp=sin(2*pi*(1250.0/10000.0)*x) + sin(2*pi*(625.0/10000.0)*x)

Let's plot it to see what it looks like:
g = Gnuplot.Gnuplot(debug=1)
g('set data style linespoints')
d = Gnuplot.Data(x, inp)

Now lets take a FFT:
myFFT = 10*log10(abs(real_fft(inp)))

And plot that:
d = Gnuplot.Data(x, myFFT)

You should see noticeable peaks.  So basically what you are going to need to 
do is figure out what frequencies to look for and how long, then break up the
audio into pieces (say 0.1 seconds) then to find a 0.5 second pulse look for
4 in a row above whatever threshold fits your inputs.

Here's an article with more background, my only complaint about it is that
it uses a proprietary graphing library that I couldn't find the python
bindings for (and I dislike academic use only licenses anyways).  The code
above is a minor adaption of the code from the article.


> Bonus if it flags all the points in say the marker track of audacity, 
> which would make it easy for me to shuffle through and listen to the 
> identified segments.

Not sure on the audacity file format, but it should be relatively easy to
write out a new .wav file, a list of time stamps, or related markup
for whatever tools you using.

> Really any ideas on how to approach this would be welcome.

I tend towards coding because I often become frustrated with the abilities
(like pattern matching) of preexisting tools.  Certainly a bit more info
about what you are trying to do and how you solve it (programming or existing
applications) would be interesting.
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.