Skip to content

Instantly share code, notes, and snippets.

@monogenea
Created March 28, 2020 18:26
Show Gist options
  • Save monogenea/b37668d3e8b838073a937a096a2f27c3 to your computer and use it in GitHub Desktop.
Save monogenea/b37668d3e8b838073a937a096a2f27c3 to your computer and use it in GitHub Desktop.
#### Pre-processing ####
# Read files
fnames <- list.files("mp3/", full.names = T, patt = "*.mp3")
# Write metadata for Kaggle dataset
ids <- str_extract(fnames, pattern = "[0-9]{4,}")
query$Path <- fnames[match(query$Recording_ID, ids)]
write.csv(query, "metadata.csv")
# Play random file - setWavPlayer in macOS if "permission denied"
setWavPlayer('/usr/bin/afplay')
play(sample(fnames, 1)) # esc to skip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment