play_audio¶
- class torchaudio.io.play_audio(waveform: Tensor, sample_rate: Optional[float], device: Optional[str] = None)[source]¶
Plays audio through specified or available output device.
Warning
This function is currently only supported on MacOS, and requires libavdevice (FFmpeg) with
audiotoolbox
output device.Note
This function can play up to two audio channels.
- Parameters:
waveform – Tensor containing the audio to play. Expected shape: (time, num_channels).
sample_rate – Sample rate of the audio to play.
device – Output device to use. If None, the default device is used.