shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

moc (music on console) 100% cpu

Tue Dec 04, 2012 4:43 pm

Hi,

I'm new to the Raspberry Pi. I just installed everything I need and for playing music, I use moc. It's working propertly (it sounds) but it eats 100% of the cpu. If I play music with omxplayer, the cpu cosume is normal (10-20%). Anyone knows how to solve this issue with moc?

I'm using the last image of raspbian and I installed moc via apt-get.

Thank you,

Pablo

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: moc (music on console) 100% cpu

Tue Dec 04, 2012 4:59 pm

What audio codec are you playing??

Richard S.

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Tue Dec 04, 2012 6:53 pm

I just don't know. I am playing mp3 files. I didn't install anything apart from moc in the latest Raspbian image. How can I find it out?

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Wed Dec 05, 2012 5:09 pm

It happens the same with mp3 or with flac format. I will try to post a message in moc forum...

Thanks.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: moc (music on console) 100% cpu

Wed Dec 05, 2012 5:14 pm

Something is wrong mocp is only consuming 15% of my CPU load and that's when I'm streaming mp3 from digitally imported (di.fm).

Are you using the PI's onboard audio as the default audio device??

Richard S.

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Wed Dec 05, 2012 9:02 pm

Yes, I didn't change anything. I don't have another sound card, just using the raspberry pi audio. It's a raspbian clean install. Just apt-get install moc. It's extrange because I have moc installed in other systems and it works well. I am running 2.5.0-alpha4 version. Maybe I should try with another version to compare.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: moc (music on console) 100% cpu

Thu Dec 06, 2012 3:24 pm

I'm also using the same version of mocp so your CPU load shouldn't be any higher than mine.

Do you have audio enhancements / graphic equaliser enabled??

If you're unsure clear out the .moc folder ( rm -R $home/.moc ) and try mocp again.

Richard S.

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Thu Dec 06, 2012 6:06 pm

I removed moc (sudo apt-get remove moc) and installed again. I also deleted the .moc directory. I have the same problem. I installed another player, cmus, and the cpu use in this one is normal (10-20%). Don't know what to do. I tried to compile the latest beta version but I couldn't do it...

Pablo

User avatar
jpop12
Posts: 3
Joined: Thu Aug 09, 2012 6:47 pm
Location: nashville, tennessee, u.s.

Re: moc (music on console) 100% cpu

Fri Dec 07, 2012 12:20 am

shdgrao-

i am having the exact same problem.
the cpu explodes to 100 percent, regardless
of what file type i am playing. the eq is off.
MOC is my preferred player of choice in Linux-
i have been using it for years.

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Fri Dec 07, 2012 12:07 pm

I have just compiled moc from source code (version 2.4.4 stable) and the problem is just the same. I also tried other players like cmus and the cpu usage is normal (10-20%)

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: moc (music on console) 100% cpu

Sat Dec 08, 2012 5:00 pm

There's nothing wrong with mocp it looks like a buggy driver issue with the on-board audio.
If you switch to using a USB audio dongle like a CM108 the CPU load will go back to it's usual.

http://www.raspberrypi.org/phpBB3/viewt ... 66&t=25054

Richard S.

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Sat Dec 08, 2012 6:08 pm

I really don't know how the driver system works in linux but the strange thing for me is that other players like omxplayer or cmus, don't have this problem. are they using a diferent driver for playing audio?

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: moc (music on console) 100% cpu

Sat Dec 08, 2012 6:28 pm

I'm no expert on Linux drivers either but since I don't experience high CPU loads with other audio device it makes the on-board audio driver a little be suspect.
Perhaps someone like dom could look into this problem mocp was working fine before the upgrade but not after the upgrade.

Richard S.

1984
Posts: 4
Joined: Fri Jan 11, 2013 8:50 pm

Re: moc (music on console) 100% cpu

Fri Jan 11, 2013 8:57 pm

Are there any software workarounds for this problem?

