WWW FAQs: How do I convert my music to MP3 format?

2007-03-27: In the article how do I embed sound and music in a page, I explain how to play MP3-format music as part of your website. But how do you convert music to the MP3 format in the first place? What if your music is in WAV files, Windows Media format (often found in files with a .wma extension), QuickTime or another Apple format such as the AAC format used by iTunes? There are several ways to convert your existing audio files to MP3 format. The right solution varies greatly depending on whether you are using a Macintosh, Windows, or Linux system. In this article I'll assume you are using Windows XP (or possibly Vista).

The simplest solution is a little bit time-consuming, but it works with every audio format your computer can play back— if you can listen to it, you can convert it to an MP3. And that's tough to beat.

Does this music belong to you? If you're not legitimately licensed to use the music on your own website, don't. You don't want to be sued! Besides, stealing from musicians is a lousy thing to do.

Owning a CD or an iTunes track does not give you the right to play that music on your website for other people.

In this article I assume you're working with audio files you have a legitimate right to distribute on the web, such as songs recorded by your own band. Or perhaps you are moving songs you legitimately own to a portable MP3 music player.

If you want to play songs you don't own on your website, check out the article how do I start my own Internet radio station?

Re-Recording Your Audio Output: The "Stereo Mix" Solution

How can you convert the audio that is coming out of your computer back into input? You're probably imagining a cable from your headphone jack to your microphone jack! Relax, you don't have to do anything so ugly or low in quality. We can simulate it with the "Stereo Mix" recording feature of Microsoft Windows. It's a bit tricky to find, but follow my steps carefully and you'll have no trouble!
The techniques in this article work for all audio formats. But if you are working with professional-quality recordings made with software like Cakewalk Pro, you probably already have easier, more powerful built-in tools available to you for converting file formats. Check out the documentation of your audio production software before doing it the hard (but universal!) way.

Ready? Here's how to turn your audio output into your audio input:

1. Click "Start"

2. Click "Control Panel"

3. Double-click "Sounds and Audio Devices"

4. The "Sounds and Audio Devices Properties" window appears

5. Click on the "Audio" tab

6. Locate the "Sound playback" area

7. Click on the "Volume..." button in the "Sound playback" area (NOT "Sound recording")

8. The "Volume Control" window appears

9. Pull down the "Options" menu

10. Pick "Properties"

11. Locate the "Adjust volume for" area

12. Click on the "Recording" radio button

13. Click "OK." The "Recording Control" window appears

14. Locate "Stereo Mix" (usually on the left)

"What if I don't have a 'Recording' radio button, or 'Stereo Mix' is not listed as a volume control?"

Some audio devices don't support this technique. However, you may have more than one audio device. In the "Sounds and Audio Devices" window, try changing the "Default device" pulldown menu to a different device. Make sure that device is chosen for both input and output. Then try again, beginning with step 7 above, until you find a device that works.

If your computer has no audio devices that support recording from the stereo mix, you'll have to go the truly analog route: hook up a 1/8" stereo audio cable from your output jack to your input jack, or the input jack of another computer!

15. Check the "Select" box beneath "Stereo Mix"

16. Raise the "Volume" slider for "Stereo Mix" about three-quarters of the way to the top

17. Click the "X" to close the "Recording Control" window

18. Click the "X" to close the "Volume Control" window

19. Click "OK" to close the "Sound and Audio Devices Properties" window.

Phew! Did you follow all that? Great— your computer is set up to record what it plays back.

"How do I undo this so I can record normally again?"

If you want to record from a microphone or other device, you'll need to undo your changes. To do that, just follow the same steps, except that in steps #15 and #16 you should select the "Microphone" option instead of the "Stereo Mix" option. That will restore your computer's normal recording settings.

But what will you use to do the recording? And how will you convert the results to MP3 format? To finish the job, you'll need audio conversion software. There are many audio editors out there, but when an excellent, free, open-source program can do the job, why look any further? That's why I recommend Audacity.

Converting Your Songs With Audacity

Audacity is a simple, friendly audio recording and editing program. Although it is mainly intended as a musician's recording tool, it's also a fine choice for our purposes. You can easily obtain Audacity for Windows by visiting the Audacity for Windows download page and carefully following the instructions there to download and install the software on your computer.

There's one big catch with Audacity: for legal reasons, the filter that converts other formats to MP3 is not included "in the box." Are we stuck? Of course not! We just have to visit a separate website to pick up the MP3 filter, lame_enc.dll.

Audacity's how do I download and install the LAME MP3 encoder? page explains in detail how to take care of this step. Read it and follow the directions carefully.

Do you have Audacity and its MP3 encoder installed at this point? Great! You're ready to move on to "recording" and converting your audio files. Just follow these steps to convert your first song!

1. If you have not already followed the steps above to set up your computer to record its own output, do so now.

2. Launch the Audacity software.

3. Click on the round red "Record" button. Audacity will begin recording.

Without closing Audacity, start playing the song you want to convert in your preferred music player software. It doesn't matter what software you use, play the song the way you normally play it.

4. When the song has finished playing, go back to the Audacity window. Audacity should still be recording. Click the square yellow "stop" button.

5. Right now there's some "dead air" at the beginning and end of your track. You can clean that up now if you wish. Use the scrollbar in Audacity to locate the silent sections at the beginning and end of the song. Select those areas with the mouse, then pick "cut" from the "Edit" menu to remove them. If you make a mistake, just select "Undo" from the "Edit" menu.

6. Click "Play" to listen to what was recorded. If the sound is distorted, your recording level was too high. You can fix that by returning to the Windows "Recording Level" window we used earlier and lowering the volume slider for "Stereo Mix." Then select "Undo" in Audacity to undo the recording, and start a new recording. (If you don't undo the old recording, you'll record a second track of audio, like a second instrument in a song. This is not what you want.)

7. When you are satisfied with the sound, pull down the "File" menu and select "Export as MP3..."

8. If you have not already done so, you will be prompted to locate the lame_enc.dll file. If you have not yet downloaded the MP3 filter for Audacity, visit the how do I download and install the LAME MP3 encoder? page and follow its instructions carefully.

9. In the "Save MP3 File As" box, enter a name for your MP3 file. You don't have to type the .mp3 extension at the end.

10. The "Edit the ID3 tags for the MP3 file" window appears. ID3 tags contain information such as the title, album title, and artist's name. Enter as much information about the song as you wish. I recommend you select the "ID3v1" radio button, because more players understand that type of ID3 tag. When you're done, click "OK."

"Why does my MP3 file sound like a chipmunk in Flash player?"

The instructions in this article will work great if you don't try to change the MP3 bitrate from the default of 128kbps. If you do lower the bitrate, Audacity will create MP3 files that Flash player doesn't handle very well. That's because Audacity allows LAME to encode them with a "sample rate" that Flash Player doesn't support. If you really want to use low-bitrate MP3s (hopefully for voice, not high-quality music), you can export your file as a WAV file instead of an MP3 and run LAME manually at the command line. For more information and complete details on the solution, see why do my MP3 files sound bad in Flash Player?

When you click "OK," Audacity will convert your song to the MP3 format and save it to the filename you specified. This can take a little time if the recording is a long one.

When you're finished, you have a .mp3 file that is compatible with the XSPF Flash Music Player and other MP3-based software. For more information on what you can do with MP3 files on your website, see the article how do I embed sound and music in a page?

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!