I am using Audacity 2.0.4 on Windows 7. I have over a thousand mp3 files that I need to be able to stream down to my new iPhone app. I found that 95% of these files will not stream successfully, though they play just fine in browsers and on the desktop. I found through lots of experimentation that if I simply open any of the “bad” files in Audacity, then export and overwrite (without changing anything), it fixes the file, and I get successful streaming after that. The fix is great, but it’s not really a solution because I shudder at the fact of manually opening 1,300 mp3 files in audacity, then saving.
Is there any way to automate this? I don’t think audacity has a cmd-line option or a batch-process option. Is there?
If not, any easy way to automate this? Any other non-Audacity ideas that would be quick and somewhat automated? I’m a programmer so I can write scripts, programs, whatever I need to. Thanks.
So what is the difference? 128 kbps? CBR? 44100 Hz sample rate? Images or lyrics in the files? Something weird in the header?
If you found the reason you could use SoX at the command-line to make the change. If it wasn’t a bit rate or sample rate problem you could possibly use a direct MP3 editor like mp3DirectCut in batch mode. Using a direct MP3 editor would avoid the quality loss of re-encoding the files.
If you are forced to re-encode the files, you can use Chains in Audacity. This will be slower than SoX because Audacity must first decode each file to PCM then draw the waveform.
Also you may find that Chains chokes on doing 1000 files at once especially if the file names are long. I think it is because a character limit in the file name box is exceeded.
Chains are rather neglected, so patches are welcome to improve it. Please see Submitting Patches.
Thank you for your detailed reply. I installed the latest version of Audacity (2.0.6). I tried what you suggested using Chains but it didn’t do anything. And after running files through it:
1- The files were not fixed, same problem as before.
2- The Last Modified Date of the files remained unchanged.
When I manually opened these files in Audacity, did nothing, just exported back to mp3…fixed every time! This Chains approach looks awesome if I can use it correctly. Here is exactly what I did:
1- Opened Audacity
2- Click File → Apply Chain
3- Chose the default/only option (MP3 Conversion) – Note: What this does seems like it’s what I need but I have no idea if I should use something else.
4- Click “Apply to Files” button
5- Selected some files and clicked the Open button
6- The files seemed to quickly open, flash, and close. That looks promising.
But the files weren’t fixed and the datestamps weren’t changed.
Gale: What type of Chain commands should I use so that it simply does a new export of the file and saves over the original? Why does the Export command not do the same thing as manually opening and exporting an mp3?
The first thing to do is to find out why some of the files don’t work. If we know what we are trying to fix I expect there will be an easy solution. So, as Gale asked, what is the difference between the ones that work and the ones that don’t?
I don’t know mp3 file structures well enough, or even the tools used, to be able to answer the question. But here’s a “bad” file, and a good file that streams down and plays correctly in an iphone app. You’ll notice that even the “bad” file plays fine in a browser, and you can download it and play it locally with no problems. There has to be something in the bad file that chokes the streaming.
The “good” file is “CBR” (constant bit rate) and the bad file is “VBR” (variable bit rate).
To check if this is the defining issue, try exporting from Audacity as VBR and you should find that the resulting file does not stream down to my new iPhone app.
By default Audacity uses 128 kbps CBR. To change that to VBR, go through the normal exporting procedure, then when in the export dialog screen, click on the “Options” button and select VBR. Then complete the Export and test the exported file.
See Audacity Manual. There is no ability to overwrite the original. The changed files are in a “cleaned” folder in the same folder the files came from.
The ExportMP3 command in the Chain uses the same export parameters as standard MP3 export, so you need to set those parameters first in the MP3 Export Options before running the Chain.
Gale: I missed the fact that there was a “cleaned” folder created and the files get put in there. Thanks for the tip.
All: This Chain approach seemed to work for some files, but not others. In fact, the files it didn’t fix couldn’t even be fixed by what I thought was my bulletproof fallback: manually export the file in Audacity. Here’s an example of a file that seems unfixable for iphone streaming:
And for reference/baseline purposes, here’s one of my original mp3s that I didn’t have to touch with Audacity, yet it worked fine from the beginning. And it’s 22050 Hz: http://www.zerogravpro.com/temp/good_22050.mp3
Steve: I think you cracked the code. I took the “unfixable” file and made it bigger by doubling the track in audacity. Now it streams perfectly in iphone. It never crossed my mind that iphone demands mp3 files of a certain size before streaming will work. At least that’s how it appears.
Any idea how to (in some automated way) make mp3 files larger without adding junk? Anyway, that is a much smaller problem. Thanks so much for your analysis and help with this.