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?
$\begingroup$
$\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$– WMXZCommented Dec 10, 2022 at 19:54
-
2$\begingroup$ For example hansenjohnson.org/post/spectrograms-in-r $\endgroup$– WMXZCommented Dec 10, 2022 at 19:59
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
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