unsilence.lib.intervals.Intervals

Module Contents

Classes

Intervals

Collection of lib.Intervals.Interval

class unsilence.lib.intervals.Intervals.Intervals(interval_list: list = None)

Collection of lib.Intervals.Interval

Initializes a new Interval Collection :param interval_list: list of intervals, optional

property intervals

Returns the list of intervals :return:

add_interval(interval)

Adds an interval to the collection :param interval: interval to be added :return: None

optimize(short_interval_threshold=0.3, stretch_time=0.25)

Optimizes the Intervals to be a better fit for media cutting :param short_interval_threshold: The shortest allowed interval length (in seconds) :param stretch_time: The time that should be added/removed from a audible/silent interval :return: None

__combine_intervals(short_interval_threshold)

Combines multiple intervals in order to remove intervals smaller than a threshold :param short_interval_threshold: Threshold for the shortest allowed interval :return: None

__enlarge_audible_intervals(stretch_time)

Enlarges/Shrinks intervals based on if they are silent or audible :param stretch_time: Time the intervals should be enlarged/shrunken :return: None

remove_short_intervals_from_start(audible_speed=1, silent_speed=2)

Removes Intervals from start that are shorter than 0.5 seconds after speedup to avoid having a final output without an audio track :param audible_speed: The speed at which the audible intervals get played back at (float) :param silent_speed: The speed at which the silent intervals get played back at (float) :return: The new, possibly shorter, Intervals object

copy()

Creates a deep copy :return: Deep copy of Intervals

serialize()

Serializes this collection :return: Serialized list

static deserialize(serialized_obj)

Deserializes a previously serialized object and creates a new Instance from it :param serialized_obj: Serialized list :return: New instance of Intervals

__repr__()

String representation :return: String representation