Re: [Numpy-discussion] Converting audio data to array for further processing

2008-08-26 Thread Gabriel J.L. Beckers
I would go with scikits.audiolab to get you wav data into numpy arrays,
as David mentioned. I use it all the time for bioacoustic research and
it is great (unfortunately still in beta, but works well in practice).

Reading sound data of 5 seconds @ 32000 Hz and finding/measuring your
tones fast should not be a problem with numpy(.fft) and audiolab.

If you need very accurate tone frequency estimation (i.e. more accurate
than a simple fft can give you): I implemented in numpy an algorithm
(from the speech analysis program Praat) to do this, but as yet it is
not optimized and very slow.

Best, Gabriel

On Mon, 2008-08-25 at 17:25 -0600, Dan Colesworthy wrote:
 Hello all,
 
  
 
 I need an efficient way to convert 24 bit signed audio data to a numpy
 array for further processing.  The data will be in a .wav file, and
 can be recovered via the python wave module.  At that point it is a
 byte string – likely in little endian order.  Somewhere in that data
 will be a 1 second length tone of prescribed but varying amplitude and
 frequency which must be measured for amplitude, frequency, duration,
 thd% etc.
 
  
 
 Also need to make the conversion quickly – over relatively large
 amounts of data.  Something like 5 seconds sampled at 32000
 samples/second.  This same job will have to be repeated  300 times as
 part of a test module. 
 
  
 
 Thanks in advance for any and all ideas.
 
  
 
 Dan Colesworthy
 
 Otologics LLC
 
  
 
 
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Converting audio data to array for further processing

2008-08-25 Thread Dan Colesworthy
Hello all,

 

I need an efficient way to convert 24 bit signed audio data to a numpy
array for further processing.  The data will be in a .wav file, and can
be recovered via the python wave module.  At that point it is a byte
string - likely in little endian order.  Somewhere in that data will be
a 1 second length tone of prescribed but varying amplitude and frequency
which must be measured for amplitude, frequency, duration, thd% etc.

 

Also need to make the conversion quickly - over relatively large amounts
of data.  Something like 5 seconds sampled at 32000 samples/second.
This same job will have to be repeated  300 times as part of a test
module. 

 

Thanks in advance for any and all ideas.

 

Dan Colesworthy

Otologics LLC

 

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Converting audio data to array for further processing

2008-08-25 Thread David Cournapeau
On Mon, Aug 25, 2008 at 4:25 PM, Dan Colesworthy
[EMAIL PROTECTED] wrote:
 Hello all,



 I need an efficient way to convert 24 bit signed audio data to a numpy array
 for further processing.  The data will be in a .wav file, and can be
 recovered via the python wave module.  At that point it is a byte string –
 likely in little endian order.

There are some wav io facilities in scipy.io.

If you need more advanced facilities and ndo not ming using
LGPL-licensed code, there is scikits.audiolab which is a wrapper
around sndfile and supports a large range of audio file formats:

http://www.mega-nerd.com/libsndfile/
http://projects.scipy.org/scipy/scikits

david
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion