[pulseaudio-discuss] pulseaudio (V5) incorrect rate detection on usb sound card with raspberry [SOLVED]

mailing lists listas.correo at yahoo.es
Thu Oct 30 03:43:59 PDT 2014


>Sorry for the spam, but you have a very serious smoking gun in your log:

I like this type of (instructive) spam ;-)

> D: [pulseaudio] alsa-util.c: Plug PCM: Direct Stream Mixing PCM
> 
> PulseAudio must not be running on top of dmix. dmix is the thing that, 
> by default, uses 48 kHz and does not support dynamic rate change.
> 
> You have something wrong in your .asoundrc or /etc/asound.conf. Please 
> delete both files.

I took the precaution of checking for alsa configuration files before report the case, not personal configuration files were present (.asoundrc)  and the system wide config file was:

root at rpi:/tmp# ls -l /etc/asound*
-rw-r--r-- 1 root root 132 Feb  9  2013 /etc/asound.conf.disabled

but a bit more investigation:

root at rpi:/tmp# strace -f -e trace=file aplay -vv -d 1 -f cd -D front:0 /dev/zero 2>&1 | grep "^open.*alsa" |  grep -v ENOENT
open("/usr/share/alsa/alsa.conf", O_RDONLY) = 3
open("/usr/share/alsa/alsa.conf.d/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
open("/usr/share/alsa/alsa.conf.d//50-pulseaudio.conf", O_RDONLY) = 3
open("/usr/share/alsa/alsa.conf.d//pulse.conf", O_RDONLY) = 3
open("/usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_conf_pulse.so", O_RDONLY) = 3
open("/usr/share/alsa/cards/aliases.conf", O_RDONLY) = 3
open("/usr/share/alsa/pcm/default.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/dmix.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/dsnoop.conf", O_RDONLY) = 4
open("/usr/share/alsa/cards/USB-Audio.conf", O_RDONLY) = 3
open("/usr/share/alsa/pcm/front.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/surround40.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/surround41.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/surround50.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/surround51.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/surround71.conf", O_RDONLY) = 4
open("/usr/share/alsa/pcm/iec958.conf", O_RDONLY) = 4
open("/usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_rate_speexrate.so", O_RDONLY) = 6


the file "/usr/share/alsa/alsa.conf" contains (among others plugins) dmix settings, and it seems that is the common configuration on several distros that I checked.

root at rpi:/tmp# grep dmix /usr/share/alsa/alsa.conf
defaults.pcm.dmix.max_periods 0
defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.format "unchanged"
defaults.pcm.dmix.card defaults.pcm.card
defaults.pcm.dmix.device defaults.pcm.device
pcm.dmix cards.pcm.dmix

commenting out this lines results on the desired rate:
I: [pulseaudio] sink.c: Created sink 0 "alsa_output.0.analog-stereo" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right

well I suppose that the solution is comment this lines, but it seems a bit dirty solution...

A big thanks to Alexander and the rest of the members who helped me to find this.

P.D: just curiosity .. why PA triggers this plugin and mpd not??? (output: opened plugin=alsa name="My ALSA device" audio_format=44100:16:2)

/ect/mpd.conf
[...]
audio_output {
	type		        "alsa"
	name		"My ALSA device"
	device		"hw:0,0"	# optional
	mixer_device	"default"	# optional
	mixer_control	"Master"	# optional
	mixer_index	"0"		# optional
	auto_resample	"no"
	auto_channels	"no"
	auto_format	"no"
}
[...]

client: [38] opened from 10.20.30.10:38882
client: [38] process command "play"
playlist: play 0:"2014/misc/song0003.mp3"
decoder_thread: clearing mixramp tags
decoder_control: mixramp_start = NULL
decoder_control: mixramp_prev_end = NULL
decoder: audio_format=44100:24:2, seekable=true
client: [38] command returned 0
playlist: queue song 1:"2014/misc/song0003.mp3"
client: [38] process command list
client: command_process_list: process command "status"
client: command_process_list: command returned 0
client: command_process_list: process command "currentsong"
client: command_process_list: command returned 0
client: [38] process command list returned 0
client: [38] closed
alsa: buffer: size=90..262144 time=2040..5944309
alsa: period: size=45..131072 time=1020..2972155
alsa: default period_time = buffer_time/4 = 500000/4 = 125000
alsa: buffer_size=22050 period_size=5513
output: opened plugin=alsa name="My ALSA device" audio_format=44100:16:2
output: converting from 44100:24:2


More information about the pulseaudio-discuss mailing list