Performance Considerations

The average consumer machine of today is much more efficient than it was a few years ago, and most people have gobs of underutilized computing horsepower to spare. Nevertheless, there are still plenty of older machines hanging around out there, and owners of those machines will want to make sure they’ve got the most efficient decoder available. And, of course, true geeks will want access to the most efficient decoder whether they need it or not. Here are a few techniques you can use to determine the efficiency of your MP3 player. The same techniques apply to MP3 encoders, by the way.

Benchmarking Decoders

As mentioned in Chapter 2, MP3 decoders have a lot less work to do than encoders, since the task of MP3 playback is far less CPU-intensive than encoding. All the decoder has to know is how MP3 files are structured, and how to reconstruct a coherent signal from the combination of audio data and “side information” stored in the files’ frames. In days of yore, when a Pentium 90 was considered top-of-the-line and most people were using 486-based computers, playing MP3 files was proportionally intensive enough to be cause for concern, and many experienced a significant impact on system responsiveness when MP3s were playing in the background.

However, modern CPUs have so much processor bandwidth to spare that decode speed isn’t much of an issue for most users. For example, playing an MP3 stream on a Pentium 233 with the average decoder for Windows will generally consume only 5% of your processor speed.

If you’re experiencing a noticeable performance impact when playing MP3 files, you might want to do a little benchmarking of your own. CPU/resource monitors are available for most operating systems, either as part of the system itself or as a separate download. A few of the more popular options are listed in this section. If you can’t find a CPU monitoring app for your system that breaks up CPU usage by task (as opposed to giving you an overall rate), just note CPU consumption with and without your MP3 decoder running, then calculate the difference.

Once you’ve got a resource meter up and running, try several different MP3 players and take note of how many system resources (CPU and memory) they consume. Keep in mind, however, that even if a particular MP3 player consumes less resources than another, it may do so at the expense of sound quality or important features. You’ll have to establish your own criteria for the compromises you’re willing to make.

Windows 95/98

Windows 95/98 both ship with a resource meter bundled in the system. If C:\WINDOWS\SYSMON.EXE is present on your system, you’re all set. You may find a shortcut for Sysmon pre-installed in Start Programs Accessories System Tools. If not, go to Control Panel Add/Remove Programs Windows Setup Accessories and add it. Sysmon’s default display shows the percentage of total CPU available being consumed by all currently running tasks, but does not tell you exactly how many resources are in use by each individual process. The large spikes in Figure 4.11 occurred when launching applications, and resulted in WinAmp skipping. The flat areas represent straight MP3 playback. Several other applications were open, but no work was being done. Sysmon reports approximately 15% processor consumption, but gives no indication of exactly how much of this is being consumed by MP3 playback. For a more specific breakdown or resource consumption, download Microsoft’s "Kernel Toys,” right-click top.inf, choose Install, then click Start Run, and type wintop.

Using Sysmon to track CPU resource consumption as various tasks are performed

Figure 4-11. Using Sysmon to track CPU resource consumption as various tasks are performed

Popular third-party resource meters for Windows include L-Ement and sysmeter, both downloadable from http://www.skinz.org.

Windows NT

Windows NT 4.0 has a similar performance monitor built into the operating system. To access it, tap Ctrl+Alt+Del, click Task Manager, and select the Performance tab. Alternatively, use Start Programs Admin Tools Performance Monitor.

Mac OS

Search your favorite Mac software library for a utility called Process Watcher by Hugues Marty, which will allow you to view information on all currently running processes. However, Process Watcher will not show you a breakdown of CPU activity per application, so its ultimate usefulness is somewhat limited. You’ll find a copy at http://perso.magic.fr/suli/pw.html if you want to check it out. Users may also want to experiment with Process Monitor or Process Spy, though this utility suffers the same limitation.

Linux

There are dozens of options for Linux users. Typing top at any prompt will give you a detailed overview of resource consumption, broken down by process. By default, top will update its report once per second, which may be too rapid to study properly. If you want a better view, use:

top -d 5

to have top update itself every five seconds. The problem with top is that it isn’t always easy to figure out exactly how much CPU a given application is consuming, because many apps do their work in worker threads that may be difficult to identify. Fortunately, you can launch an app through the “time” utility. The operating system will calculate the total time the app was running and report the total number of seconds of processor time consumed in system space and in user space. From that, calculating the percentage of available CPU consumed by that app time’s syntax is pretty simple:

time /path/to/mp3player /path/to/Song.mp3

As soon as mp3player finishes playing the song, close it and you’ll get a report like this:

real  1m42.708s
 user  0m9.427s
 sys   0m1.769s

To calculate CPU usage, use this formula:

(user + sys)*100 / real = percentage of available CPU time

In this example, the player in question is consuming around 10.9% of available CPU resources. Note that these figure will be slightly off because launching the app will consume extra CPU time, but it gives you a pretty good idea of what’s going on. There are dozens of alternative resource monitors available for Linux. Search your favorite software archive for GUI resource meters such as xosview.

BeOS

In addition to the Pulse application built into the system (which shows CPU load indicators for each detected processor), there are quite a few third-party tools available, downloadable from http://www.be.com/beware/, such as the graphical process controllers TManager and ProcessWatcher. The “top” and "time” utilities described for Linux are also available for BeOS, and function identically.

System Requirements

A few MP3-related hardware issues were covered in Chapter 2. To summarize and put it all in one place, here are the most important things you need to consider when contemplating hardware upgrades for your MP3 playback machine.

CPU speed

