This function uses SoX to generate a spectrogram of desired length from a wav file.

sox.spectrogram(
  file.path,
  out.path = file.path(getwd(), "Spectrograms"),
  size = list(x = 2000, y = 1000),
  duration = list(start = 0, end = 180),
  soxpath
)

Arguments

file.path

A string of the file path to the wav file you want to generate a spectrogram for.

out.path

A string of the folder path to save the spectrogram file. Defaults to create a Spectrogram folder in your working directory.

size

A list for the x and y size in px of the spectrogram. Default is x = 2000 and y = 1000 which should work for most instances.

duration

A list for the start and end time of the spectrogram in seconds. Default is start = 0 and end = 180 for a 3 min clip.

Examples

sox.spectrogram("C:/LV-01-01-01/LV-01-01-01_20170609_033500.wav",out.path = file.path(getwd(),"Spectrograms"), size = list(x = 2000, y = 1000), duration = list(start = 0, end = 180))