You are not logged in.
I have recently bought an expensive USB DAC capable of both 44.1KHz & 48KHz sampling rates. It is reported as a Burr-Brown Japan PCM2702. At the moment it seems that most of my programs that output sound (mpd, smplayer, vlc, aplay, etc.) all result in 44.1KHz music being resampled to 48KHz. For example, the following is playing a 44.1KHz wav file using aplay;
[cj@yuzuki ~]$ aplay array_new/media/unfiled/udial.wav
Playing WAVE 'array_new/media/unfiled/udial.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay correctly identifies the file as 44.1KHz, but alsa is sending 48KHz to the DAC;
[cj@yuzuki ~]$ cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 16384
However if I add the -Dhw:0,0 to aplay, alsa sends 44.1KHz to the DAC, so I know that it is possible to get what I want.
[cj@yuzuki ~]$ aplay -Dhw:0,0 array_new/media/unfiled/udial.wav
Playing WAVE 'array_new/media/unfiled/udial.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
[cj@yuzuki ~]$ cat /proc/asound/card0/pcm0p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 5513
buffer_size: 22050
I can achieve something similar with smplayer's GUI Options-->Preferences-->General-->Audio as the 'Output driver' drop-down list offers me several options; if I select alsa it resamples to 48KHz, however if I select alsa (0.0 - Burr-Brown Japan PCM2702 it outputs 44.1KHz.
So my question is this - what is the simplest/cleanest way to disable resampling & get alsa to output the original audio to the DAC? I've spent hours trawling the web & reading all sorts of wikis & howtos about .asoundrc/asound.conf, but I have failed to find anything that directly addresses this problem, which should be a simple fix!
Last edited by lost eden (2009-07-12 21:55:57)
Offline
Dmix resamples audio to 48000Hz by default afaik (can be changed). If it supports hardware mixing you should use that instead of dmix. Can you post the output of aplay -l ? Basically, if nothing is specified, dmix is activated, if hw:0,0 is used, the sound is sent directly to the hardware (mixing wont work, but if you have several subchannels, you can utilize real hardware mixing )
Last edited by Themaister (2009-07-12 21:36:10)
Offline
I've just discovered that if I add the following to my mpd.conf it plays at the desired 44.1KHz;
audio_output {
type "alsa"
name "default"
device "hw:0,0"
}
The important bit I think is the device line, because it uses hw to bypass the plughw devices? Is there a way I can do this globally in /etc/asound.conf, something like the following maybe?
pcm.!default hw:0,0
Can you post the output of aplay -l ?
[cj@yuzuki ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCM2702 [Burr-Brown Japan PCM2702], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
[cj@yuzuki ~]$ aplay -L
default:CARD=PCM2702
Burr-Brown Japan PCM2702, USB Audio
Default Audio Device
front:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
Front speakers
surround40:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCM2702,DEV=0
Burr-Brown Japan PCM2702, USB Audio
IEC958 (S/PDIF) Digital Audio Output
null
Discard all samples (playback) or generate zero samples (capture)
Last edited by lost eden (2009-07-12 21:41:20)
Offline
Hmm, I guess you have no additional subdevices...
This should work for the pure sound
pcm.!default{
type hw
card 0
}
However, with this, only one app can play sound at a time. Which most often is just fine
Last edited by Themaister (2009-07-12 21:48:29)
Offline
I literally just found that near exact same fix as you posted it! Found it over here --> http://alsa.opensrc.org/index.php/FAQ026
I did;
pcm.!default{
type hw
card 0
device 0
}
I'm not sure whether the device line is required, as you say there are no additional subdevices, but I find it easier to think of it as 0,0 so I'll keep it that way. Which works an absolute treat! Cheers!
Offline