While you can theoretically use a 486 for MP3 playback, the experience is likely to be painful, as even the comparatively low-resource act of decoding MP3 is going to consume a good deal of horsepower that you’ll probably want to give to the operating system itself. Trouble-free MP3 playback really demands a Pentium-class computer or better, where processor consumption may be around 5-10%, rather than 50-75%. Mac users, similar deal: Anything slower than a PowerMac or PowerMac clone is going to give you problems with MP3 playback, if you can even find an MP3 player that works on your machine at all.

Encoding is another matter altogether. Because encoding requires so much math, you’ll be happiest with the fastest machine you can get your hands on. While fast encoders running on a modern Pentium can encode a song faster than it would take to play it back, you’ll hear absolute horror stories from users who try to do their encoding on an antique machine. An old 386, for example, may take 12 hours or more to encode a single 3-minute song.

Memory

MP3 encoders and players aren’t huge memory hogs, but they do require more memory than, say, a simple text editor. The process of encoding will benefit more from extra RAM than will playback, but unless you already feel your memory subsystem could use a shot in the arm, don’t go running out to buy more memory just to improve the MP3 experience. At the most, getting into MP3 probably means you’ll be running one additional application in the background most of the time, and a relatively lightweight application at that.

Sound cards and speakers

Again, this is a critical area. Most people have traditionally thought of their sound cards as a vehicle for games, or for listening to streamed news broadcasts. But as you get more involved in MP3, you’ll start to think of your computer as a cousin of your home stereo in some ways, and will want to get the best quality you can. Do some research online to find out what the audiophiles are recommending this month as the best-sounding card at an affordable price. In the sub-$100 range, top cards from CreativeLabs and Yamaha were among the most popular cards among MP3 buffs at this writing.

Chances are, the speakers that came with your computer aren’t of the best quality. Again, look around online for recommendations. Get yourself a nice set of powered subwoofer/satellites, connect them to your new sound card, and be prepared to be blown away by the difference they make over the default audio hardware that probably shipped with your computer, as shown in Figure 4.12. Because the system has a built-in amplifier and runs on standard wall power, you don’t need to rely on the amplifier built into your sound card. If you’re going speaker shopping for your computer, you’ll get better results by going to an audio store and telling them you want speakers for use with your computer than by going to a computer store and telling them you want high-quality computer speakers.

Of course, you can always route audio signal from your computer directly to your home stereo by purchasing a length of RCA cables and a simple adapter. See Chapter 6 for details.

Mid-range and high frequencies are handled by satellite speakers

Figure 4-12. Mid-range and high frequencies are handled by satellite speakers

Disk speed and space

People sometimes wonder whether their hard drive is fast enough for good MP3 playback, or contemplate going with a high-end SCSI adapter/disk to optimize their systems for MP3 use. For the most part, this is piffle. At the default bitrate of 128kbps, a mere 16 K is being scooped from disk every second—even the lowly floppy drive can keep up with that. All of the work is going on in the CPU. The fact that MP3s are so highly compressed not only means you save on disk space, but that the hard drive has to do very little work.

However, there are some caveats to this point. If your all-IDE system has more than one hard drive and one CD-ROM drive, you’ll end up putting two devices on a single channel with IDE. But IDE, unlike SCSI, cannot transfer data back and forth between two devices on the same bus or channel simultaneously—IDE accesses are serial. Therefore, you can end up with your MP3 player requesting data from a storage volume while the operating system is requesting data from the boot volume simultaneously, which can potentially lead to skips or pops in the audio stream. But IDE disks are so much more affordable than SCSI that most users in this position will simply have to deal with it. If you need to run several IDE devices and want to ensure optimum performance, you might want to consider purchasing inexpensive IDE controller cards for the additional drives, so that each one gets a channel all to itself.

Note also that IDE disks are more CPU-intensive than SCSI disks, which can have an impact on low-performance systems. If you have UDMA IDE drives, make sure they’re running in UDMA mode to lessen the processing impact on the CPU.

Once you start on the task of encoding your entire collection, or downloading lots of tracks from the Internet, you’ll likely find disk space being chewed up faster than you ever dreamed possible. Suddenly those 30 GB drives on sale down at the local computer superstore don’t seem obscenely huge after all. Of course, it won’t be long before you’re looking for some kind of external storage solution, and most people start burning data CDs full of MP3 files to deal with the space issue. See Chapter 5 for more on that.

Note

When playing MP3 files from CD rather than from your hard drive, you may experience skipping, or “halting” playback, especially if you’re using an older or cheapo CD-ROM drive. This is probably not happening because the CD-ROM drive isn’t fast enough, but because it isn’t accurate enough and has to do a lot of error correction to grab data accurately. You may be able to correct for this by increasing the “buffer” or “preload” size in your MP3 player. Dig around in the options and look for a control that will let you establish the size of the “preload” or “buffer” size, and turn it up until the problem goes away. By doing this, you’re telling your MP3 player to read data from disk in larger “gulps,” which gives the drive more time to retrieve data from CD successfully before the amount of music stored in RAM is exhausted.

Sound/video card interactions

One of the most frequently encountered hardware-related problems users find is that even very fast machines can “skip” or “pop” MP3s when switching tasks, scrolling windows, or doing other things that require a lot of screen redraw. This typically occurs for users with PCI graphics cards, because some card manufacturers have attempted to increase card performance by letting video cards take control of the entire PCI bus when necessary, which can prevent an even stream of audio data from reaching a PCI sound card at an adequate rate. Many people have noted that this does not occur with AGP graphics cards or ISA sound cards (since they’re on a separate bus), which you may want to keep in mind when shopping for new hardware. If your audio and video cards are both on the same bus, you may be able to tweak some of the video card’s driver or BIOS settings to disable or lessen this effect, though possibly at the expense of some graphics performance.

Get MP3: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.