Introduction#
OSEkitβs Core API provides means of manipulating audio data with timestamp-based pointers.
The audio data is decoupled from audio files: audio data can be fetched across multiple files without the user having to worry about it.
The Core API provides ways of computing and plotting spectrograms, which are also treated as time-bound data that can be joined with
audio (or any other type of) data.
Event#
The osekit.core.event.Event represent anything that is time-bound: an Event has a begin and an end, which are described as pandas Timestamps.
Almost every other class in OSEkit inherits from Event.
Data and Files#
Decoupling data from files is the cornerstone of OSEkitβs behaviour. Users can define data events from any list of files without worrying of whether the data events scatter across multiple files, nor if it contains empty time periods between files.
To do so, OSEkit uses an intermediary object between the Data and the File: an Item, which is a part of Data that is found in a single File.
Note
File: Object that represents an actual file on disk (e.g. an audio file, a spectrogram matrix, etc.)Data: Object that represents the data contained by file(s) between two timestamps (e.g. a spectrogram plot from a part of an audio file)Item: Part of aDatathat is found in a singularFile. If aDataspans over multipleFile, anItemis created for each one of them and their concatenation forms theDatavalues.
As an example, letβs consider 3 files that differ in duration (along the x-axis in the figures here below). The first two files are consecutive, and the third one is separated from the end of the second by a duration for which there is no data.
From these 3 files, the user want to manipulate a data object (for example to plot a spectrogram from the audio files in a given time period).
Under the hood, OSEkit will create intermediate Item objects that will be used for the data to be fetched seamlessly, with an optimized I/O workflow.
An Item correspond to a single link between a Data and a File: although a Data can be linked to multiple File (and vice versa),
Optimized I/O#
The Data/Item/File structure allow for an optimized handling of the files.
The values from the File objects transit through the Item on demand, and File related files are opened/closed only when needed,
that is when another Item requests values from another File than the currently opened one:
Different type of data#
Since OSEkit provides ways to manipulate different types of data (audio, spectro, etc.), the Data <-> File operations described in the Data and Files section are managed in bases classes:
osekit.core.base_file.BaseFilerepresent any fileosekit.core.base_item.BaseItemrepresent any itemosekit.core.base_data.BaseDatarepresent any data
These base classes are then derived through inheritance to specialized classes for any data type. For example, audio data is manipulated through the
osekit.core.audio_data.AudioData class.