jina.types.document.mixins.audio module

class jina.types.document.mixins.audio.AudioDataMixin[source]

Bases: object

Provide helper functions for Document to support audio data.

dump_audio_blob_to_file(file, sample_rate=44100, sample_width=2)[source]

Save blob 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 frequency

  • sample_width (int) – sample width in bytes

Return type

~T

Returns

Document itself after processed

load_uri_to_audio_blob()[source]

Convert an audio uri into blob inplace

Return type

~T

Returns

Document itself after processed

convert_uri_to_audio_blob(**kwargs)