Help - Search - Members - Calendar
Full Version: Converting wav->MP3, screeching
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
Shane N
Hello, I found this site while sifting the internet for any help with an issue I am having. I hope this hasn't been posted before, but from what I could tell from the search, it doesn't look like it.

What is happening, is I create wav files dynamically from a database. The wav files can be played directly. When I run LAME to convert them to MP3 with just "lame test.wav test.mp3", the MP3 is created, but the content isn't there, but rather a bunch of screeching. However, some other files will convert. I noticed that the output from LAME shows frames 19/22 and 90%. Does that mean it didn't finish? The ones that play sometimes do that as well.

Are there any limits to how small of a wav file can be converted? Many of these are 10-30 seconds long.

Any help would be greatly appreciated.

Thanks, Shane
dreamliner77
What are the sample rates of the wav files you wish to encode?
Shane N
To be honest, I'm not sure. I love music, but I really don't know the technical specs per say. Here is the output I am getting from lame if that helps at all:

QUOTE

shane@svweb:/var/www/vm/testing$ /usr/local/bin/lame test4.wav testing2.mp3
Warning: corrupt or unsupported WAVE format
Assuming raw pcm input file
LAME 3.97 32bits (http://www.mp3dev.org/)
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding test4.wav to testing2.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
38/38 (100%)| 0:00/ 0:00| 0:00/ 0:00| 11.029x| 0:00
-------------------------------------------------------------------------------
kbps MS % long switch short %
128.0 100.0 92.1 5.3 2.6
Writing LAME Tag...done
ReplayGain: -14.2dB


I just noticed that I am getting an error at the very top (which is why I didn't notice at first). If it is corrupt, then why can I play it? Or is there more to it?
Firon
The WAV must be PCM. If it is ADPCM or something else, you must convert it to PCM.
Shane N
How can I figure out what it is? Is there a utility that can convert directly from another format to MP3? (or a way to 'extend' lame to do this?)
Dynamic
QUOTE(Shane N @ Dec 13 2006, 02:39) *

How can I figure out what it is? Is there a utility that can convert directly from another format to MP3? (or a way to 'extend' lame to do this?)


For simplicity try using foobar2000 (which can run under Wine on Linux, which I'm guessing you're running). If it can read the input file format (WAV can contain many types of data, even including MP3, and you might need to install the optional foobar ADPCM input plugin, for example), it can play it, and you can use the right-click/Convert... diskwriter to convert to MP3 (using Lame - presumably a Windows binary, also through Wine?) as an external commandline encoder. Alternatively convert to PCM WAV then convert that to MP3 using Lame under Linux.

Alternatives: I think there's a Linux version of Audacity - the free audio editor. That may well support your unknown input format.

Both these options are GUIs.

If you need a commandline tool to do it, find out what format you have using a GUI tool (or perhaps whatever player you use now in "verbose" mode?), then search for commandline media players that support that format and pipe their PCM output to lame with appropriate switches to tell lame what raw data it's receiving.
moonshot
QUOTE(Shane N @ Dec 12 2006, 17:21) *

What is happening, is I create wav files dynamically from a database. The wav files can be played directly. When I run LAME to convert them to MP3 with just "lame test.wav test.mp3", the MP3 is created, but the content isn't there, but rather a bunch of screeching. However, some other files will convert. I noticed that the output from LAME shows frames 19/22 and 90%. Does that mean it didn't finish? The ones that play sometimes do that as well.

Are there any limits to how small of a wav file can be converted? Many of these are 10-30 seconds long.



This must be quite a dramatic, if not traumatic, experience for a user converting files for the first time. It doesn't have to be this complicated. Honestly!

The fact you end up converting "some other file" makes me wonder if you might be running Lame via it's line command interface and getting the source file name muddled. Have you tried using one of the front end GUIs which are available? They will make it much easier to set paramaters and will provide some advice on what the parameters do.

The small file size you are using should be no problem.

As other posters have said, the file needs to be the PCM type of WAV file. I am not clear what your audio file "database" is but perhaps it contains files which have been compressed to a half or a fourth of their original size using "AD" techniques and stored in a format called ADPCM which is then given a WAV wrapper.

Incidentally, there are two common variants of ADPCM: one by Microsoft called MS-ADPCM and one by the IMA called IMA-ADPCM.

Personally, if I had an ADPCM-WAV file I might be inclined to get a different encoder than the esteemed Lame and use that to convert the ADPCM-WAV file direct to MP3. This might be better than taking the file from ADPCM-WAV back to PCM-WAV and then to MP3.

Luckily my first attempts at file conversion all those years ago never got snarled up in discussions about ADPCM! smile.gif Heh! I hope you don't get snarled up in it either.

Moonshot
dv1989
QUOTE
Personally, if I had an ADPCM-WAV file I might be inclined to get a different encoder than the esteemed Lame and use that to convert the ADPCM-WAV file direct to MP3. This might be better than taking the file from ADPCM-WAV back to PCM-WAV and then to MP3.

Why is that?
Fandango
What's the big problem here... just pipe the WAV through sox and then to lame.

Shane N is on Unix using the shell so using sox is the best way.
Mike Giacomelli
QUOTE(moonshot @ Dec 16 2006, 05:31) *



Personally, if I had an ADPCM-WAV file I might be inclined to get a different encoder than the esteemed Lame and use that to convert the ADPCM-WAV file direct to MP3. This might be better than taking the file from ADPCM-WAV back to PCM-WAV and then to MP3.

Luckily my first attempts at file conversion all those years ago never got snarled up in discussions about ADPCM! smile.gif Heh! I hope you don't get snarled up in it either.




Since ADPCM is just PCM with the sample amplitude stored as the integer difference between the present and next sample, I think conversion should be lossless. You'd just have to chose a bit depth thats large enough so that all the samples map into it without clipping. 16 bit is probably enough.
moonshot
QUOTE(Mike Giacomelli @ Dec 16 2006, 16:20) *

QUOTE(moonshot @ Dec 16 2006, 05:31) *



Personally, if I had an ADPCM-WAV file I might be inclined to get a different encoder than the esteemed Lame and use that to convert the ADPCM-WAV file direct to MP3. This might be better than taking the file from ADPCM-WAV back to PCM-WAV and then to MP3.

Luckily my first attempts at file conversion all those years ago never got snarled up in discussions about ADPCM! smile.gif Heh! I hope you don't get snarled up in it either.




Since ADPCM is just PCM with the sample amplitude stored as the integer difference between the present and next sample, I think conversion should be lossless. You'd just have to chose a bit depth thats large enough so that all the samples map into it without clipping. 16 bit is probably enough.


ADPCM may be close to lossless but it is not quite lossless. Here are just two out of many threads on this site which have discussed this.

ADPCM vs PCM -> how lossy?
http://www.hydrogenaudio.org/forums/index.php?showtopic=1098

Is ADPCM lossless compression?
http://www.hydrogenaudio.org/forums/lofive...php/t27453.html

Moonshot
dv1989
I still don't see why you question the use of LAME. Will ADPCM's sample mapping put the output audio out of the 16-bit range? Even then, LAME supports 24-bit audio without a problem.
Shane N
From the developer who designed the application that populates the database:
uLaw - encoding
8 bits - sample size
8khz - sample rate

I am using a Flash application to play the newly created MP3's in a website application. I was able to get it to the point where I could create MP3's, but they all only work in mozilla browsers. Only half or so work in IE. It is really odd.



EDIT - FIXED!
For future reference for anyone who experiences abnormal playback speeds via flash, the issue I was experiencing is that the flash player only accepts MP3's with 3 different sample rates. Using 44.1Khz, I was able to get this working.

Add "--resample 44.1" to the end of your lame command to fix this.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.