6
$\begingroup$

I have a a wave file and I need to make a spectrogram in R. I also need to be able to look at a specific time of the whole recording in the spectrogram. Anybody knows how to?

$\endgroup$
2
  • $\begingroup$ Sorry, as far as I see the R documentation has multiple examples on how to create spectrograms, but is there something missing in your question that goes beyond the examples on the web? $\endgroup$
    – WMXZ
    Commented Dec 10, 2022 at 19:54
  • 2
    $\begingroup$ For example hansenjohnson.org/post/spectrograms-in-r $\endgroup$
    – WMXZ
    Commented Dec 10, 2022 at 19:59

1 Answer 1

11
$\begingroup$

I would recommend using seewave. Something like this should be good:

# install packages if needed
install(seewave, tuneR)

# activate packages
library(seewave)
library(tuneR)

# read the .wav file
wav_file <- readWave(file_path)

# plot spectrum for section 2-6 secs in wav file
spectro(wav_file, tlim=c(2,6))

You can see more on other potential parameters here: https://rdrr.io/cran/seewave/man/spectro.html

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.