pre-process script

Utilities module for pre-processing audio stimuli

Run on the command line, e.g.:

$ python preprocess.py

Note

This module has dependencies not required by the CAQE web application. To install these dependencies, run pip install -r analysis_requirements.txt.

preprocess.generate_source_separation_anchors(directory=None, file_list=None)[source]

Generate the PEASS-style anchors for use in a source separation evaluation.

“The distorted target anchor is created by low-pass filtering the target source signal to a 3.5 kHz cut-off frequency and by randomly setting 20% of the remaining timefrequency coefficients to zero.”

“The artifacts anchor is ... created by randomly setting 99% of the time-frequency coefficients of the target to zero and by adjusting the loudness of the resulting signal to that of the target.” - Note that we simply used RMS instead of the ISO 352B loudness model as discussed in the paper.

Parameters:
  • directory (str) – Input directory of audio files to process. Either this or file_list must be defined. Default is None.
  • file_list (list of str) – List of audio files to process. Either this or directory must be defined. Default is None.
Returns:

Return type:

None

References

[1]Emiya, V., et al. Subjective and Objective Quality Assessment of Audio Source Separation. IEEE Transactions on Audio, Speech, and Language Processing, 19(7): 2046-2057, 2011.
preprocess.rms_normalize(directory=None, file_list=None, suffix=None, target_rms=None)[source]

This utility performs rms normalization on a directory or list of files. Note files must be WAV files.

Parameters:
  • directory (str) – Input directory of audio files to process. Either this or file_list must be defined. Default is None.
  • file_list (list of str) – List of audio files to process. Either this or directory must be defined. Default is None.
  • suffix (str) – The suffix to append to the output filenames. If None, then the input files will be overwritten. Default is None.
  • target_rms (float) – The target RMS to which we normalize. If None, then calculate the minimum RMS of the peak normalized files and normalize to that.
Returns:

  • output_file_list (list of str)
  • pre_norm_values (list of float)
  • post_norm_values (list of float)