Convert . raw file to . mp3 file or other audio format

Asked

Viewed 1,118 times

2

I have an app that makes audio recordings and stores them on a server. I need these files to be converted from the . raw extension to any audio format, preferably the extension. mp3, to be downloaded to the client’s computer.

Note: My application is developed in JAVA Desktop.

  • It’s your own app that records audio?

  • Welcome to SOPT! What have you tried? take a look at this link to improve the quality of your question: [Ask]

1 answer

1

First of all you will need to figure out how many frames per second (sample rate) your audio has been generated and what the proper sample resolution (bit rate), knowing these values you can develop an algorithm to encode files ". RAW" for any other type, as long as you know the steps needed to encode for the audio extension of interest, this is not a simple task, there must be some ready-made class that performs encoding but never looked for anything like this in Java, the algorithm for encoding raw files to wav is not very complex...

The simplest thing to do is to use some conversion software that accepts input per command line to perform the conversion, I recommend the Sox

Here’s an example of how to use:

sox -r 8000 –bits 16 –encoding signed-integer –endian big -t raw original.RAW convertido.wav

This example performs conversion of a 16-bit recorded RAW file and sampled at 8000 hertz to the extension ". wav"

  • In this case it would be . mp3 in the question. Of course, depending on the program used, it’s just an adjustment, but I think an edited one for an example with mp3 would help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.