hdsp vs 16bit vs dmix
I am seeing strange things happen while using the hdsp and dmix plugin and aplay as a test app.
JACK works perfectly.
I can get sound from aplay if I use this commandline:
aplay -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo underrun!!! (at least 40.147 ms long)
underrun!!! (at least 86.223 ms long)
underrun!!! (at least 145.116 ms long)
underrun!!! (at least 79.109 ms long)
underrun!!! (at least 248.555 ms long)
underrun!!! (at least 180.442 ms long)
underrun!!! (at least 96.117 ms long)
Aborted by signal Interrupt...
But I get an xrun every second or so which makes the card useless for native alsa apps .
aplay -f cd -D hw:0 audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:822: Access type not available
If I try the dmix plugin (which also works with the pci card):
pcm.!default {
type plug
slave.pcm "dmixer"
}pcm.dmixer {
type dmix
ipc_key 1234
slave {
pcm "hw:0"
period_time 0
period_size 1024
buffer_size 4096
# periods 128
rate 44100
format s16_le
}
bindings {
0 0
1 1
}
}ctl.dmixer {
type hw
card 0
}
------
aplay -f cd -D default audio.wav
ALSA lib pcm_hw.c:324:(snd_pcm_hw_hw_params) SNDRV_PCM_IOCTL_HW_PARAMS failed: Device or resource busy ALSA lib pcm_direct.c:712:(snd_pcm_direct_initialize_slave) unable to install hw params ALSA lib pcm_dmix.c:827:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:502: audio open error: Device or resource busy
------
For fun I tried this syntax:
pcm.!default {
type plughw
slave.pcm "dmixer"
}------
aplay -f cd -D default audio.wav
ALSA lib pcm.c:1900:(snd_pcm_open_conf) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_plughw.so
aplay: main:502: audio open error: No such file or directory
------
Signature · 22 lines
Patrick Shirkey - Boost Hardware Ltd. Http://www.boosthardware.com Http://www.djcj.org - The Linux Audio Users guide ======================================== Apparently upon the beginning of the barrage, the donkey broke discipline and panicked, toppling the cart. At that point, the rockets disconnected from the timer, leaving them strewn around the street. Tethered to the now toppled cart, the donkey was unable to escape before the arrival of U.S. troops. United Press International Rockets on donkeys hit major Baghdad sites By P. MITCHELL PROTHERO Published 11/21/2003 11:13 AM ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
At Thu, 08 Jan 2004 02:29:13 +0900,
Quoted 20 lines · Patrick Shirkey
I am seeing strange things happen while using the hdsp and dmix plugin and aplay as a test app.
JACK works perfectly.
I can get sound from aplay if I use this commandline:
aplay -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 40.147 ms long)
underrun!!! (at least 86.223 ms long)
underrun!!! (at least 145.116 ms long)
underrun!!! (at least 79.109 ms long)
underrun!!! (at least 248.555 ms long)
underrun!!! (at least 180.442 ms long)
underrun!!! (at least 96.117 ms long)
Aborted by signal Interrupt...
Quoted 2 lines
But I get an xrun every second or so which makes the card useless for native alsa apps .
i'm not sure which plugin plays wrong yet.
run aplay with -v option and see which plugins and what configurations are used. for example, if the native hardware requires 32bit samples, prepare 32bit samples WAV instead of 16bit, and reduce the plugin. i don't think the rate conversion is used, so the plugins are linear, route, and copy plugins.
my rough guess is the copy plugin. try aplay -M option, so that mmap mode is used.
Quoted 5 lines
aplay -f cd -D hw:0 audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:822: Access type not available
hdsp supports only MMAP access.
aplay uses the RW access as default.
Quoted 31 lines
If I try the dmix plugin (which also works with the pci card):
pcm.!default { type plug slave.pcm "dmixer" }pcm.dmixer { type dmix ipc_key 1234 slave { pcm "hw:0" period_time 0 period_size 1024 buffer_size 4096 # periods 128 rate 44100 format s16_le } bindings { 0 0 1 1 } }ctl.dmixer {
type hw
card 0
}
Quoted 8 lines
------
aplay -f cd -D default audio.wav
ALSA lib pcm_hw.c:324:(snd_pcm_hw_hw_params)SNDRV_PCM_IOCTL_HW_PARAMS
failed: Device or resource busy
ALSA lib pcm_direct.c:712:(snd_pcm_direct_initialize_slave) unable to install hw params
ALSA lib pcm_dmix.c:827:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:502: audio open error: Device or resource busy
hmm, it's wierd. -ENODEV ?
Quoted 11 lines
------
For fun I tried this syntax:
pcm.!default { type plughw slave.pcm "dmixer" }
Quoted 5 lines
------
aplay -f cd -D default audio.wav
ALSA lib pcm.c:1900:(snd_pcm_open_conf) Cannot open shared library/usr/lib/alsa-lib/libasound_module_pcm_plughw.so
aplay: main:502: audio open error: No such file or directory
this one is clear. there is no plughw type.
it's a defined pcm name.
Takashi
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
Quoted 11 lines · Takashi Iwai
Quoted 11 lines
pcm.dmixer { type dmix ipc_key 1234 slave { pcm "hw:0" period_time 0 period_size 1024 buffer_size 4096 # periods 128 rate 44100 format s16_le
Use 'format s32_le' here. Your harware uses 32-bit (resp. 24-bit stored in 32-bit word samples).
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
Quoted 25 lines · Takashi Iwai
At Thu, 08 Jan 2004 02:29:13 +0900,
Quoted 17 lines · Patrick Shirkey
I am seeing strange things happen while using the hdsp and dmix plugin and aplay as a test app.
JACK works perfectly.
I can get sound from aplay if I use this commandline:
aplay -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo underrun!!! (at least 40.147 ms long)
underrun!!! (at least 86.223 ms long)
underrun!!! (at least 145.116 ms long)
underrun!!! (at least 79.109 ms long)
underrun!!! (at least 248.555 ms long)
underrun!!! (at least 180.442 ms long)
underrun!!! (at least 96.117 ms long)
Aborted by signal Interrupt...Quoted 1 line
But I get an xrun every second or so which makes the card useless for native alsa apps .
i'm not sure which plugin plays wrong yet.
Quoted 9 lines
run aplay with -v option and see which plugins and what configurations are used. for example, if the native hardware requires 32bit samples, prepare 32bit samples WAV instead of 16bit, and reduce the plugin. i don't think the rate conversion is used, so the plugins are linear, route, and copy plugins.
my rough guess is the copy plugin. try aplay -M option, so that mmap mode is used.
IMO the test case should be a 16bit file because this is the CD standard.
-------
aplay -v -M -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Plug PCM: Route conversion PCM (sformat=S32_LE)
Transformation table:
0 <- 0
1 <- 1
2 <- none
3 <- none
4 <- none
5 <- none
6 <- none
7 <- none
8 <- none
9 <- none
10 <- none
11 <- none
12 <- none
13 <- none
14 <- none
15 <- none
16 <- none
17 <- none
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16buffer_size : 8192period_size : 4096period_time : 92879tick_time : 10000tstamp_mode : NONEperiod_step : 1sleep_min : 0avail_min : 4096xfer_align : 4096start_threshold : 8192stop_threshold : 8192silence_threshold: 0silence_size : 0
boundary : 1073741824
Slave: Hardware PCM card 0 'Hammerfall DSP' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_NONINTERLEAVED
format : S32_LE
subformat : STD
channels : 18
rate : 44100
exact rate : 44100 (44100/1)
msbits : 24buffer_size : 8192period_size : 4096period_time : 92879tick_time : 10000tstamp_mode : NONEperiod_step : 1sleep_min : 0avail_min : 4096xfer_align : 4096start_threshold : 8192stop_threshold : 8192silence_threshold: 0silence_size : 0
boundary : 1073741824
underrun!!! (at least 683.032 ms long)
Status:
state : XRUNtrigger_time: 1073628220.377968000
tstamp : 1073628221.60968000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 280.077 ms long)
Status:
state : XRUNtrigger_time: 1073628222.812390000
tstamp : 1073628223.92462000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 179.903 ms long)
Status:
state : XRUNtrigger_time: 1073628224.413069000
tstamp : 1073628224.592968000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 143.721 ms long)
Status:
state : XRUNtrigger_time: 1073628225.185560000
tstamp : 1073628225.329276000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 9.202 ms long)
Status:
state : XRUNtrigger_time: 1073628225.729596000
tstamp : 1073628225.738793000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 126.904 ms long)
Status:
state : XRUNtrigger_time: 1073628227.274901000
tstamp : 1073628227.401799000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 225.002 ms long)
Status:
state : XRUNtrigger_time: 1073628227.898006000
tstamp : 1073628228.123003000
delay : 0
avail : 8192avail_max : 8192
underrun!!! (at least 163.350 ms long)
Status:
state : XRUNtrigger_time: 1073628229.57122000
.
.
.
------
Quoted 9 lines
Quoted 4 lines
aplay -f cd -D default audio.wav
ALSA lib pcm.c:1900:(snd_pcm_open_conf) Cannot open shared library/usr/lib/alsa-lib/libasound_module_pcm_plughw.so
aplay: main:502: audio open error: No such file or directorythis one is clear. there is no plughw type.
it's a defined pcm name.
Hmm. This would appear to be a problem. While I'm not ecouraging people to use the hdsp as a standard consumer playback device... My customer (who runs windows mostly) is expecting to be able to view videos etc with this device simply because he can in his windows env. Should I be encouraging him to purchase a second card or can this be fixed using ALSA?
Signature · 22 lines
Patrick Shirkey - Boost Hardware Ltd. Http://www.boosthardware.com Http://www.djcj.org - The Linux Audio Users guide ======================================== Apparently upon the beginning of the barrage, the donkey broke discipline and panicked, toppling the cart. At that point, the rockets disconnected from the timer, leaving them strewn around the street. Tethered to the now toppled cart, the donkey was unable to escape before the arrival of U.S. troops. United Press International Rockets on donkeys hit major Baghdad sites By P. MITCHELL PROTHERO Published 11/21/2003 11:13 AM ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
At Fri, 09 Jan 2004 00:49:34 +0900,
Quoted 36 lines · Patrick Shirkey
Quoted 34 lines · Takashi Iwai
At Thu, 08 Jan 2004 02:29:13 +0900,
Quoted 19 lines · Patrick Shirkey
I am seeing strange things happen while using the hdsp and dmix plugin and aplay as a test app.
JACK works perfectly.
I can get sound from aplay if I use this commandline:
aplay -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 40.147 ms long)
underrun!!! (at least 86.223 ms long)
underrun!!! (at least 145.116 ms long)
underrun!!! (at least 79.109 ms long)
underrun!!! (at least 248.555 ms long)
underrun!!! (at least 180.442 ms long)
underrun!!! (at least 96.117 ms long)
Aborted by signal Interrupt...Quoted 2 lines
But I get an xrun every second or so which makes the card useless for native alsa apps .
i'm not sure which plugin plays wrong yet.
run aplay with -v option and see which plugins and what configurations are used. for example, if the native hardware requires 32bit samples, prepare 32bit samples WAV instead of 16bit, and reduce the plugin. i don't think the rate conversion is used, so the plugins are linear, route, and copy plugins.
Quoted 5 lines
Quoted 3 lines
my rough guess is the copy plugin. try aplay -M option, so that mmap mode is used.
IMO the test case should be a 16bit file because this is the CD standard.
i asked it only for catching the bug. of course, 16bit 2ch WAV should be supported.
Quoted 6 lines
-------
aplay -v -M -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Route conversion PCM (sformat=S32_LE) Transformation table:
(snip)
ok, it's not in copy plugin.
Quoted 14 lines
Slave: Hardware PCM card 0 'Hammerfall DSP' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access :MMAP_NONINTERLEAVED
format :S32_LE
subformat : STD
channels : 18
rate : 44100
exact rate : 44100 (44100/1)
msbits : 24buffer_size: 8192period_size: 4096period_time: 92879
the buffer isn't large, it's 180 msec.
to get rid of the possibility of general kernel scheduling problem, try to start aplay with nice -10 (as root)
# nice -n -10 aplay foo.wav
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
aplay -f cd -D default audio.wav
ALSA lib pcm.c:1900:(snd_pcm_open_conf) Cannot open shared library/usr/lib/alsa-lib/libasound_module_pcm_plughw.so
aplay: main:502: audio open error: No such file or directorythis one is clear. there is no plughw type.
it's a defined pcm name.
Quoted 5 lines
Hmm. This would appear to be a problem. While I'm not ecouraging people to use the hdsp as a standard consumer playback device... My customer (who runs windows mostly) is expecting to be able to view videos etc with this device simply because he can in his windows env. Should I be encouraging him to purchase a second card or can this be fixed using ALSA?
sorry, i can't measure how deep the problem is. i have no this card by myself. but viewing a video with hdsp is like going shoping with Ferrari, i'd like to say :)
Takashi
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
Quoted 23 lines · Patrick Shirkey
Quoted 22 lines · Takashi Iwai
At Thu, 08 Jan 2004 02:29:13 +0900,
Quoted 19 lines · Patrick Shirkey
I am seeing strange things happen while using the hdsp and dmix plugin and aplay as a test app.
JACK works perfectly.
I can get sound from aplay if I use this commandline:
aplay -f cd -D plughw audio.wav
Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 40.147 ms long)
underrun!!! (at least 86.223 ms long)
underrun!!! (at least 145.116 ms long)
underrun!!! (at least 79.109 ms long)
underrun!!! (at least 248.555 ms long)
underrun!!! (at least 180.442 ms long)
underrun!!! (at least 96.117 ms long)
Aborted by signal Interrupt...
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
But I get an xrun every second or so which makes the card useless for native alsa apps .
Hmm. This would appear to be a problem. While I'm not ecouraging people to use the hdsp as a standard consumer playback device... My customer (who runs windows mostly) is expecting to be able to view videos etc with this device simply because he can in his windows env. Should I be encouraging him to purchase a second card or can this be fixed using ALSA?
I think it may be something else in the hardware setup, as it works fine for me. Are the disks running dma? Is there some interrupt oddness? What kernel is it? What kind of machine? What filesystem? The fact that it works with JACK suggests that it is a small delay that aplay doesnt cope with well.
Justin
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
Quoted 8 lines · Justin Cormack
I think it may be something else in the hardware setup, as it works fine for me. Are the disks running dma? Is there some interrupt oddness? What kernel is it? What kind of machine? What filesystem? The fact that it works with JACK suggests that it is a small delay that aplay doesnt cope with well.
Thanks. After this and Takashi's message I have ben convinced to look into the kernel and latency stuffs again.
Signature · 22 lines
Patrick Shirkey - Boost Hardware Ltd. Http://www.boosthardware.com Http://www.djcj.org - The Linux Audio Users guide ======================================== Apparently upon the beginning of the barrage, the donkey broke discipline and panicked, toppling the cart. At that point, the rockets disconnected from the timer, leaving them strewn around the street. Tethered to the now toppled cart, the donkey was unable to escape before the arrival of U.S. troops. United Press International Rockets on donkeys hit major Baghdad sites By P. MITCHELL PROTHERO Published 11/21/2003 11:13 AM ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
Quoted 11 lines · Takashi Iwai
Quoted 7 lines
------
aplay -f cd -D default audio.wav
ALSA lib pcm_hw.c:324:(snd_pcm_hw_hw_params)SNDRV_PCM_IOCTL_HW_PARAMSfailed: Device or resource busy ALSA lib pcm_direct.c:712:(snd_pcm_direct_initialize_slave) unable to install hw params ALSA lib pcm_dmix.c:827:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:502: audio open error: Device or resource busyhmm, it's wierd.
-ENODEV?
Old thread, but I missed it then. Indeed the dmix plugin doesn't play nicely with the hdsp.
The above give -ENODEV because if you don't specify 'channels 18' (for a multiface) in the dmix slave definition, the way the hw param settings is done tries to switch the card to double speed mode (there are less channels then, I guess it's closer to the 2 channels requested). You should have the following in your logs :
cannot change speed mode (capture PID = -1, playback PID = 3888)
Now if you do specify 'channels 18' in the dmix slave definition, the error is as follows :
aplay: set_params:827: Sample format non available
I have 'format S32_LE' set in the dmix slave definition, but it doesn't seem to be taken into account.
Thomas
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Quoted 5 lines · Thomas Charbonnel
Now if you do specify 'channels 18' in the dmix slave definition, the error is as follows :
aplay: set_params:827: Sample format non available
I have 'formatS32_LE' set in the dmix slave definition, but it doesn't seem to be taken into account.
It should be. Did you used 'aplay -D plug:your_dmix'?
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Quoted 12 lines · Jaroslav Kysela
Quoted 3 lines · Thomas Charbonnel
Now if you do specify 'channels 18' in the dmix slave definition, the error is as follows :
aplay: set_params:827: Sample format non available
I have 'formatS32_LE' set in the dmix slave definition, but it doesn't seem to be taken into account.It should be. Did you used 'aplay -D plug:your_dmix'?
Jaroslav
You're right, I only used '-D my_dmix'.
Using '-D plug:my_dmix' works properly, so I guess the problem is solved, thanks !
For the record here's the working .asoundrc section :
pcm.hdsp_dmix {
type dmix
ipc_key 1024
slave {
pcm {
type hw
card 2
}
rate 44100
format S32_LE
channels 18
}
}Of course people will have to tweak the card and channels number to match their setup.
Thomas
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn