![](https://secure.gravatar.com/avatar/ae54c00bc2b74f820cc363ed19dc6fcd.jpg?s=120&d=mm&r=g)
Nils Wagner wrote:
Hi all,
How do I write numpy arrays to sound files ?
Nils
Hi, This works for me, at least on Windows. Best, James from numpy import arange, sin from waveio import exportWave w=sin(arange(0,2000,0.5)) #simple waveform exportWave('test.wav',8000,w) #8000=sampling rate in Hz.
![](https://secure.gravatar.com/avatar/612395b66b3e7959997007b342b3688a.jpg?s=120&d=mm&r=g)
On Sun, 09 Nov 2008 11:13:12 -0800 James Coughlan <coughlan@ski.org> wrote:
Nils Wagner wrote:
Hi all,
How do I write numpy arrays to sound files ?
Nils
Hi,
This works for me, at least on Windows.
Best,
James
from numpy import arange, sin from waveio import exportWave w=sin(arange(0,2000,0.5)) #simple waveform exportWave('test.wav',8000,w) #8000=sampling rate in Hz.
Hi James, where can I get the module waveio and how do I install the module waveio ? Nils
![](https://secure.gravatar.com/avatar/59bdb3784070f0a6836aca9ee03ad817.jpg?s=120&d=mm&r=g)
On Mon, Nov 10, 2008 at 2:40 AM, Nils Wagner <nwagner@iam.uni-stuttgart.de> wrote:
Hi all,
How do I write numpy arrays to sound files ?
If you have very basic needs, when python stdlib (as given by James' example) is enough. If you want more control/other file format, then audiolab may be more appropriate. There is a simple API (the so-called matlab API) for wav, aiff, flac and a few other formats, David
![](https://secure.gravatar.com/avatar/15cbc90543256ddc4d93e51f2b6b7500.jpg?s=120&d=mm&r=g)
Hallo! If you want to have the exact commands: 1) build audiolab (http://www.ar.media.kyoto-u.ac.jp/members/david/softwares/audiolab/) 2) in python: from scikits.audiolab import wavread, wavwrite # read a wave file (audiodata, samplingrate, encoding) = wavread("yourfile.wav") # write a wave file wavwrite(audiodata_as_numpy_array, "youroutputfile.wav", samplingrate) LG Georg David Cournapeau schrieb:
On Mon, Nov 10, 2008 at 2:40 AM, Nils Wagner <nwagner@iam.uni-stuttgart.de> wrote:
Hi all,
How do I write numpy arrays to sound files ?
If you have very basic needs, when python stdlib (as given by James' example) is enough. If you want more control/other file format, then audiolab may be more appropriate. There is a simple API (the so-called matlab API) for wav, aiff, flac and a few other formats,
David _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
![](https://secure.gravatar.com/avatar/c35a6e7a29437b8571a40adcf1aff4f8.jpg?s=120&d=mm&r=g)
Hi! You may find this example useful: http://neuralensemble.org/trac/NeuroTools/browser/trunk/examples/single_neur... We used scikits.audiolab to record a numpy array and pyaudio to play it on your computer. (and btw, it's an educational example, not scientific!) cheers laurent Le 10 nov. 08 à 10:28, Georg Holzmann a écrit :
Hallo!
If you want to have the exact commands:
1) build audiolab (http://www.ar.media.kyoto-u.ac.jp/members/david/softwares/audiolab/)
2) in python:
from scikits.audiolab import wavread, wavwrite
# read a wave file (audiodata, samplingrate, encoding) = wavread("yourfile.wav")
# write a wave file wavwrite(audiodata_as_numpy_array, "youroutputfile.wav", samplingrate)
LG Georg
David Cournapeau schrieb:
On Mon, Nov 10, 2008 at 2:40 AM, Nils Wagner <nwagner@iam.uni-stuttgart.de> wrote:
Hi all,
How do I write numpy arrays to sound files ?
If you have very basic needs, when python stdlib (as given by James' example) is enough. If you want more control/other file format, then audiolab may be more appropriate. There is a simple API (the so- called matlab API) for wav, aiff, flac and a few other formats,
David _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
participants (5)
-
David Cournapeau
-
Georg Holzmann
-
James Coughlan
-
Laurent Perrinet
-
Nils Wagner