Jump to content

encoding wav files into mp3


Recommended Posts

Hi all,

I am building an application that accumulates lots of data. There are also some microphones involved to add some context to the measurement while postprocessing. The measurement will run autonomously and therefore I need to save disk space where ever I can.

I am saving the sound information as WAV files, and I would like to compress them as much as I can. I will use a frugal format of 11025 kHz single channel 16 bit data.

I experimented a bit with compressing to zip, rar, OGG and MP3. A file size of 948 KB compressed as to the following sizes:

original 948 KB

zip 719 KB :thumbdown:

rar 577 KB

OGG 178 KB

mp3PRO 133 KB (86% compression!) :thumbup:

The difference between OGG and mp3PRO is circumstantial, since I tried hard to optimize the settings of the mp3 codec. The sound quality is not an issue and I really couldn't even hear the difference anyway.

Obviously I would like to encode the data to mp3, and there lies my challange: what utility to use to programmatically encode data to mp3?

Normally I would look for a tool with a good command line interface. But it would be awsome if I could somehow do inline encoding. Maybe via a pipe? Suggestions are very welcome.

Also I have this issue with the system exec.vi I normally use to make command line calls: The VI will only run the command correctly if I make the flag "run until completion" true. This is a real issue, because I really do not want to lock up my code while encoding wav files.

Your suggestions are much appreciated! :)

Link to comment

QUOTE(aart-jan @ Jan 1 2008, 07:57 PM)

Hi all,

I am building an application that accumulates lots of data. There are also some microphones involved to add some context to the measurement while postprocessing. The measurement will run autonomously and therefore I need to save disk space where ever I can.

I am saving the sound information as WAV files, and I would like to compress them as much as I can. I will use a frugal format of 11025 kHz single channel 16 bit data.

I experimented a bit with compressing to zip, rar, OGG and MP3. A file size of 948 KB compressed as to the following sizes:

original 948 KB

zip 719 KB :thumbdown:

rar 577 KB

OGG 178 KB

mp3PRO 133 KB (86% compression!) :thumbup:

The difference between OGG and mp3PRO is circumstantial, since I tried hard to optimize the settings of the mp3 codec. The sound quality is not an issue and I really couldn't even hear the difference anyway.

Obviously I would like to encode the data to mp3, and there lies my challange: what utility to use to programmatically encode data to mp3?

Normally I would look for a tool with a good command line interface. But it would be awsome if I could somehow do inline encoding. Maybe via a pipe? Suggestions are very welcome.

Also I have this issue with the system exec.vi I normally use to make command line calls: The VI will only run the command correctly if I make the flag "run until completion" true. This is a real issue, because I really do not want to lock up my code while encoding wav files.

Your suggestions are much appreciated! :)

If you just want to encode the data after it has been acquired entirely the command line tool approach should work. For longer sound acquisition this may not be desirable and in that case I would simply create an interface to one of the existing open source compression libraries such as Lame, through the Call Library Node. But there is one issue with MP3 that OGG probably wouldn't have, and that is the fact that some companies try to squezze money out of every use of MP3 encoding software. So your application while working technically alright may have legal issues. probably not an issue for a home grown hobby application, but certainly a problem for a professional application.

I'm not sure about the "run until completion" true problem though. I haven't seen this yet and I do make use of the system exec regularly.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.