ibllib.io.extractors.training_audio

Functions

detect_ready_tone

Detects a transient sinusoid signal in a time-serie

extract_sound

Simple audio features extraction for ambient sound characterization.

welchogram

Computes a spectrogram on a very large audio file.

detect_ready_tone(w, fs, ftone=5000, threshold=0.8)[source]

Detects a transient sinusoid signal in a time-serie

Parameters:
  • w – audio time seried

  • fs – sampling frequency (Hz)

  • ftone – frequency of the tone to detect

  • threshold – ratio of the Hilbert to the signal, between 0 and 1 (set to 0.8)

Returns:

welchogram(fs, wav, nswin=262144, overlap=131072.0, nperseg=512, detect_kwargs=None)[source]

Computes a spectrogram on a very large audio file.

Parameters:
  • fs – sampling frequency (Hz)

  • wav – wav signal (vector or memmap)

  • nswin – n samples of the sliding window

  • overlap – n samples of the overlap between windows

  • nperseg – n samples for the computation of the spectrogram

  • detect_kwargs – specified paramaters for detection

Returns:

tscale, fscale, downsampled_spectrogram

extract_sound(ses_path, task_collection='raw_behavior_data', device_collection='raw_behavior_data', save=True, force=False, delete=False)[source]

Simple audio features extraction for ambient sound characterization. From a wav file, generates several ALF files to be registered on Alyx

Parameters:
  • ses_path – ALF full session path: (/mysubject001/YYYY-MM-DD/001)

  • delete – if True, removes the wav file after processing

Returns:

list of output files