I wrote some piece of software to control moc only by mouse (i don't have a keyboard or display connected). But now it's extremely slow because of moc :(

Please, I need a fix! I love moc!

1984
Posts: 4
Joined: Fri Jan 11, 2013 8:50 pm

Re: moc (music on console) 100% cpu

Sat Jan 19, 2013 2:33 pm

There's a workaround that at least works for me!

Set the option 'Allow24bitOutput' in your '.moc/config' to 'yes'. Normally it should be set to 'no'.

Here's the link to the thread in the moc forum: http://moc.daper.net/node/861

shdgrao
Posts: 8
Joined: Tue Dec 04, 2012 4:38 pm

Re: moc (music on console) 100% cpu

Sun Jan 20, 2013 8:26 pm

It worked perfect.thank you!

User avatar
limewax
Posts: 8
Joined: Fri Jan 04, 2013 8:50 pm
Location: Poland

Re: moc (music on console) 100% cpu

Tue Feb 12, 2013 3:39 pm

1984 wrote: Set the option 'Allow24bitOutput' in your '.moc/config' to 'yes'. Normally it should be set to 'no'.
Thank you Sir ! Works like a charm. Now i've got 7% CPU usage, instead of hundred.

WhiteRaven22
Posts: 14
Joined: Sun Mar 03, 2013 10:03 am

Re: moc (music on console) 100% cpu

Tue Mar 05, 2013 7:48 am

I have the same problem with both the repo version of the program and a compiled version I made from the current stable version on the MOC website. I decided to try MOC because cmus randomly freezes and quits responding and I don't feel like compiling herrie myself, and have found that I like MOC a lot better.

I would love to try the .moc/config solution that is here and on the MOC forum, but there's a small problem. I don't seem to have a config file (at least not in ~/.moc). Is this file located somewhere else or do I need to create it?
No one would say that what they were doing was complicated. It wouldn't even be considered new, except for maybe in the geological sense. They took from their surroundings what was needed and made of it something more. -Primer (2004)

WhiteRaven22
Posts: 14
Joined: Sun Mar 03, 2013 10:03 am

Re: moc (music on console) 100% cpu

Tue Mar 05, 2013 8:45 am

Actually I found the config file example and used that as my .moc/config file. Unfortunately, even after uncommenting Allow24bitOutput and setting its value to yes, MOC still eats over 98% of my cpu whether or not I have the raspberry overclocked. I'm using it to play CD-quality compression level 4 FLACs off of the system SD card. Is there any other settings that may help with this? Also, was anyone else able to get the volume control working?
No one would say that what they were doing was complicated. It wouldn't even be considered new, except for maybe in the geological sense. They took from their surroundings what was needed and made of it something more. -Primer (2004)

1984
Posts: 4
Joined: Fri Jan 11, 2013 8:50 pm

Re: moc (music on console) 100% cpu

Thu Apr 25, 2013 10:02 pm

@WhiteRaven22: Did you solve your problems or at least one of them?
In my case the 100% problem returned suddenly. I assume that it was caused by an update but as I auto-update my raspi out of laziness, I'm not shure. Anyway, the fix on the moc site worked for me:
A possible circumvention is to run MOC with the configuration option ALSADevice="hw:0,0"; the "hw:0,0" device is not usable on all systems (and a MOC assertion or ALSA error may result), but when usable it does work and the CPU load drops from near 100% to around 7% in our tests.
From: http://moc.daper.net/node/861

Concerning the volume control: The volume control also doesn't work for me. I thought I was too stupid to choose the right device so I didn't research any further. Right now I control the volume with the 'alsamixer' interface. If I find a solution I will post it. If you have a solution please post.

raspuser
Posts: 17
Joined: Wed May 08, 2013 5:05 am

Re: moc (music on console) 100% cpu

Thu May 16, 2013 11:51 am

MOC's CPU usage at 9-14% on Moebius Linux ( http://moebiuslinux.sourceforge.net/ )

Image

Bigger picture: http://i.imgur.com/54Q6D9l.jpg

datmatrix
Posts: 4
Joined: Sat Jun 15, 2013 8:32 am

Re: moc (music on console) 100% cpu

Sat Jun 15, 2013 9:25 am

@1984
I also have been pulling my hair out trying to figure out a easy way to control the volume other than use the alsamixer interface. I'll try to make my guide as detailed as possible.
My solution is binding alsamixer control commands to defaults volume keybinds ("," and ".")!
1. The commands is:

Code: Select all

amixer set PCM 50+ > /dev/null # for increasing
amixer set PCM 50+ > /dev/null # for decreasing

2. Bind key, take two steps:
Step 1:
Edit your ./moc/config file, specifically these below lines:

Code: Select all

ExecCommand1            = "amixer set PCM 50+ > /dev/null"
ExecCommand2            = "amixer set PCM 50- > /dev/null"
*You need to delete the hash mark "#" to make your changes applicable - And one more important thing, also delete "#" at line

Code: Select all

Keymap   =  my_keymap
to make your keybindings take effect. For more instruction: read this file: /usr/share/doc/moc/keymap.example
Step 2:
Next, change your ./moc/my_keymap file, comment out the volume keybinds line of "," and "."; then roll down a bit to make these change:

Code: Select all

 exec_command1 =         .
 exec_command2 =         ,
3. Restart your mocp server and it's all set!

---Dat

1984
Posts: 4
Joined: Fri Jan 11, 2013 8:50 pm

Re: moc (music on console) 100% cpu

Tue Aug 20, 2013 8:57 pm

@datmatrix

Thanks a lot! I haven't though of this hack!

Anyway, I had to change the guide in the following way to make it work:
  • The commands to change the volume for me are:

    Code: Select all

    amixer -c 0 set PCM 50+ > /dev/null
    amixer -c 0 set PCM 50- > /dev/null 
  • To deactivate the standard key bindings for controling the volume I had to change the part in my keybinds file to make it look like this:

    Code: Select all

    volume_down_5 = 
    volume_up_5 =
Otherwise it tries to use the standard key bindings if I comment it out and then there's a conflict.

Thanks a lot. :)

michal.cab
Posts: 1
Joined: Thu Jul 10, 2014 3:57 pm

Re: moc (music on console) 100% cpu

Thu Jul 10, 2014 4:00 pm

raspuser wrote:MOC's CPU usage at 9-14% on Moebius Linux ( http://moebiuslinux.sourceforge.net/ )

Image

Bigger picture: http://i.imgur.com/54Q6D9l.jpg
hi, could you give us more specific descrtiption or mocp config. because i tried moebius v.1.1.1 and cpu is still at 100% ...

Return to “General discussion”