docarray.document.mixins.audio module#
- class docarray.document.mixins.audio.AudioDataMixin[source]#
Bases:
object
Provide helper functions for
Document
to support audio data.- save_audio_tensor_to_file(file, sample_rate=44100, sample_width=2)[source]#
Save
tensor
into an wav file. Mono/stereo is preserved.- Parameters:
file (
Union
[str
,BinaryIO
]) – if file is a string, open the file by that name, otherwise treat it as a file-like object.sample_rate (
int
) – sampling frequencysample_width (
int
) – sample width in bytes
- Return type:
T
- Returns:
Document itself after processed