visiannot.tools.audio_loader

Summary

Module with functions for loading audio files

Functions

visiannot.tools.audio_loader.convert_key_to_channel_id(…)

Converts a key to access data (configuration for ViSiAnnoT) to the index of an audio channel

visiannot.tools.audio_loader.get_audio_wave_info(path)

Loads audio wave and gets frequency and number of samples

visiannot.tools.audio_loader.get_data_audio(path)

Loads audio data

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 channel

The 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

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 -1 to get all channels

  • slicing (tuple) –

    indexes for slicing output data:

    • (): no slicing

    • (start,): data[start:]

    • (start, stop): data[start:stop]

Returns