visiannot.tools.audio_loader¶
Summary¶
Module with functions for loading audio files
API¶
Functions¶
-
visiannot.tools.audio_loader.convert_key_to_channel_id(key_data)[source]¶ Converts a key to access data (configuration for
ViSiAnnoT) to the index of an audio channelThe key must contain the word “left” or “right”, otherwise default channel is
0.- Parameters
key_data (str) – key with channel ID
- Returns
channel ID
- Return type
int
-
visiannot.tools.audio_loader.get_audio_wave_info(path)[source]¶ Loads audio wave and gets frequency and number of samples
- Parameters
path (str) – path to the audio file
- Returns
data_wave (wave.Wave_read) – see https://docs.python.org/3/library/wave.html#wave-read-objects
freq (float) – frequency
nframes (float) – number of samples
-
visiannot.tools.audio_loader.get_data_audio(path, channel_id=0, slicing=())[source]¶ Loads audio data
- Parameters
path (str) – path to the audio file
channel_id (int) – audio channel to be loaded as a numpy array, set it to
-1to get all channelsslicing (tuple) –
indexes for slicing output data:
(): no slicing(start,):data[start:](start, stop):data[start:stop]
- Returns
data_wave (wave.Wave_read) – see https://docs.python.org/3/library/wave.html#wave-read-objects
data_audio (numpy array) – audio signal, with all channels if
channel_idis set to-1freq (int) – frequency