Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Getting audio input and processing it?

Reply
Thread Tools

Getting audio input and processing it?

 
 
Michael Curry
Guest
Posts: n/a
 
      01-10-2013
I've been working on a Morse Code translator, I've made it work so that youcan input English and it will translate it to Morse and play the Audio. I now want to add a feature to the program that takes audio input, processes it and then outputs the English.

Are there any specific APIs that I can use to take input from a microphone,is there any way to detect frequencies or amplitudes, as well as find out for how long the wave lasts? If not, are there any implementations of this?Would there be a way to do it?
 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      01-10-2013
On 01/09/2013 07:20 PM, Michael Curry wrote:
> I've been working on a Morse Code translator, I've made it work so that you can input English and it will translate it to Morse and play the Audio. I now want to add a feature to the program that takes audio input, processes it and then outputs the English.
>
> Are there any specific APIs that I can use to take input from a microphone, is there any way to detect frequencies or amplitudes, as well as find out for how long the wave lasts? If not, are there any implementations of this? Would there be a way to do it?


If you find an approach that gets audio information from your hardware,
and on your operating system, then you presumably end up with a stream
of bytes (or of some other data type, if the sample size is bigger than
8 bits). If this were my project, I'd ignore the detecting of frequency
(though it can be done, by various filtering techniques), and just
measure energy. Presumably the signal is quiet for space, and noisy for
mark. So you set a threshold, and measure how long the signal is below
the threshold, and then how long it's above. The time above the
threshold is how long the "wave lasts." Presumably you can then set a
few length thresholds, and short values are dit and longer ones are dah.

So, how do you measure energy on a byte string? The way I've seen audio
encoded in 8 bits has 128 as the DC zero reference point. Values above
and below that represent a nonzero signal voltage. So you'd do
something like:
abs( value-12

to get an instantaneous energy. Do a sanity check to make sure the
"quiet" signal gives you a very small energy (some noise expected, of
course).

There are lots of refinements possible. But I suspect someone else is
going to pop in and say that libary xyz on pypi will do it all for you
automatically. There's probably someone who's done the whole project
before. But what's the fun in that?


--

DaveA

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Processing in Ruby Benjamin Oakes Ruby 3 03-10-2008 12:43 AM
Getting User Input after getting Input from a file dei3cmix@uga.edu C++ 3 03-23-2006 05:01 AM
Post-Processing RAW vs Post-Processing TIFF Mike Henley Digital Photography 42 01-30-2005 08:26 AM
Can anyone recommend any Audio Processing libraries? Wayne... C++ 4 09-17-2004 03:44 PM
Question: processing HTML, re-write default processing action of many tags Hubert Hung-Hsien Chang Python 2 09-17-2004 03:10 PM



Advertisments