A little progress: Audio on low speed CPUs

I made a little progress today, with the problem of console music players at very low processor speeds. The house favorite, moc, has a tendency to stutter on machines slower than about 200Mhz (that might vary from machine to machine and distro to distro) with standard-quality sound files.

By all means it should be possible to play mp3 or ogg files on machines far slower than 150Mhz, but for whatever reason, the machine slows to a sputtering crawl, CPU use sits solidly at 100 percent, sound quality drops to a hideous level and the entire experience is an unqualified failure.

Today, during a brief break, I rebuilt moc 2.5.0-alpha4 to remove absolutely everything I don’t use — unwanted codecs, unneeded support flags, you name it — and leaving only things I knew I would need for either my own 100-percent ogg collection, or streaming music channels.

I think it made a difference. There is still a measure of stuttering on startup, and when a new file is started (which I assume is lag caused by some kind of caching process).

But that stutter only lasts a half a second or a little more on 44Khz VBR ogg files, which is a vast improvement over the continual chirping I was getting with the default configuration of moc 2.4.4 for Crux.

It’s still not perfect — CPU use is still in the 85-100 percent range, any interaction with the machine causes a skip or two, and outside interference (like the normal power off for the screen) also causes a hiccup.

But it seems to recover much more quickly, I don’t have to drop out of the interface to listen to a song, and it’s relatively usable. And listenable, if that’s a word. :)

For the record, this is the Pkgfile I used to do this; if you’re also a Cruxian you could give this a try. Arch users could also adjust this to their liking. Note that this pulls libsndfile and adds flac — those are personal preferences.

# Description: Console audio player.
# URL: http://moc.daper.net/
# Maintainer: 
# Packager: 
# Depends on: curl flac libvorbis libid3tag libmad
 

name=moc
version=2.5.0-alpha4
release=1
source=(ftp://ftp.daper.net/pub/soft/$name/unstable/$name-$version.tar.bz2)

build() {
	cd $name-$version

	./configure \
	--prefix=/usr \
	--mandir=/usr/man \
	--with-alsa \
	--with-curl \
	--with-flac \
	--with-mp3 \
	--with-ncurses \
	--with-vorbis \
	--without-aac \
	--without-ffmpeg \
	--without-jack \
	--without-modplug \
	--without-musepack \
	--without-ncursesw \
	--without-oss \
	--without-rcc \
	--without-samplerate \
	--without-sidplay2 \
	--without-sndfile \
	--without-speex	\
	--without-timidity \
	--without-wavpack \
	--disable-nls \
	--disable-debug

	make
	make DESTDIR=$PKG install
	install -D -m 0644 -t $PKG/usr/share/moc/ config.example keymap.example 
	rm -rf $PKG/usr/share/doc
}

Let me know if you have better luck, or if you can trim back the player itself any further. In the mean time, I’ll be trying to force the BIOS power management to stop interrupting my music when the system is on battery. :)

About these ads

12 Responses to “A little progress: Audio on low speed CPUs”


  1. 1 mulenmar 2010/08/20 at 9:51 PM

    I’ve had no chance to try this myself, but I’ve read that ALSA itself can cause the stuttering problem. Perhaps you should try OSS4?

  2. 3 Patrick 2010/08/21 at 2:23 AM

    You can also try compiling the relevant applications and libraries with -Os and -ffast-math. That should help a bit.

    • 4 K.Mandla 2010/08/21 at 6:36 AM

      I’ve tried those flags in the past with different applications, and you’re right, I should try them again.

      Sometimes ffast-math left me with broken applications or libraries though. I usually use -Os on machines with little memory.

  3. 5 anon 2010/08/21 at 4:10 AM

    Just an app suggestion, but you should try out rhapsody. It’s one of the few console irc clients I can stomach, because mainly of it’s gui-ish UI.

    site’s at http://rhapsody.sourceforge.net/index.html – compile from source.

  4. 6 Gavin 2010/08/21 at 8:26 AM

    Have you tried the FLAC music format?

    I have all my CD rips in FLAC and high quality MP3. My server (Pentium 133MHz running Debian stable with a Soundblaster AWE64 ISA card) is able to play back my FLAC files using about 30-40% CPU usage. Playing an MP3 generally has the CPU at 100% usage. I use MOC as my music player.

    I realise FLAC files are a lot larger but if its stutter free playback old older hardware you want then you may have to change format. Of course being lossless FLAC files are also higher quality than MP3s :)

    I have a large hard drive (1TB) in my Pentium machine so disk space isn’t a problem (for now) but perhaps this isn’t an option for you.

    Something to consider though.

  5. 8 Anon 2010/08/22 at 6:16 PM

    Have you tried the more optimized decoders?

    mpg123 for mp3s, mplayer for anything else?

    • 9 K.Mandla 2010/08/22 at 7:16 PM

      Not … really. I’ve tried different frontends that employ different decoders, but results have usually been the same. I am thinking about recasting some of the music I listen to most as lower quality, or switching codecs. At this point, it’s either that or swap ALSA for OSS. Anything could work. …

  6. 10 Luca 2010/08/23 at 5:55 AM

    Ogg Vorbis got quite a bit of slack when it first became popular due to the higher CPU usage compared to MP3s. The default libvorbis decoder uses floating point math quite intensively, which on older machines can be slow. There is an alternative called libvorbisidec which uses integer only math, it appears to be quite popular with embedded systems:

    http://www.nslu2-linux.org/wiki/HowTo/BuildMpd

  7. 11 ojm 2010/08/24 at 2:32 AM

    How about running it with nice?

    • 12 K.Mandla 2010/08/24 at 5:21 AM

      I’ve tried using nice in the past, but it didn’t seem to make too much difference. My meager understanding of nice, coupled with my meager understanding of the problem, suggests that playing tunes is overwhelming even the nice-ing option. But I am not opposed to trying again. …


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,959,559 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: