AudioItem#

class osekit.core_api.audio_item.AudioItem(file: AudioFile | None = None, begin: Timestamp | None = None, end: Timestamp | None = None)#

AudioItem corresponding to a portion of an AudioFile object.

Initialize an AudioItem from an AudioFile and begin/end timestamps.

Parameters#

file: osekit.data.audio_file.AudioFile

The AudioFile in which this Item belongs.

begin: pandas.Timestamp (optional)

The timestamp at which this item begins. It is defaulted to the AudioFile begin.

end: pandas.Timestamp (optional)

The timestamp at which this item ends. It is defaulted to the AudioFile end.

classmethod from_base_item(item: BaseItem) AudioItem#

Return an AudioItem object from a BaseItem object.

get_value() np.ndarray#

Get the values from the File between the begin and stop timestamps.

If the Item is empty, return a single 0.

property nb_channels: int#

Number of channels in the associated AudioFile.

property sample_rate: float#

Sample rate of the associated AudioFile.

property shape: int#

Number of points in the audio item data.