scipy.io.wavfile.write

scipy.io.wavfile.write(filename, rate, data)[source]

Write a numpy array as a WAV file

Parameters:

filename : string or open file handle

Output wav file

rate : int

The sample rate (in samples/sec).

data : ndarray

A 1-D or 2-D numpy array of either integer or float data-type.

Notes

  • The file can be an open file or a filename.
  • Writes a simple uncompressed WAV file.
  • The bits-per-sample will be determined by the data-type.
  • To write multiple-channels, use a 2-D array of shape (Nsamples, Nchannels).