Skip to contentSkip to conversation

playing MP3 vs CPU usage

DISCUSSION Yau Chan 3 participants 4 messages Aug 27, 1999 – Aug 28, 1999 Sound

lore
Share & tools
lore

Yau Chan

author
#0 lore raw

Hi. I'm a beginner in Linux.
I just set up my new sound card and it plays very good when I'm plaything something alone. But when I'm playing a song in a terminal, and tryig to do something else. like switching to another terminal on the Desktop, the song will stall for a very very short bit. i tried to keep track of the CPU usage. when it's playing the song alone, it's using about 20%. But whenever i try to do something else, it just jump to full for a short instance. I wonder if there is any way that I can modify it so that it will be more smooth when i'm playing song and do other things. Thanks.

I'm using a very slow computer, which is a Pentium 133. But I don't have such problem in windows95 and windows NT. So, I guess linux should do better. Thank you very much.

Ben.
([email protected])

#1 lore raw
Quoted 12 lines · Yau Chan

Hi. I'm a beginner in Linux.
I just set up my new sound card and it plays very good when I'm plaything something alone. But when I'm playing a song in a terminal, and tryig to do something else. like switching to another terminal on the Desktop, the song will stall for a very very short bit. i tried to keep track of the CPU usage. when it's playing the song alone, it's using about 20%. But whenever i try to do something else, it just jump to full for a short instance. I wonder if there is any way that I can modify it so that it will be more smooth when i'm playing song and do other things. Thanks.

Quoted 4 lines

I'm using a very slow computer, which is a Pentium 133. But I don't have such problem in windows95 and windows NT. So, I guess linux should do better. Thank you very much.

Linux actually has some problems in this area, especially on slow computers. The trick is to increase audio buffers of your mp3 player (what player are you using ?),
plus tuning your EIDE disk with
hdparm -d 1 -u 1 -m 8 -c 1 /dev/hda
because when there are disk accesses, the kernel stalls sometimes, especially when you run non-DMAed disks
most distros don't tune your disk properly.

Perhaps if your player supports realtime-scheduling , your could try to run it as root to see if things get better.

The P133 is easily capable of playing an MP3 , the problem is mainly buffering and process scheduling. ( already solved in some unofficial patches, let's see if they can get into the mainstream kernel :-) )

regards,
Benno.

author
#2 lore raw
In reply to Yau Chan
Quoted 4 lines · Benno Senoner

Linux actually has some problems in this area, especially on slow computers. The trick is to increase audio buffers of your mp3 player (what player are you using ?),

I'm using mpg123 to play it.
How can I increase the audio buffer of it?

Quoted 5 lines

plus tuning your EIDE disk with
hdparm -d 1 -u 1 -m 8 -c 1 /dev/hda
because when there are disk accesses, the kernel stalls sometimes, especially when you run non-DMAed disks
most distros don't tune your disk properly.

what does that command do? I'm use an EIDE non-DMAed harddisk. does that line of command tune all kind of disks? Does the size of disk matter?

So many questions. =P Thanks for helping me.

Ben.
([email protected])

#3 lore raw
In reply to Yau Chan
Quoted 12 lines · Benno Senoner
Quoted 4 lines

Linux actually has some problems in this area, especially on slow computers. The trick is to increase audio buffers of your mp3 player (what player are you using ?),

I'm using mpg123 to play it.
How can I increase the audio buffer of it?

mpg123 -b 1000 mp3file

should help

( In 1-2 days I will post the URL to mingo's patch ( for kernel 2.2.10) ), this will help even on the crappiest hardware.

Quoted 10 lines
Quoted 6 lines

plus tuning your EIDE disk with
hdparm -d 1 -u 1 -m 8 -c 1 /dev/hda
because when there are disk accesses, the kernel stalls sometimes, especially when you run non-DMAed disks
most distros don't tune your disk properly.

what does that command do? I'm use an EIDE non-DMAed harddisk. does that line of command tune all kind of disks? Does the size of disk matter?

this command turns on all useful EIDE options, like -d 1 = DMA on
-u 1 = unmask irqs during disk writes
-c 1 = enable 32 bit access
-m 8 = enable multicount disk transfers

even if DMA is not supported the other options are still useful, just give the commandline as is, unsupported options will be ignored by hdparm (ie turning on DMA on a non DMAed disk)

Disk size does not matter.

Quoted 3 lines

So many questions. =P Thanks for helping me.

No prob.
:-)

regards,
Benno.