Convert RAW audio files to WAV

Hello everyone,

I am currently working with biacústica of bats, and the files I am using are in WAV format but in my case I need the files to be in RAW format and I want to do the conversion in R so that information is not lost, however, he investigated and so far I could not find an acoustic analysis package that allows me to perform this conversion, I only found that in the bioacoustic package you can use the mp3_to_wav command that is the opposite of what I want.

If anyone knows how I can do this conversion without losing information in the files and I can help change your solution, I will appreciate it.

Hi Elvis, welcome!

Your question is from a very specific niche, so I think it would improve your chances of getting help if you could translate your question into English (most people here speaks English and very few of us speak Spanish).
Also, I think you are confusing RStudio with R, they are not the same, RStudio is an IDE, for the R programming language.


Hola Elvis, Bienvenido!

Tu pregunta es de un nicho muy específico, así que creo que mejorarías tus probabilidades de obtener ayuda si pudieras traducir tu pregunta al ingles (la mayoría de personas aquí habla ingles y muy pocos de nosotros hablamos español).

También, creo que estás confundiendo RStudio con R, no son lo mismo, RStudio es un IDE (Entorno de Desarrollo Integrado) para el lenguaje de programación R.

1 Like

Hi Elvis1993,

You can do this with the package tuneR.

See this answer here on Stack Overflow for an example of WAV to MP3 conversion using this package.

However, bear in mind that all conversions from WAV to MP3 will result in the loss of information, as you are converting the audio data from an uncompressed 'losseless' audio format (WAV) to a compressed 'lossy' format (MP3).

Hope this helps :slight_smile:

Are you sure you have posted the right link? That SO answer is about converting MP3 to WAV not the other way.

2 Likes

Hi @Elvis1993!

I'm a bit confused, because it looks like you've maybe changed your question and the title doesn't seem to match the text. Are you converting from RAW audio to WAV, or from WAV to RAW audio?

The SoX command line tool might be able to help. You can try to compose a call to it from R yourself using system2(), or try the SoX interface from the seewave package.