You are not logged in.

#1 2012-08-28 06:53:21

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

[CLOSED] ALSA - surround, and multiple applications

OK - I've spent an age reading and trying things without nailing this, so time to post.

I've just reverted to ALSA from OSS after purchasing 5:1 speakers and learning that OSS support for surround sound on my system is practically non-existent. Now, I have the surround working with ALSA but I'm hitting the "device or resource is busy" problem if two applications try to access my audio. I don't have a complicated setup with regard to my audio needs, and .asoundrc is pretty minimal, as follows:

defaults.pcm.card 0
defaults.pcm.device 0
defaults.ctl.card 0

pcm.!default {
    type plug
    slave.pcm "surround51"
    slave.channels 6
    route_policy duplicate
}

but what can I do to beat the exclusive access problem? Nothing I've tried to date (details of which could fill a book), though I'm sure that there should be a simple solution and a simple addition/modification to .asoundrc. Whatever the asound voodoo is though, it's got me beat. Any help out there?

Creative X-Fi Audio sound card.

TIA

Last edited by Roken (2012-08-30 19:25:38)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#2 2012-08-29 18:29:06

keepitsimpleengineer
Member
From: San Joaquin Valley, CA
Registered: 2012-06-25
Posts: 380

Re: [CLOSED] ALSA - surround, and multiple applications

Are you using "pulseaudio"?


Al Einstein: "Man soll die Dinge so einfach machen wie möglich ~ aber nicht einfacher." (Things should be as simple as possible ~ but not too simple.) ~ Al (Einstein) war ein Cousin von Albert, "Al" ist die Abkürzung für Aloysius

Offline

#3 2012-08-29 18:44:48

progandy
Member
Registered: 2012-05-17
Posts: 5,202

Re: [CLOSED] ALSA - surround, and multiple applications

If you aren't uing pulseaudio, your soundcard probably doesn't support hardware mixing. Here is some info about configuring dmix:
https://bbs.archlinux.org/viewtopic.php?id=145505


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2012-08-29 19:33:13

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [CLOSED] ALSA - surround, and multiple applications

Roken wrote:

asound voodoo

Here's the answer:  my ~/.asoundrc

Offline

#5 2012-08-29 20:51:28

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: [CLOSED] ALSA - surround, and multiple applications

I absolutely am NOT using pulseaudio (and if I can possibly help it, I never will).

@brebs - I stumbled across your .asoundrc during my travels over the last couple of days, though I didn't stumble upon the thread linked to by progandy so I didn't realise that your .asound should be used piecemeal. I'll try again by breaking it down as much as mu alsa knowledge will let me and post back if I have more questions.

Tonight I did try removing the creative card and reverting to oss with onboard HDAudio, and whilst I managed to get a 6 channel test wav playing correctly, surround in applications still wasn't exactly thrilling, so I'm back to alsa now and will really have to start learning more about the configuration.

I'm also learning a couple of other things, such as my preferred video player of vlc is a nightmare with 5:1, so since I was already using kaffeine for broadcast digital TV I decided to try it for DVD and wow, true surround with no messing. Clementine also supports proper decoding of surround with mp3 which vlc doesn't, so clementine has reinforced itself in my mind as my preferred audio player.

OK, so I've got a bunch of disparate kde and qt libs scattered about my nice, lean xfce system, but hey, I'm no purist. If it works, it's all good. (Well, except pulse which has just never been worth the effort for me and is a resource hog anyway - at least here).

Thanks for the replies, guys. I'll post back with results.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#6 2012-08-29 21:25:25

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

Re: [CLOSED] ALSA - surround, and multiple applications

Roken wrote:

video player of vlc is a nightmare with 5:1

It's a bit obtuse (4199???) but 5.1 works fine for me

$ vlc -H|grep alsa-audio
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
      --alsa-audio-device {default}
      --alsa-audio-channels {1 (Mono), 6 (Stereo), 102 (Surround 4.0), 4198 (Surround 4.1), 103 (Surround 5.0), 4199 (Surround 5.1)}

I have a wrapper for vlc that detects if my 5.1 USB soundcard is connected

