How to convert a wave file to numbers in R Studio

I uploaded the audio files to R and would now like to get a list of complex number patterns so that I can use the FFT and Wavelet transforms on the patterns.

How do I get a list of numbers to work with R? I tried "audio $ data", but I get an error because $ is not defined in the s4 class.

Any help would be greatly appreciated, thanks.

+6
source share
1 answer

After reading the readWave file from the tuneR package , you can use audio@left and audio@right to access the raw data. The latter is only available if your data is stereo. str(audio) will provide you with detailed information about the structure of the object and it is very useful to know what data it contains and how to access this data.

For obvious reasons, the data in the wave file will be real (and even integers), so if you need complex numbers, you may need to convert them. But I assume that such a conversion will be performed automatically if you pass a vector of integers. The normal fft function (from the stats package) can process an integer vector without any problems.

+4
source

All Articles