[Numpy-discussion] Audio signal capture and processing
Fri Feb 5 04:49:07 CST 2010
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
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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion