vak.common.files.spect.find_audio_fname#

vak.common.files.spect.find_audio_fname(spect_path: str | Path, audio_ext: str | None = None)[source]#

finds name of audio file in a path to a spectrogram file, if one is present.

Checks for any extension that is a valid audio file format and returns path up to and including that extension, i.e. with the spectrogram file extension removed.

Parameters:
  • spect_path (str, Path) – path to a spectrogram file

  • audio_ext (str) – extension associated with an audio file format, used to find audio file name in spect_path. Default is None. If None, search for any valid audio format (as defined by vak.config.constants.VALID_AUDIO_FORMATS)

Returns:

audio_fname – name of audio file found in spect_path

Return type:

str