module pixeltable.functions.audio
Pixeltable UDFs forAudioType.
iterator audio_splitter()
Signature
duration.
If the input contains no audio, no segments are yielded.
Outputs:
One row per audio segment, with the following columns:
segment_start(pxt.Float): Start time of the audio segment in secondssegment_end(pxt.Float): End time of the audio segment in secondsaudio_segment(pxt.Audio | None): The audio content of the segment
duration(pxt.Float): Audio segment duration in secondsoverlap(pxt.Float): Overlap between consecutive segments in secondsmin_segment_duration(pxt.Float): Drop the last segment if it is smaller thanmin_segment_duration
tbl with a column audio of type pxt.Audio. Create a view that splits all audio files into segments of 30 seconds with 5 seconds overlap:
udf encode_audio()
Signature
audio_data(pxt.Array[float32]): An array of sampled amplitudes. The accepted array shapes are(N,)or(1, N)for mono audio or(2, N)for stereo.input_sample_rate(pxt.Int): The sample rate of the input audio data.format(pxt.String): The desired output audio format. The supported formats are ‘wav’, ‘mp3’, ‘flac’, and ‘mp4’.output_sample_rate(pxt.Int | None): The desired sample rate for the output audio. Defaults to the input sample rate if unspecified.
udf get_metadata()
Signature
audio(pxt.Audio): The audio to get metadata for.
pxt.Json: Adictsuch as the following:
audio_col column of the table tbl: