spectrofu

Command-line script that preprocesses a dataset of audio and turns it into spectrograms.

Assumes pre-chunking e.g. via chunkadelic — This is pretty much a simplified duplicate of chunkadelic.

Note: Duplicates the directory structure(s) referenced by input paths.


source

save_stft

 save_stft (audio:<built-inmethodtensoroftypeobjectat0x7f2aa76335c0>,
            new_filename:str)

coverts audio to stft image and saves it

Type Details
audio tensor long audio file to be chunked
new_filename str stem of new filename(s) to be output as spectrogram images

source

main

 main ()

source

process_one_file

 process_one_file (filenames:list, args, file_ind)

this turns one audio file into a spectrogram. left channel only for now

Type Details
filenames list list of filenames from which we’ll pick one
args output of argparse
file_ind index from filenames list to read from
! spectrofu -h
usage: spectrofu [-h] [--sr SR] [--workers WORKERS]
                 output_path input_paths [input_paths ...]

positional arguments:
  output_path        Path of output for spectrogram-ified data
  input_paths        Path(s) of a file or a folder of files. (recursive)

optional arguments:
  -h, --help         show this help message and exit
  --sr SR            Output sample rate (default: 48000)
  --workers WORKERS  Maximum number of workers to use (default: all) (default:
                     14)