[Numpy-discussion] Audio signal capture and processing

René Dudfield renesd@gmail....
Fri Feb 5 04:49:07 CST 2010


hi,

pyaudio is pretty good for recording audio.  It is based on portaudio and
has binaries available for win/mac - and is included in many linux distros
too (so is pygame).


You can load, and play audio with pygame.  You can use the pygame.sndarray
module for converting the pygame.Sound objects into numpy arrays.

apt-get install python-pygame

import pygame, pygame.sndarray, sys
fname = sys.argv[1]
pygame.init()
sound = pygame.mixer.Sound(fname)
an_array = pygame.sndarray.array(sound)


Also see the sndarray demo: pygame.examples.sound_array_demos.
`python -m pygame.examples.sound_array_demos`

Other sndarray using examples can be found on pygame.org with the search
function.



Also audiolab uses bindings to libsndfile - so you can open a number of
formats.  However it is pretty new, so isn't packaged by distros(yet), and
there are no mac binaries(yet).  It's probably the best way to go if you can
handle compiling it yourself and the dependency.



cheers,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100205/79b09fb7/attachment.html 


More information about the NumPy-Discussion mailing list