music.write_wav_stereo

music.write_wav_stereo(sonic_vector=None, filename='asound.wav', sample_rate=44100, fades=0, bit_depth=16, remove_bias=True, normalize_separately=False)[source]

Write a stereo WAV files for a numpy array.

Parameters:
sonic_vectorarray_like, optional

The PCM samples to be written as a WAV sound file. The samples are always normalized by normalize_stereo(sonic_vector) to have samples between -1 and 1 and remove the offset. Use array of shape (nchannels, nsamples). Defaults to about two seconds of uniform noise.

filenamestr

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_depthinteger

The number of bits in each sample of the final file: 8, 16 or 32. Any other value raises ValueError.

remove_biasbool

Whether to remove or not the bias (or offset)

normalize_separatelybool

Set to True if each channel should be normalized separately. If False (default), the arrays will be rescaled in the same proportion.

Parameters:
  • sonic_vector (ArrayLike | None)

  • filename (str)

  • sample_rate (int)

  • fades (Sequence[int] | int)

  • bit_depth (int)

  • remove_bias (bool)

  • normalize_separately (bool)

Return type:

None

See also

normalize_stereo

Normalizes a stereo array to [-1,1]

write_wav_mono

Write a mono file.