unsilence.lib.intervals.Interval
Module Contents
Classes
Represents a section in time where the media file is either silent or audible |
- class unsilence.lib.intervals.Interval.Interval(start=0, end=0, is_silent=False)
Represents a section in time where the media file is either silent or audible
Initializes an Interval object :param start: Start time of the interval in seconds :param end: End time of the interval in seconds :param is_silent: Whether the interval is silent or not
- property start
Get the start time :return: start time in seconds
- property end
Get the end time :return: end time in seconds
- property duration
Returns the duration of the interval :return: Duration of the interval
- enlarge_audible_interval(stretch_time, is_start_interval=False, is_end_interval=False)
Enlarges/Shrinks the audio interval, based on if it is silent or not :param stretch_time: Time the interval should be enlarged/shrunken :param is_start_interval: Whether the current interval is at the start (should not enlarge/shrink) :param is_end_interval: Whether the current interval is at the end (should not enlarge/shrink) :return: None
- copy()
Creates a deep copy of this Interval :return: Interval deepcopy
- serialize()
Serializes the current interval into a dict format :return: serialized dict
- static deserialize(serialized_obj: dict)
Deserializes a previously serializes Interval and generates a new Interval with this data :param serialized_obj: previously serializes Interval (type dict) :return: Interval
- __repr__()
String representation :return: String representation