LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-21-2011, 10:34 AM   #1
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Conversion from WAV through CDR to MP3


In 2003 I converted over 25000 of invalid WAV files to MP3 ones using the sequence of commands:

sox file.wav file.cdr
lame file.cdr file.mp3

I used that intermediate method because it wasn’t possible to convert most of these WAV files using lame only. The command lame file.wav file.mp3 displayed in such cases the message:

Code:
Unsupported data format: 0x0002
Now I tried to convert the same WAV files using the same method but lame doesn’t recognize CDR audio format and complains:

Code:
Warning: unsupported audio format
It’s still possible to convert WAV files to MP3 ones using the sequence of commands:

sox file.wav file.raw
lame -s 11.025 file.raw file.mp3

The switch -s 11.025 in the above command is required because without it the resulting MP3 file plays the sound in an accelerated tempo.

Unfortunately when I use RAW audio format the sound in the resulting MP3 files isn’t clear.

So I wonder how can I convert these WAV files to MP3 ones. I see two possibilities:

1. Compile sox using lame and mad libraries.

2. Compile lame enabling CDR audio format.

I tried the first method updating sox sources with the following patch:

Code:
--- CMakeLists.txt      2009-02-12 21:33:57.000000000 +0100
+++ CMakeLists.txt      2011-05-21 17:00:47.000000000 +0200
@@ -65,6 +65,7 @@
 optional(NEED_LIBM math.h m pow "")
 if(NEED_LIBM)
   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lm)
+  set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} mpglib)
 endif(NEED_LIBM)
 optional(EXTERNAL_GSM gsm/gsm.h gsm gsm_create "")
 optional(EXTERNAL_LPC10 lpc10/lpc10.h lpc10 lpc10_create "")
In result I can convert WAV files to MP3 ones using sox:

sox file.wav file.mp3

Now I wonder how to achieve the same result enabling CDR audio format reading in lame because I prefer the second method. Unfortunately I haven’t idea how to enable that during the configuration of the sources of lame. Its documentation doesn’t mention about such switch.

So my question is: how can I compile lame enabling CDR audio format reading.
 
Old 05-21-2011, 06:11 PM   #2
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Original Poster
Rep: Reputation: 234Reputation: 234Reputation: 234
I managed to convert my WAV files to MP3 ones using intermediate CDR format. I found a hint in lame sources – namely in misc/abx.c file:

Code:
    { ".cdr"    , PATH"sox -r44100 -sw -c2 -traw %s -twav -sw -"REDIR },  // CD-DA files are treated as CD like audio, no preemphasis info available
After removing obsolete -sw switch and after changing RAW source format to CDR I converted my WAV files using the following commands:

sox file.wav file.cdr
sox -t cdr file.cdr -t wav - | lame -b 32 -m mono - file.mp3

These commands produce with my WAV files MP3 files in 32 kbit/s, 22050 Hz mono format. The parameters of the lame command are customized to produce the files similar to the files produced by the command mentioned in the former post:

sox file.wav file.mp3

On my machine the command:

sox file.wav file.mp3

converts WAV files in 23 minutes producing 130 MB of MP3 files.

and the commands:

sox file.wav file.cdr
sox -t cdr file.cdr -t wav - | lame -b 32 -m mono - file.mp3

convert WAV files in 39 minutes producing 131 MB of MP3 files.

First method is faster but requires patched sox.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Conversion: FLAC to WAV timswim78 Linux - Software 4 12-06-2017 06:12 PM
shn to mp3/wav conversion linmix Linux - Software 3 06-15-2005 06:33 AM
mp3 to wav conversion jonfa Linux - General 11 06-27-2004 08:26 PM
SIMPLE conversion MP3 to WAV + free source volleyballa Linux - Newbie 2 11-04-2003 11:04 AM
mpg123 and mp3 to wav conversion knmwt15000 Linux - Newbie 7 03-24-2003 04:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration