Waveform.to_wav_file()

Waveform.to_wav_file()

Writes the waveform to the filesystem as a WAV file.

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.mp3",
... )
>>> waveform
<babycat.Waveform: 9586944 frames, 2 channels, 44100 hz>
>>> waveform.to_wav_file("track.wav")
Parameters

filename (str) – The filename to write the WAV file to.

Raises

babycat.exceptions.UnknownEncodeError – When something went wrong with the encoding.