AudioFileManager#

class osekit.core_api.audio_file_manager.AudioFileManager#

Audio File Manager which keeps an audio file open until a request in another file is made.

Initialize an audio file manager.

close() None#

Close the currently opened file.

info(path: PathLike | str) tuple[int, int, int]#

Return the sample rate, number of frames and channels of the audio file.

Parameters#

path: PathLike | str

Path to the audio file.

Returns#

tuple[int,int,int]:

Sample rate, number of frames and channels of the audio file.

read(path: PathLike | str, start: int = 0, stop: int | None = None) np.ndarray#

Read the content of an audio file.

If the audio file is not the current opened file, the current opened file is switched.

Parameters#

path: PathLike | str

Path to the audio file.

start: int

First frame to read.

stop: int

Frame after the last frame to read.

Returns#

np.ndarray:

A (channel * frames) array containing the audio data.