You are not logged in.
Hello,
I already did some research about my problem but I did not find a solution for my problem yet. I configured my .asoundrc so that I have a permanent upmix from 2.0 to 5.1. But with the current configuration I cannot have multiple applications play sound at the same time.
This is the latest .asoundrc i tried
#define card
pcm.snd_card {
type hw
card 0
device 0
}
ctl.snd_card {
type hw
card 0
device 0
}
# softwaremixing
pcm.dmixer {
type dmix
ipc_key 1024
ipc_perm 0666
slave.pcm "snd_card"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 6
}
bindings {
0 0
1 1
2 2
3 3
4 4
5 5
}
}
#dsnoop plugin
pcm.dsnooper {
type dsnoop
ipc_key 2048
ipc_perm 0666
slave.pcm "snd_card"
slave
{
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}
#upmix
pcm.ch51dup {
type route
slave.pcm dmixer
slave.channels 6
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
ttable.0.4 0.5
ttable.1.4 0.5
ttable.0.5 0.5
ttable.1.5 0.5
}
pcm.duplex {
type asym
playback.pcm "ch51dup"
capture.pcm "dsnooper"
}
pcm.!default {
type asym
slave.pcm "duplex"
}
With this configuration Exaile gives an error on playback "Cannot open device for playback". VLC plays just stereo...
What I want to have is this:
Stereo should be upmixed to 5.1. But signals that already are 5.1 should not be changed. With pulseaudio on Ubuntu this was easy to do but I don't want to have pulseaudio at the moment. I had some trouble with it.
I tried some .asoundrc from this thread but they did not work.
Maybe someone can help me?
Offline
slave.pcm "snd_card"
That should be "surround51", then you don't have to go through the trouble of defining a "dmix" PCM.
But signals that already are 5.1 should not be changed.
AFAIK, ALSA is too stupid to be able to do that itself. *You* need to send the audio to surround51, or through your upmixer, as appropriate
I suggest you ask actual ALSA devs, and you won't find them here. You'll find them, sometimes, in #alsa.
If you manage to get an answer/solution, please post it here, so interested people (e.g. me) can learn
Last edited by brebs (2010-04-19 08:29:06)
Offline
Thanks for your answer.
AFAIK, ALSA is too stupid to be able to do that itself. *You* need to send the audio to surround51, or through your upmixer, as appropriate
So this means either everything is upmixed or I have to enter surround51 as an output plugin in the program which should have upmixed sound? What do I do in case this software does not offer this feature. In Exaile for example I can just select between alsa, pulse, oss, jack but cannot enter a "costum" output. I know that others like Amarok allow to enter a costum output.
If I tell my musicplayer to use surround51 what happens if I want more applications to play sound at the same time? Right now if surround51 would be the default only one application can play sound.
I suggest you ask actual ALSA devs, and you won't find them here. You'll find them, sometimes, in #alsa.
Ok, I will do that. And of course i will post here in case of success. I want to learn about this too.
Offline
What do I do in case this software does not offer this feature.
File a bug report with them. And/or use alternate software - there's no decent answer to your question. I use audacious.
Right now if surround51 would be the default only one application can play sound.
I've got it to work - open up 2 terminal windows, and run this in both:
speaker-test -D plug:dmix -c 6 -t wav
Looks like we're supposed to use plug:dmix instead of surround51 - weird. But this is good, because plug:dmix accepts any number of channels from 1-8 (i.e. upto surround71)
Edit: Removed my erronous thought regarding decreased CPU utilization
Last edited by brebs (2010-04-19 13:57:57)
Offline
Nope, with enabled upmix only 1 application can play sound. No matter what device I choose for the second application. This sucks somehow
Looks like I can't prevent using pulseaudio...
I got no response from the devs of alsa so far. But from exaile... They are working on costum sink selection it's already in experimental version bust still not workin correctly.
Thanks for your help, anyway!
Offline
Doesn't this ~/.asoundrc work for you?
I can't test the 5.1 (only have headphones), but it seems to work fine.
My ttable entries for ch51dup look different to yours.
Offline
Aha! Please try this ~/.asoundrc, which sets the default as upmix_20to51_resample, for the best upmixing
It includes, and needs, this monster dmixer, so I can use:
slave.pcm "dmixed:6"
Otherwise, ALSA gives me crappy error messages, e.g.:
speaker-test: pcm_plug.c:388: snd_pcm_plug_change_channels: Assertion `snd_pcm_format_linear(slv->format)' failed.
Edit: OK, so from the monster dmixer, I've figured out that an actual working 6-channel dmixer is as simple as:
pcm.dmix6 {
type asym
playback.pcm {
type dmix
ipc_key 567829
slave {
pcm "hw:0,0"
channels 6
}
}
}
Which can be referenced within pcm.upmix_21to51 simply with:
slave.pcm "dmix6"
How are we supposed to know this? It's black magic!
Last edited by brebs (2010-04-20 19:21:08)
Offline
Thanks. I'm just reading it and try to understand. It sounds awesome.
I will try tomorrow and report then!
THANKS!:)
Edit:
Nope, it does not work. If I use your .asoundrc it will give me "cannot read from ressource" on playback. I will look into that when I have the time for it.
Last edited by McFlow (2010-04-25 18:33:01)
Offline
PulseAudio is no solution for me. It causes even more problems than ALSA. I rather have just one application allowed playing sound then multiple applications with sound crashing ever 4 minutes.
I took a closer look to the latest .asoundrc file you linked me. I saw in the comments that there were several packages to install. I did it.
Checked .asoundrc file again. Now my players don't return an error message on playback. They will just freeze and turn unkillable. They don't even die with "pkill -9 <pid>".
Do I have to adjust things in the .asoundrc?
I see things like " card $CARD" and "hw:0,1" which should be "hw:0" in my oppinion. But I am not too sure about that.
I would appreciate if you could help me again with that.
Edit:
I tried the asoundrc below now. As far as I understood it, this .asoundrc is supposed to have 5.1 upmix and let multiple applications play sound. But when I want to playback the players just return "Could neither read settings from ressource nor writing to it"
# 6 channel dmix:
pcm.dmix6 {
type dmix
ipc_key 1024
ipc_key_add_uid false
ipc_perm 0660
slave {
pcm "hw:0,0"
rate 48000
channels 6
period_time 0
period_size 1024
buffer_time 0
buffer_size 5120
}
}
# upmixing:
pcm.ch51dup {
type route
slave.pcm dmix6
slave.channels 6
ttable.0.0 0.5
ttable.1.1 0.5
ttable.0.2 0.5
ttable.1.3 0.5
ttable.0.4 0.5
ttable.1.4 0.5
ttable.0.5 0.5
ttable.1.5 0.5
}
pcm.duplex {
type asym
playback.pcm "ch51dup" # upmix first
capture.pcm "hw:0"
}
# change default device:
pcm.!default {
type plug
slave.pcm "duplex"
}
Edit2:
Aplay returns slave PCM not usable...
Last edited by McFlow (2010-05-03 19:57:27)
Offline
You've regressed to the "solutions" posted everywhere on the Internet. There's just one problem - they DON'T WORK. That's why I posted the "black magic" comment with solution above. So, test exactly that. And forget about the "capture" side of things for the time being, until dmixed output by itself actually works.
It seems that something inside ALSA has changed recently
Offline
With the .asoundrc from above I get no sound at all.
I took the .asoundrc from above and edit the dmix6 as you mentioned. Then I edited the slave.pcm in upmix21to51 to what you said.
If I launch any player it will say "error while read or write from ressource"
Aplay throws out this:
aplay 01.\ Freedom\ Call\ -\ Metal\ Invasion.ogg
Playing raw data '01. Freedom Call - Metal Invasion.ogg' : Unsigned 8 bit, Rate 8000 Hz, Mono
ALSA lib pcm_params.c:2150:(snd1_pcm_hw_refine_slave) Slave PCM not usable
ALSA lib pcm_params.c:2150:(snd1_pcm_hw_refine_slave) Slave PCM not usable
aplay: set_params:1031: Broken configuration for this PCM: no configurations available
Same if I take it 1:1 how you pasted it.
Last edited by McFlow (2010-05-09 14:44:22)
Offline
I've gotten further, by always initializing the dmixer with 6 outputs (i.e. surround51), even for just stereo. Then, it works always, rather than when it just feels like it
I've also noticed that when to use "plug:" with "slave.pcm" is the output of God's do-the-unexpected random number generator. And that entries in ~/.asoundrc should go direct to "dmixed", i.e. specify slave.pcm "dmixed:6" rather than slave.pcm "surround51", even if surround51 is redefined, otherwise they might output white noise, because... I have no idea what the because is.
Here's a ~/.asoundrc which needs testing by someone other than me...
Testing commands:
speaker-test -D headphones -c 2 -t wav
speaker-test -D upmix_20to51 -c 2 -t wav
speaker-test -D surround40 -c 4 -t wav
speaker-test -D surround51 -c 6 -t wav
Get those all running *simultaneously* (which already works for me ), and we've made ALSA work the way it always should have done, and should be working now, without all this ~/.asoundrc black magic. Then we can add some decent testing info on the ALSA bug report I mentioned above, and hopefully get ALSA itself fixed.
Edit: You'll need blop, etc., for ALSA to use the LADSPA plugins - read the comments in my ~/.asoundrc
Edit2: Stopped renaming "default", because doing so breaks the sound in Wine.
Last edited by brebs (2010-06-27 06:21:54)
Offline
I've tested further. Got "default" working in wine and flash, with dmix working fine. The buffer_size value, and precise location of where the rate is specified, are crucial. Otherwise, you get silence, or the rate ignored. This is black magical madness
Anyway, here's my improved ~/.asoundrc
We always want:
$ cat /proc/asound/card0/pcm0p/sub0/hw_params
format: S16_LE
channels: 6
rate: 48000 (48000/1)
The "access" can vary between RW_INTERLEAVED and MMAP_INTERLEAVED - this doesn't seem to be a problem.
Edit: Updated URL.
Last edited by brebs (2011-08-02 10:53:57)
Offline
Sorry for not replying to my thread.
Thanks for sharing your experience.
I'm a bit busy with university stuff at the moment and I mostly use my laptop now. No time for music and movies
But I promise to test it when I have the time for it!
Offline
brebs, do you know any way to downmix multichannel to stereo/bineural?
It seems that using the ttable thing would do it, but I saw that ladspa has a HRTF plugin which could do some pretty nifty 5.1 simulation for headphone . But those asound.conf are like crypt messages for me and I don't have a clue on how to separate each channel for the HRTF plugin and then remixing everything.
this is the plugin:
http://quitte.de/dsp/caps.html#HRTF
Last edited by Adriano ML (2010-07-06 06:11:04)
Offline
downmix multichannel to stereo/bineural
I've never had to do that in ALSA. Usually, the app (e.g. mplayer) can downmix for you, if you configure the app.
Anyway, start a *new* thread for that - this thread is complicated enough already, without being hijacked.
Offline
Hi brebs!
I am finally back and have time now.
I tested your last .asoundrc without modifications. But I have no success. All applications say device or ressource is already busy.
I should give some more information...
cat /proc/asound/cards
0 [CA0106 ]: CA0106 - CA0106
Audigy SE [SB0570] at 0xe800 irq 21
1 [SB ]: HDA-Intel - HDA ATI SB
HDA ATI SB at 0xf9ff4000 irq 16
cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 2048
buffer_size: 16384
somehow this is different from your output. Especially the channels.
This is error output of mplayer:
MPlayer SVN-r32025-4.5.1 (C) 2000-2010 MPlayer Team
159 audio & 347 video codecs
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing 10 - Ludwig II. - Prologue.mp3.
Audio only file format detected.
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 48.0 kbit/3.40% (ratio: 6000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO_ALSA] alsa-lib: pcm_hw.c:1293:(snd_pcm_hw_open) open '/dev/snd/pcmC0D0p' failed (-16): Device or resource busy
[AO_ALSA] alsa-lib: pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
[AO_ALSA] Playback open error: Device or resource busy
Failed to initialize audio driver 'alsa:device=ch51dup'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video
Exiting... (End of file)
Looks like I need to adjust my .asoundrc to my hardware or something. But I have no clue.
Offline
[AO_ALSA] alsa-lib: pcm_hw.c:1293:(snd_pcm_hw_open) open '/dev/snd/pcmC0D0p' failed (-16): Device or resource busy
So, see what is using it:
fuser -v /dev/snd/* /dev/dsp*
Offline
For some reason it shows nothing. Sound is still not working but the output of mplayer is different now:
[AO_ALSA] alsa-lib: conf.c:1645:(snd_config_load1) _toplevel_:41:26:Unexpected char
[AO_ALSA] alsa-lib: conf.c:3425:(snd_config_hook_load) /home/florian/.asoundrc may be old or corrupted: consider to remove or fix it
[AO_ALSA] alsa-lib: conf.c:3286:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
[AO_ALSA] alsa-lib: conf.c:3671:(snd_config_update_r) hooks failed, removing configuration
[AO_ALSA] Playback open error: Invalid argument
Failed to initialize audio driver 'alsa:device=ch51dup'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video
Exiting... (End of file)
VLC shows the same error and Exaile says "konfigured audiosink 'bin1' does not work". But in .asoundrc there is no "bin1"...
It's exactly the same .asoundrc you posted above.
Edit:
I noticed that nano messed the line breaks up. So longer comments started in a new line and were not commented of course. I fixed that. Now the output is:
[AO_ALSA] alsa-lib: pcm_direct.c:936:(snd1_pcm_direct_initialize_slave) unable to set buffer size
[AO_ALSA] alsa-lib: pcm_dmix.c:1030:(snd_pcm_dmix_open) unable to initialize slave
[AO_ALSA] Playback open error: Invalid argument
Failed to initialize audio driver 'alsa:device=ch51dup'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video
Edit2
I set a different Buffer size in .asoundrc as the comment told.
Now
[AO_ALSA] Unable to get initial parameters: Invalid argument
Failed to initialize audio driver 'alsa:device=ch51dup'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video
cat /proc/asound/card0/pcm0p/sub0/hw_params
closed
speaker-test -c 6 -D surround51 -t wav gives output on front left and front right And I read it might be a problem since kernel 2.6.34
Last edited by McFlow (2010-09-07 12:36:59)
Offline
I still cannot get it to work
This is exactly the .asoundrc file I use right now: http://pastebin.com/9aCQbcMt
However sound will just be played on front left and front right. Everything else will stay silent.
[florian@errorkiste ~]$ speaker-test -c 6 -D surround51 -t wav
speaker-test 1.0.23
Wiedergabe-Gerät ist surround51
Stream-Parameter sind 48000 Hz, S16_LE, 6 Kanäle
WAV-Datei(en)
Rate ist 48000 Hz (angefordert: 48000 Hz)
Puffergröße von 4000 bis 10000
Periodengröße von 2000 bis 2000
Verwende maximale Puffergröße 10000
Perioden = 4
gesetzt: period_size = 2000
gesetzt: buffer_size = 10000
0 - Vorne links #sound
4 - Mitte
1 - Vorne rechts #sound
3 - Hinten rechts
2 - Hinten links
5 - Bass
cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 2000
buffer_size: 10000
I have no clue what I am doing wrong.
Offline
channels: 2
You want that to be 6. Run alsamixer. I have a setting in there, to switch between 2 channels and 6 channels. Actually the options are: 2ch, 4ch, 6ch.
$ amixer | grep -B2 -i 6ch
Simple mixer control 'Channel Mode',0
Capabilities: enum
Items: '2ch' '4ch' '6ch'
Item0: '6ch'
Offline
Hi brebs,
Unfortunately there is no such option in my alsamixer. I searched a bit and found the command
amixer -q set "Channel mode" "6ch"
But it just returns
amixer: Unable to find simple control 'Channel mode',0
The command you posted above returns nothing. I also tried several GUIs for alsamixer but none of them can make the channel mode option visible.
Thank you much for your patience brebs! Merry Christmas
Last edited by McFlow (2010-12-24 10:15:44)
Offline