Waveform.to_wav_buffer()¶
- Waveform.to_wav_buffer()¶
Encodes the waveform into a
bytearray
in the WAV format.Example
Decode an MP3 file and re-encode it as WAV.
>>> from babycat import Waveform >>> waveform = Waveform.from_file( ... "audio-for-tests/andreas-theme/track.flac", ... ) >>> waveform <babycat.Waveform: 9586415 frames, 2 channels, 44100 hz> >>> arr = waveform.to_wav_buffer() >>> type(arr) >>> len(arr)
- Returns
The encoded WAV file.
- Return type
- Raises
babycat.exceptions.UnknownEncodeError – When something went wrong with the encoding.