In R, if I would like to plot the spectrogram from a wave, it is as following:
>library(sound)
>library(tuneR)
>library(seewave)
>s1<-readWave('sample1.wav')
>spectro(s1,main='s1')
>str(s1)
Formal class 'Wave' [package "tuneR"] with 6 slots
..@ left : int [1:312000] 2293 2196 1964 1640 1461 1285 996 600 138 -195 ...
..@ right : num(0)
..@ stereo : logi FALSE
..@ samp.rate: int 8000
..@ bit : int 16
..@ pcm : logi TRUE
But what if I just have data.txt as
2293 2196 1964 1640 1461 1285 996 600 138 -195 ...
What should I put in the spectro
function? spectro(wave, f, ...)
, wave
is said to be an R object
. Or I should use others to get the plot? I tried
>s_1<-read.table("s_1.txt", sep=" ")
>spectro(s_1,f=8000)
Error in filled.contour.modif2(x = X, y = Y, z = Z, levels = collevels, :
no proper 'z' matrix specified
and ended with error. Thank you.