Summary: | not able to set 44k sample rate with module-alsa-sink even the hardware supports it | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | sam.right |
Component: | alsa | Assignee: | pulseaudio-bugs |
Status: | RESOLVED INVALID | QA Contact: | pulseaudio-bugs |
Severity: | major | ||
Priority: | medium | CC: | lennart |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
sam.right
2011-11-15 12:28:23 UTC
Here is the syslog: Nov 15 20:29:08 OpenWrt user.warn pulseaudio[2782]: [pulseaudio] alsa-util.c: Unable to convert error string to locale, filtering. Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] alsa-util.c: Device default doesn't support 44100 Hz, changed to 48000 Hz. Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] alsa-util.c: Device default doesn't support sample format s16be, changed to s16le. Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] alsa-sink.c: Successfully opened device default. Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] alsa-sink.c: Successfully enabled mmap() mode. Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: Created sink 0 "output" with sample spec s16le 2ch 48000Hz and channel map front-left,front-right Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.resolution_bits = "16" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.api = "alsa" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.class = "sound" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.class = "generic" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.subclass = "generic-mix" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.name = "USB Audio" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.id = "USB Audio" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.subdevice = "0" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.subdevice_name = "subdevice #0" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.device = "0" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.card = "0" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.card_name = "USB Audio DAC" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.long_card_name = "Burr-Brown from TI USB Audio DAC at usb-ar71xx-ehci-1, full speed" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: alsa.driver_name = "snd_usb_audio" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.string = "default" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.buffering.buffer_size = "24576" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.buffering.fragment_size = "4096" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.access_mode = "mmap" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.description = "USB Audio DAC" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] sink.c: device.icon_name = "audio-card" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] source.c: Created source 0 "output.monitor" with sample spec s16le 2ch 48000Hz and channel map front-left,front-right Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] source.c: device.description = "Monitor of USB Audio DAC" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] source.c: device.class = "monitor" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] source.c: device.icon_name = "audio-input-microphone" Nov 15 20:29:08 OpenWrt user.info pulseaudio[2782]: [pulseaudio] alsa-sink.c: Using 6.0 fragments of size 4096 bytes (21.33ms), buffer size is 24576 bytes (128.00ms) Some platform information: CPU: Atheros AR9330 (MIPS) OS: Openwrt trunk Kernel: 2.6.39.4 Alsa Driver: 1.0.24 Alsa Lib: 1.0.24.1 Same hardware works at 44.1k sample rate with desktop pc (x86). The log you see is basically a failure in opening the device at 44100Hz, so that point to an ALSA problem to start with. Are you running the same kernel on the desktop as well? The desktop was using an earlier version of kernel 2.6.32. Today I tried aplay that comes with alsa-utils and it seems to play at 44.1k sample rate just fine (I had to create the .asoundrc file in the home folder otherwise aplay just force the sample rate to 48k). The usb sound card is the only sound card attached to it (card0) ~/.asoundrc file pcm.dmix_44 { type dmix ipc_key 321456 # any unique value ipc_key_add_uid true slave { pcm "hw:0" format S16_LE rate 44100 } } ./aplay -v -Dplug:dmix_44 44100.wav Playing WAVE '44100.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Plug PCM: Direct Stream Mixing PCM Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 16 buffer_size : 16539 period_size : 5513 period_time : 125011 tstamp_mode : NONE period_step : 1 avail_min : 5513 period_event : 0 start_threshold : 16539 stop_threshold : 16539 silence_threshold: 0 silence_size : 0 boundary : 1083899904 Hardware PCM card 0 'USB Audio DAC' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : MMAP_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 16 buffer_size : 16539 period_size : 5513 period_time : 125011 tstamp_mode : ENABLE period_step : 1 avail_min : 5513 period_event : 0 start_threshold : 1 stop_threshold : 1083899904 silence_threshold: 0 silence_size : 1083899904 boundary : 1083899904 appl_ptr : 0 hw_ptr : 0 /proc/asound/card0/pcm0p/sub0/hw_params access: MMAP_INTERLEAVED format: S16_LE subformat: STD channels: 2 rate: 44100 (44100/1) period_size: 5513 buffer_size: 16539 Finally figured out what's happening. For module-alsa-sink if you don't specify device then it will use "default" which is generated automatically from "/usr/share/alsa/alsa.conf". The problem is that dmix is specified (defaults.pcm.dmix.rate) and hard coded to 48000 in that configuration file. That's why it did not work for me previously (no device parameter is specified for module-alsa-sink). Can the alsa detect process bypass the dmix rate settings and do things more intelligently? If you specify device parameter in module-alsa-sink like load-module module-alsa-sink rate=44100 device=hw:0,0 then it can pick up 44.1k sample rate straight. Here is the log to prove it D: [pulseaudio] alsa-util.c: Trying hw:0,0 with SND_PCM_NO_AUTO_FORMAT ... D: [pulseaudio] alsa-util.c: Managed to open hw:0,0 W: [pulseaudio] alsa-util.c: Unable to convert error string to locale, filtering. D: [pulseaudio] alsa-util.c: snd_pcm_hw_params_set_format(Signed 16 bit Big Endian) failed: Invalid argument D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 5944 ms D: [pulseaudio] alsa-util.c: Set buffer size first (to 5288 samples), period size second (to 661 samples). I: [pulseaudio] alsa-util.c: Device hw:0,0 doesn't support sample format s16be, changed to s16le. I: [pulseaudio] alsa-sink.c: Successfully opened device hw:0,0. I: [pulseaudio] alsa-sink.c: Successfully enabled mmap() mode. I: [pulseaudio] sink.c: Created sink 0 "output" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right I: [pulseaudio] sink.c: alsa.resolution_bits = "16" I: [pulseaudio] sink.c: device.api = "alsa" I: [pulseaudio] sink.c: device.class = "sound" I: [pulseaudio] sink.c: alsa.class = "generic" I: [pulseaudio] sink.c: alsa.subclass = "generic-mix" I: [pulseaudio] sink.c: alsa.name = "USB Audio" I: [pulseaudio] sink.c: alsa.id = "USB Audio" I: [pulseaudio] sink.c: alsa.subdevice = "0" I: [pulseaudio] sink.c: alsa.subdevice_name = "subdevice #0" I: [pulseaudio] sink.c: alsa.device = "0" I: [pulseaudio] sink.c: alsa.card = "0" I: [pulseaudio] sink.c: alsa.card_name = "USB Audio DAC" I: [pulseaudio] sink.c: alsa.long_card_name = "Burr-Brown from TI USB Audio DAC at usb-ar71xx-ehci-1, full speed" I: [pulseaudio] sink.c: alsa.driver_name = "snd_usb_audio" I: [pulseaudio] sink.c: device.string = "hw:0,0" I: [pulseaudio] sink.c: device.buffering.buffer_size = "21152" I: [pulseaudio] sink.c: device.buffering.fragment_size = "2644" I: [pulseaudio] sink.c: device.access_mode = "mmap" I: [pulseaudio] sink.c: device.description = "USB Audio DAC" I: [pulseaudio] sink.c: device.icon_name = "audio-card" D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event. I: [pulseaudio] source.c: Created source 0 "output.monitor" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right I: [pulseaudio] source.c: device.description = "Monitor of USB Audio DAC" I: [pulseaudio] source.c: device.class = "monitor" I: [pulseaudio] source.c: device.icon_name = "audio-input-microphone" I: [pulseaudio] alsa-sink.c: Using 8.0 fragments of size 2644 bytes (14.99ms), buffer size is 21152 bytes (119.91ms) D: [pulseaudio] alsa-sink.c: hwbuf_unused=0 D: [pulseaudio] alsa-sink.c: setting avail_min=1 D: [pulseaudio] alsa-util.c: snd_pcm_dump(): D: [pulseaudio] alsa-util.c: Hardware PCM card 0 'USB Audio DAC' device 0 subdevice 0 D: [pulseaudio] alsa-util.c: Its setup is: D: [pulseaudio] alsa-util.c: stream : PLAYBACK D: [pulseaudio] alsa-util.c: access : MMAP_INTERLEAVED D: [pulseaudio] alsa-util.c: format : S16_LE D: [pulseaudio] alsa-util.c: subformat : STD D: [pulseaudio] alsa-util.c: channels : 2 D: [pulseaudio] alsa-util.c: rate : 44100 D: [pulseaudio] alsa-util.c: exact rate : 44100 (44100/1) D: [pulseaudio] alsa-util.c: msbits : 16 D: [pulseaudio] alsa-util.c: buffer_size : 5288 D: [pulseaudio] alsa-util.c: period_size : 661 D: [pulseaudio] alsa-util.c: period_time : 14988 D: [pulseaudio] alsa-util.c: tstamp_mode : ENABLE D: [pulseaudio] alsa-util.c: period_step : 1 D: [pulseaudio] alsa-util.c: avail_min : 661 D: [pulseaudio] alsa-util.c: period_event : 1 D: [pulseaudio] alsa-util.c: start_threshold : -1 D: [pulseaudio] alsa-util.c: stop_threshold : 1386217472 D: [pulseaudio] alsa-util.c: silence_threshold: 0 D: [pulseaudio] alsa-util.c: silence_size : 0 D: [pulseaudio] alsa-util.c: boundary : 1386217472 D: [pulseaudio] alsa-util.c: appl_ptr : 0 D: [pulseaudio] alsa-util.c: hw_ptr : 0 D: [alsa-sink] alsa-sink.c: Thread starting up D: [alsa-sink] core-util.c: SCHED_RR|SCHED_RESET_ON_FORK worked. I: [alsa-sink] core-util.c: Successfully enabled SCHED_RR scheduling for thread, with priority 9. I: [alsa-sink] alsa-sink.c: Starting playback. We do not automagically support this setup. You either need to let your default device be hw:0 and use dmix explicitly in your ALSA apps, or manually load the ALSA module. Incidentally, why do you need the dmix device? (In reply to comment #6) > We do not automagically support this setup. You either need to let your default > device be hw:0 and use dmix explicitly in your ALSA apps, or manually load the > ALSA module. > > Incidentally, why do you need the dmix device? Just like you suggested I now use plughw:0 as the device string. Just wondering do I also need to specify the raw device to use the auto sample rate switching function of the pluseaudio in testing? There is no need for me to use dmix. I believe dmix is introduced so multiple clients are able to share the same audio hardware at the same time which is kind of the job of pulseaudio. Therefore it does make sense to use raw device by default and only fall back to dmix if raw device is busy. The alternate sample rate code actually just probes for the specified alternate rate (default of 48 kHz) and if available, uses it. So it should "just work" on your hardware. (In reply to comment #8) > The alternate sample rate code actually just probes for the specified alternate > rate (default of 48 kHz) and if available, uses it. So it should "just work" on > your hardware. Sounds interesting. Can't wait to give it a try when its released. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.