You are not logged in.
Playing a mp3 file with mpd causes high cpu usage but mplayer plays it without significant cpu usage.
Googling has brought be to the inference that its the issue of mpd playing with different settings (ie at higher sample_rate).
I added .asoundrc but then also mpd is not respecting it.
Basically, I want to play mpd with the same settings as mplayer plays.
My .asoundrc file:-
defaults.pcm.rate_converter "44100"
When I play a file with mplayer.
shadyabhi@archlinux-N210 ~ $ cat /proc/asound/card0/pcm0p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 1024
buffer_size: 16384
OSS format: S16_LE
OSS channels: 2
OSS rate: 44100
OSS period bytes: 4096
OSS periods: 16
OSS period frames: 1024
shadyabhi@archlinux-N210 ~ $
And when I have mpd running,
shadyabhi@archlinux-N210 ~ $ cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 8192
shadyabhi@archlinux-N210 ~ $
My blog:-
http://blog.abhijeetr.com
Offline
Now, I have a real doubt. In the process of trying to solve the problem, I accidentally stopped alsa and then tried playing a mp3 from mplayer and I was able to play.
So, being able to play a mp3 without alsa DAEMON running, what does that mean? How do I have song enabled even when I have alsa stopped?
My blog:-
http://blog.abhijeetr.com
Offline
Note that you have "OSS ..." in your mplayer example. That's opensound, not ALSA, presumably.
A bit of quick debugging info:
zgrep SND /proc/config.gz | grep "="
lsmod | grep snd
Offline
The alsa "daemon" is simply a script that restores your mixer levels on startup and saves them on shutdown
Offline
shadyabhi@archlinux-N210 ~ $ zgrep SND /proc/config.gz | grep "="
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_JACK=y
CONFIG_SND_SEQUENCER=m
CONFIG_SND_SEQ_DUMMY=m
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_HRTIMER=m
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_VMASTER=y
CONFIG_SND_DMA_SGBUF=y
CONFIG_SND_RAWMIDI_SEQ=m
CONFIG_SND_OPL3_LIB_SEQ=m
CONFIG_SND_EMU10K1_SEQ=m
CONFIG_SND_MPU401_UART=m
CONFIG_SND_OPL3_LIB=m
CONFIG_SND_VX_LIB=m
CONFIG_SND_AC97_CODEC=m
CONFIG_SND_DRIVERS=y
CONFIG_SND_DUMMY=m
CONFIG_SND_ALOOP=m
CONFIG_SND_VIRMIDI=m
CONFIG_SND_MTPAV=m
CONFIG_SND_MTS64=m
CONFIG_SND_SERIAL_U16550=m
CONFIG_SND_MPU401=m
CONFIG_SND_PORTMAN2X4=m
CONFIG_SND_AC97_POWER_SAVE=y
CONFIG_SND_AC97_POWER_SAVE_DEFAULT=0
CONFIG_SND_SB_COMMON=m
CONFIG_SND_SB16_DSP=m
CONFIG_SND_PCI=y
CONFIG_SND_AD1889=m
CONFIG_SND_ALS300=m
CONFIG_SND_ALS4000=m
CONFIG_SND_ALI5451=m
CONFIG_SND_ASIHPI=m
CONFIG_SND_ATIIXP=m
CONFIG_SND_ATIIXP_MODEM=m
CONFIG_SND_AU8810=m
CONFIG_SND_AU8820=m
CONFIG_SND_AU8830=m
CONFIG_SND_AW2=m
CONFIG_SND_AZT3328=m
CONFIG_SND_BT87X=m
CONFIG_SND_CA0106=m
CONFIG_SND_CMIPCI=m
CONFIG_SND_OXYGEN_LIB=m
CONFIG_SND_OXYGEN=m
CONFIG_SND_CS4281=m
CONFIG_SND_CS46XX=m
CONFIG_SND_CS46XX_NEW_DSP=y
CONFIG_SND_CS5530=m
CONFIG_SND_CS5535AUDIO=m
CONFIG_SND_CTXFI=m
CONFIG_SND_DARLA20=m
CONFIG_SND_GINA20=m
CONFIG_SND_LAYLA20=m
CONFIG_SND_DARLA24=m
CONFIG_SND_GINA24=m
CONFIG_SND_LAYLA24=m
CONFIG_SND_MONA=m
CONFIG_SND_MIA=m
CONFIG_SND_ECHO3G=m
CONFIG_SND_INDIGO=m
CONFIG_SND_INDIGOIO=m
CONFIG_SND_INDIGODJ=m
CONFIG_SND_INDIGOIOX=m
CONFIG_SND_INDIGODJX=m
CONFIG_SND_EMU10K1=m
CONFIG_SND_EMU10K1X=m
CONFIG_SND_ENS1370=m
CONFIG_SND_ENS1371=m
CONFIG_SND_ES1938=m
CONFIG_SND_ES1968=m
CONFIG_SND_ES1968_INPUT=y
CONFIG_SND_FM801=m
CONFIG_SND_FM801_TEA575X_BOOL=y
CONFIG_SND_FM801_TEA575X=m
CONFIG_SND_HDA_INTEL=m
CONFIG_SND_HDA_HWDEP=y
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_INPUT_BEEP=y
CONFIG_SND_HDA_INPUT_BEEP_MODE=1
CONFIG_SND_HDA_INPUT_JACK=y
CONFIG_SND_HDA_PATCH_LOADER=y
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_HDMI=y
CONFIG_SND_HDA_CODEC_CIRRUS=y
CONFIG_SND_HDA_CODEC_CONEXANT=y
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
CONFIG_SND_HDSP=m
CONFIG_SND_HDSPM=m
CONFIG_SND_HIFIER=m
CONFIG_SND_ICE1712=m
CONFIG_SND_ICE1724=m
CONFIG_SND_INTEL8X0=m
CONFIG_SND_INTEL8X0M=m
CONFIG_SND_KORG1212=m
CONFIG_SND_LX6464ES=m
CONFIG_SND_MAESTRO3=m
CONFIG_SND_MAESTRO3_INPUT=y
CONFIG_SND_MIXART=m
CONFIG_SND_NM256=m
CONFIG_SND_PCXHR=m
CONFIG_SND_RIPTIDE=m
CONFIG_SND_RME32=m
CONFIG_SND_RME96=m
CONFIG_SND_RME9652=m
CONFIG_SND_SONICVIBES=m
CONFIG_SND_TRIDENT=m
CONFIG_SND_VIA82XX=m
CONFIG_SND_VIA82XX_MODEM=m
CONFIG_SND_VIRTUOSO=m
CONFIG_SND_VX222=m
CONFIG_SND_YMFPCI=m
CONFIG_SND_SPI=y
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=m
CONFIG_SND_USB_UA101=m
CONFIG_SND_USB_USX2Y=m
CONFIG_SND_USB_CAIAQ=m
CONFIG_SND_USB_CAIAQ_INPUT=y
CONFIG_SND_USB_US122L=m
CONFIG_SND_PCMCIA=y
CONFIG_SND_VXPOCKET=m
CONFIG_SND_PDAUDIOCF=m
CONFIG_SND_SOC=m
CONFIG_SND_SOC_I2C_AND_SPI=m
shadyabhi@archlinux-N210 ~ $ lsmod | grep snd
snd_seq_dummy 1479 0
snd_seq_oss 29240 0
snd_seq_midi_event 5516 1 snd_seq_oss
snd_seq 50562 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_seq_device 5281 3 snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss 39509 1
snd_mixer_oss 17730 1 snd_pcm_oss
snd_hda_codec_realtek 295589 1
snd_hda_intel 21837 1
snd_hda_codec 74609 2 snd_hda_codec_realtek,snd_hda_intel
snd_hwdep 6222 1 snd_hda_codec
snd_pcm 72321 3 snd_pcm_oss,snd_hda_intel,snd_hda_codec
snd_timer 19537 2 snd_seq,snd_pcm
snd 58906 11 snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
soundcore 6161 2 snd
snd_page_alloc 7361 2 snd_hda_intel,snd_pcm
shadyabhi@archlinux-N210 ~ $
My blog:-
http://blog.abhijeetr.com
Offline
The alsa "daemon" is simply a script that restores your mixer levels on startup and saves them on shutdown
I never really looked the init script of alsa. Now, I just opened it and figured out thats its just about saving and restoring alsa levels. Thanks.
My blog:-
http://blog.abhijeetr.com
Offline
In your mpd.conf, add/edit your audio_output{} section to use a specific format and set it to what you want.
This should help you:
http://mpd.wikia.com/wiki/Configuration
Offline
In your mpd.conf, add/edit your audio_output{} section to use a specific format and set it to what you want.
This should help you:
http://mpd.wikia.com/wiki/Configuration
I already did it by un-commenting the OSS part in /etc/mpd.conf but how can I do the same for alsa?
My blog:-
http://blog.abhijeetr.com
Offline
Sounds like you're doing it the wrong way around. People should usually be setting things up for *ALSA*, because ALSA's what's in the kernel, and ALSA's emulation of OSS bypasses dmix.
As an example, here's my ~/.asoundrc
Offline
Sounds like you're doing it the wrong way around. People should usually be setting things up for *ALSA*, because ALSA's what's in the kernel, and ALSA's emulation of OSS bypasses dmix.
As an example, here's my ~/.asoundrc
I used your .asoundrc and still when I play mpd, my output is still at 48000.
is it that mpd bypasses those settings. (Also, do I need to restart or something?)
Last edited by shadyabhi (2011-03-04 13:34:14)
My blog:-
http://blog.abhijeetr.com
Offline
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
I used your .asoundrc
Well, *look* at it first
Notice that it deliberately contains 48000.
I'm still not sure whether 44100 or 48000 is best. Listening with decent headphones, I've not been able to notice a difference between stereo music outputted at 44100, versus upmixed to 48000.
Offline
shadyabhi wrote:I used your .asoundrc
Well, *look* at it first
Notice that it deliberately contains 48000.
I'm still not sure whether 44100 or 48000 is best. Listening with decent headphones, I've not been able to notice a difference between stereo music outputted at 44100, versus upmixed to 48000.
thats easy to answer. if you listen mostly to music, you should use 44100. If you mainly watch movies use 48000 - its all about resampling, which uses quite some CPU
Last edited by Rasi (2011-03-04 14:06:09)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
After following your configs, my cpu usage is down to between 3% and 5%. And also, now I can see 41000 in "/proc/asound/card0/pcm0p/sub0/hw_params".
But, you said in the post that yours is 1% so I think there is still some issue.
Last edited by shadyabhi (2011-03-04 14:18:26)
My blog:-
http://blog.abhijeetr.com
Offline
After following your configs, my cpu usage is down to between 3% and 5%. And also, now I can see 41000 in "/proc/asound/card0/pcm0p/sub0/hw_params".
But, you said in the post that yours is 1% so I think there is still some issue.
i dont think so... 3-5% sounds perfectly fine. decoding needs some cpu too. And i have an core-i7
Last edited by Rasi (2011-03-04 14:20:05)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
resampling, which uses quite some CPU
Only about 1%, compared to my rough test. 4-5% CPU usage according to top, listening to audacious with my pcm.headphones at 44100, versus 5-6% CPU when at 48000 (using converter "samplerate_medium").
This rises to 9-10% with samplerate_best, but medium (or less) is perfectly fine.
What I'm more interested in, is something that just works, with music, games, movies, and even Skype.
Offline
i dont think so... 3-5% sounds perfectly fine. decoding needs some cpu too. And i have an core-i7
Ya. May be.. Things are more noticeable on Intel Atoms than on Core-i7.
My blog:-
http://blog.abhijeetr.com
Offline
Rasi wrote:resampling, which uses quite some CPU
Only about 1%, compared to my rough test. 4-5% CPU usage according to top, listening to audacious with my pcm.headphones at 44100, versus 5-6% CPU when at 48000 (using converter "samplerate_medium").
This rises to 9-10% with samplerate_best, but medium (or less) is perfectly fine.
What I'm more interested in, is something that just works, with music, games, movies, and even Skype.
interesting. i consider my hardware more or less state of the art and resampling still takes around 20-30%
considering your 2nd question: my asound.conf works with all stuff i tried by now. it includes a plug for skype to make it work.
Last edited by Rasi (2011-03-04 15:23:24)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
I've disabled dmix on my system to reduce cpu usage with this .asoundrc
pcm.!default {
type plug
slave.pcm hw
}
Works, it disables resampling, but you can only play 1 sample rate at the same time. (you can't play a 44.1khz mp3 with a 48khz video on background for example).
You can use this if you really want the lowest possible cpu usage.
.::. TigTex @ Portugal .::.
Offline
I've disabled dmix on my system to reduce cpu usage with this .asoundrc
Works, it disables resampling, but you can only play 1 sample rate at the same time. (you can't play a 44.1khz mp3 with a 48khz video on background for example).
You can use this if you really want the lowest possible cpu usage.
Thats not really possible for me because if I disable dmix, I wont hear two sounds at once. For ex, if I am listening to songs, I wont be able to hear any gtalk notifications which I am getting in browser window.
My blog:-
http://blog.abhijeetr.com
Offline
that's what i've said... but you could use it just to see if you can get your cpu usage lower than 4-5%, just for testing. I get 0-1% on a pentium4...
.::. TigTex @ Portugal .::.
Offline