3 Tips to improve the CPU usage of Qmmp music player


In the GTK+ world, we have many lightweight music players, such as Audacious. While migrating to Qt, some people might want a Qt-based alternative for use in LXDE-Qt. Fortunately, we have Qmmp. Here are screenshots from their website. They provides the old-school WinAmp-like skins, or you can install the qmmp-plugin-pack to get the foobar2000-like simple UI.

Winamp like UI
Winamp like UI
Foobar like simple UI
Foobar like simple UI

The music player looks very suitable for LXDE-Qt, but it has some known problems, one of which is higher CPU usage then similar music players (mainly Audacious). To improve that, I spent two days hacking and found some potential solutions so I share them here.

  1. Install qmmp-plugin-pack and use mpg123 plugin for playing mp3 files instead of the default libmad plugin. Mpg123 is highly optimized  and can use CPU features when available, such as SIMD. This can be changed in the preferences dialog. Just turn off the libmad plugin and turn on the mpg123 one. This greatly reduced the CPU usage while playing mp3 files. Qmmp by default give libmad higher priority, so you have to turn off libmad. Otherwise mpg123 won’t be used.
  2. Apply these 2 patches I created and recompile qmmp from source. The subversion r4265 code of qmmp should be used. Detailed information about the bugs they fixed is in the bug report 685. I already send the patches to the upstream, but they’re not yet applied. I post them here so other qmmp users can try them.
  3. Turn off the visualizer (spectrum visualizer) if you’re using the simple UI (the second screenshot above). It’s the main cause of high CPU usage.  Turning it off can decrease CPU usage to some degree. With the second patch I provided, you can get rid of the CPU usage completely when the visualizer is off.

If you love qmmp, try to see if the solutions provided here solve your problems.

Cheerrs!


4 responses to “3 Tips to improve the CPU usage of Qmmp music player”

  1. Nice work!
    It is true there are not so many nice and updated Qt music players.

    But there is Cantanta, which supports Qt4 and Qt5, utilizes an internal db of MPD (or can also work with an external daemon) which requires no configuration.

  2. Does this means one has to go only with Qt apps for the upcomming LXDE-Qt? Ihmo, while the LXDE and PCManFm and a few of LXDE apps can be in Qt, there is no reason not to use GTK apps when they are better. The desktop and the apps used it in should be two different things.

  3. No, you can use whatever app with whatever toolkit you want. Some people, however, prefer not to mix apps with different toolkits. For them, qmmp is a good alternative to audacious.