USBCARD="surround51:CARD=Device,DEV=0"
VLCOPTS=""

if ( aplay -L | grep -q $USBCARD ) ; then
    VLCOPTS="--alsa-audio-device $USBCARD --alsa-audio-channels 4199 --equalizer-preset ska"
fi

vlc $VLCOPTS "$1"

Offline

#7 2012-08-29 21:32:04

keepitsimpleengineer
Member
From: San Joaquin Valley, CA
Registered: 2012-06-25
Posts: 380

Re: [CLOSED] ALSA - surround, and multiple applications

Roken wrote:

I absolutely am NOT using pulseaudio (and if I can possibly help it, I never will).

I share your pain.

I use an ancient Creative audigy 2 ZS sound card (snd_emu10k1) with an ATI video card, and I had fits.  After installing Pulse Audio, things improved, which is why I asked.

Following closely the Arch wiki was also helpful and running ALSA information script proved useful.  You can see mine at http://pastebin.com/iRJamGBK.

Also note that the current ARCH linux kernel fails to produce any sound for me.  I have reverted to the lts kernel as a workaround. (linux-lts) ~ bug filed.

Cheers, and good luck.

Last edited by keepitsimpleengineer (2012-08-29 21:40:26)


Al Einstein: "Man soll die Dinge so einfach machen wie möglich ~ aber nicht einfacher." (Things should be as simple as possible ~ but not too simple.) ~ Al (Einstein) war ein Cousin von Albert, "Al" ist die Abkürzung für Aloysius

Offline

#8 2012-08-29 22:29:11

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: [CLOSED] ALSA - surround, and multiple applications

Well, no joy. I had tried dmix 6 channel already, and now tried it with your .asoundrc (though I had to switch to S32_LE otherwise I got a segfault), and whilst it goes through all the motions of playing 6 channels, I only get front left and right. Centre, sub and rear speakers remain (not so blissfully) silent. With the surround51 plug (built in) I get all 6 channels but exclusive access only.

I'm beginning to think it's a lost cause. Maybe I should just invest in a new soundcard that isn't a Creative card.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#9 2012-08-29 22:39:56

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [CLOSED] ALSA - surround, and multiple applications

Roken wrote:

I only get front left and right

When playing *what*? That's exactly what you'd expect, if playing stereo.

Do a proper, simple test:

speaker-test -c 6 -D surround51 -t wav

Using my redefined surround51, of course:

pcm.!surround51 {
    type plug
    slave.pcm "dmixed"
}

Offline

#10 2012-08-29 23:55:54

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: [CLOSED] ALSA - surround, and multiple applications

I did - and I got "left front" - silence -  "right front" - silence - silence - silence - "Left front" - silence ........

Last edited by Roken (2012-08-29 23:57:11)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#11 2012-08-30 00:12:58

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [CLOSED] ALSA - surround, and multiple applications

Do you have an app keeping the soundcard open? Check:

$ cat /proc/asound/card0/pcm0p/sub0/hw_params
closed

Offline

#12 2012-08-30 19:25:18

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: [CLOSED] ALSA - surround, and multiple applications

There was definitely nothing locking the soundcard. After trying several permutations I've concluded that dmix won't tie the three audio devices (front, centre and rear) together, and so I climbed into bed with the devil and decided to give pulse another chance.

I have to say my previous experiences with pulse have been on generally pre-built distros, and because of the poor experiences I avoided it like the plague when I built my Debian system, LFS and then Arch, and I have to say that it's a comparitive joy to set up on Arch (took me all of 20 seconds) and it works.

Now, I just have to get audio out of wine again (currently building wine-multimedia from AUR with the pulseaudio patches) and I'll be happy.

Marking as closed, since the original problem wasn't actually solved, but was rather circumvented.

Thanks for your patience and your help. I just think that the Creative X-Fi audio is such a mishmash hybrid thing that it will never work with either oss or alsa the way I want it to. It was fine with oss when it was just connected to stereo speakers, but everything went to hell with 5:1 speakers. C'est la vie.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

Board footer

Powered by FluxBB