scipy.io.wavfile.read¶
- scipy.io.wavfile.read(filename, mmap=False)[source]¶
Open a WAV file
Return the sample rate (in samples/sec) and data from a WAV file.
Parameters: filename : string or open file handle
Input wav file.
mmap : bool, optional
Whether to read data as memory-mapped. Only to be used on real files (Default: False).
New in version 0.12.0.
Returns: rate : int
Sample rate of wav file.
data : numpy array
Data read from wav file. Data-type is determined from the file; see Notes.
Notes
This function cannot read wav files with 24-bit data.
Common data types: [R88]
WAV format Min Max NumPy dtype 32-bit floating-point -1.0 +1.0 float32 32-bit PCM -2147483648 +2147483647 int32 16-bit PCM -32768 +32767 int16 8-bit PCM 0 255 uint8 Note that 8-bit PCM is unsigned.
References
[R88] (1, 2) IBM Corporation and Microsoft Corporation, “Multimedia Programming Interface and Data Specifications 1.0”, section “Data Format of the Samples”, August 1991 http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/Docs/riffmci.pdf