Skip to main content
Iterator over chunks of an audio file. The audio file is split into smaller chunks, where the duration of each chunk is determined by chunk_duration_sec. The iterator yields audio chunks as pxt.Audio, along with the start and end time of each chunk. If the input contains no audio, no chunks are yielded. Args: chunk_duration_sec: Audio chunk duration in seconds overlap_sec: Overlap between consecutive chunks in seconds. min_chunk_duration_sec: Drop the last chunk if it is smaller than min_chunk_duration_sec View source on GitHub

Methods


build_chunks()

Signature:
build_chunks(
    start_time_sec: float,
    total_duration_sec: float,
    chunk_duration_sec: float,
    overlap_sec: float,
    min_chunk_duration_sec: float
)-> list[tuple[float, float]]

close()

Close the iterator and release all resources Signature:
close()-> None

create()

Signature:
create(**kwargs: Any)-> tuple[type[ComponentIterator], dict[str, Any]]

input_schema()

Provide the Pixeltable types of the init() parameters The keys need to match the names of the init() parameters. This is equivalent to the parameters_types parameter of the @function decorator. Signature:
input_schema()-> dict[str, pixeltable.type_system.ColumnType]

output_schema()

Specify the dictionary returned by next() and a list of unstored column names Signature:
output_schema(
    *args: Any,
    **kwargs: Any
)-> tuple[dict[str, pixeltable.type_system.ColumnType], list[str]]
Returns:
  • tuple[dict[str, pixeltable.type_system.ColumnType], list[str]]: a dictionary which is turned into a list of columns in the output table a list of unstored column names

set_pos()

Set the iterator position to pos Signature:
set_pos(pos: int)-> None
I