music.play_audio

music.play_audio(sonic_vector, sample_rate=44100, normalize=True)[source]

Play a sonic vector using the sounddevice library.

Parameters:
sonic_vectorarray_like

Samples to be played. Mono arrays should have shape (n,) and stereo arrays (2, n).

sample_rateint, optional

Playback sample rate. Defaults to 44100.

normalizebool, optional

If True (default), normalize sonic_vector before playback using normalize_mono() or normalize_stereo().

Parameters:
  • sonic_vector (ArrayLike)

  • sample_rate (int)

  • normalize (bool)

Return type:

None

Notes

If the sounddevice module is not installed, this function logs a warning and returns without playing anything.