music.write_wav_mono¶
- music.write_wav_mono(sonic_vector=None, filename='asound.wav', sample_rate=44100, fades=0, bit_depth=16, remove_bias=True)[source]¶
Writes a mono WAV file for a numpy array.
- One can also use, for example:
import sounddevice as S S.play(__n(array))
- Parameters:
- sonic_vectorarray_like,
optional The PCM samples to be written as a WAV sound file. The samples are always normalized by normalize_mono(sonic_vector) to have samples between -1 and 1. Defaults to about two seconds of uniform noise.
- filename
str The filename to use for the file to be written.
- sample_ratescalar
The sample frequency.
- fadesiterable or scalar
Milliseconds of fade in and fade out (to avoid clicks), either as a pair or as a single value applied to both ends.
- bit_depth
integer The number of bits in each sample of the final file: 8, 16, 24 or 32 for WAV, and 8, 16 or 24 for FLAC, which has no 32-bit form. Any other value raises ValueError.
- remove_biasbool
Whether to remove or not the bias (or offset)
- sonic_vectorarray_like,
- Parameters:
- Return type:
None
See also
normalize_monoNormalizes an array to [-1,1]
write_wav_monoWrites an array with the same arguments and order of them as soundfile.write.
write_wav_stereoWrite a stereo file.
Examples
>>> write_wav_mono(note(freq=440, duration=0.5), "tone.wav") >>> read_wav("tone.wav").shape (22050,) >>> write_wav_mono(note(), "faded.wav", fades=(50, 200)) # ms in, ms out