<p>I would recommend using seewave. Something like this should be good:</p>
<pre><code># install packages if needed
install(seewave, tuneR)

# activate packages
library(seewave)
library(tuneR)

# read the .wav file
wav_file &lt;- readWave(file_path)

# plot spectrum for section 2-6 secs in wav file
spectro(wav_file, tlim=c(2,6))
</code></pre>
<p>You can see more on other potential parameters here:
<a href="https://rdrr.io/cran/seewave/man/spectro.html" rel="noreferrer">https://rdrr.io/cran/seewave/man/spectro.html</a></p>

CC BY-SA 4.0
2022-12-13T19:17:22.743Z
2022-12-13T19:17:22.743Z
Carlos Abrahams
<p>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?</p>

CC BY-SA 4.0
2022-12-10T19:54:17.367Z
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?
WMXZ
CC BY-SA 4.0
2022-12-10T19:59:50.533Z
For example https://hansenjohnson.org/post/spectrograms-in-r/
WMXZ
<r><code><spectrogram>
How to make a spectrogram in R
# How to make a spectrogram in R

(Asked by: username_0 on 2022-12-10)

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?

**Tags:** r, code, spectrogram

> **Comments:**
> **username_1**: 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?  
> **username_1**: For example https://hansenjohnson.org/post/spectrograms-in-r/  

---

## 1 answers

### Answer by username_2 on 2022-12-13. Score: 11

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>


---

