LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-19-2006, 11:52 PM   #1
Tylerious
Member
 
Registered: Feb 2005
Location: USA
Distribution: Gentoo
Posts: 72

Rep: Reputation: 15
Multi-application sound


I've been trying to get multi-application sound working. Right now I have aRts (on KDE) working with ALSA. The problem is that artsd uses about 35% of the CPU (not even set to realtime priority) in addition to whatever the actual media player uses.

I heard about ALSA's dmix capabilities and am wondering if I could somehow use that instead of aRts with KDE apps like Juk. I just don't know how to get it set up. This is the only thing I see that makes Windows and Apple as improvements: a good sound system. Any help is greatly appreciated.
 
Old 02-21-2006, 12:12 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
we need to know what kind of sound card
first thing to do is just turn of artsd
then set apps to output to alsa.
 
Old 02-21-2006, 11:01 PM   #3
Tylerious
Member
 
Registered: Feb 2005
Location: USA
Distribution: Gentoo
Posts: 72

Original Poster
Rep: Reputation: 15
I have an ISAPNP Cirrus Logic (Crystal Semiconductors) CS4237B soundcard. That works under the ALSA snd-cs4236 kernel module.

I can turn off arts in KDE's control center and (hopefully) recompile amarok with alsa support (and without arts support).

The problem is, ALSA is working like OSS: whatever application gets to the device first owns it and nothing else can share it. But I can change this with dmix, I hear?
 
Old 02-22-2006, 01:09 AM   #4
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
Quote:
But I can change this with dmix, I hear?
Yeah, in a way. Alsa is supposeed to support dmix by default from 1.0.9 onwards but I've had mixed results. Archie (a live CD) does, no touching dmix works. My local Arch install, no love. I finally got it working with this in my ~/.asoundrc
Code:
pcm.ossmix {
    type dmix
    ipc_key 1024          # must be unique!
    ipc_perm 0660         # sound for everybody (at least in your group)
    slave {
        pcm "hw:0,0"      # you cannot use a "plug" device here, darn.
        period_time 0
        period_size 1024  # must be power of 2
        buffer_size 8192  # dito. It
        #format "S32_LE"
        #periods 128      # dito.
        #rate 8000        # with rate 8000 you *will* hear,
                          # if ossmix is used :)
    }
}
# bindings are cool. This says, that only the first
# two channels are to be used by dmix, which is enough for
# (most) oss apps and also lets multichannel chios work
# much faster:

bindings {
        0 0   # from 0 => to 0
        1 1   # from 1 => to 1
}

pcm.dsp0 {
    type plug
    slave.pcm "ossmix"     # use our new PCM here
}
# mixer0 like above
ctl.mixer0 {
    type hw
    card 0
Try your luck, the Alsa web site has a large DB of sound cards and some good info on each one
 
Old 02-23-2006, 11:31 PM   #5
Tylerious
Member
 
Registered: Feb 2005
Location: USA
Distribution: Gentoo
Posts: 72

Original Poster
Rep: Reputation: 15
I used that as my ~/.asoundrc, but when I try to let two programs play sound, the second still complains about not having access to the soundcard. Do I need to specify a specific device for them (amaroK and aplay) to use? Would it be "ossmix" or "dsp0"? Neither of those seemed to work.

What about JACK? It sounds very similar to dmix, but more flexibility. Does its "low-latency" result in high-overhead?

I wish they'd just agree about this for linux. Find a good driver component (ALSA), a good mixer/server component (JACK or dmix), and leave only the media engine itself to the individual application. Having apps that only support certain sound systems is just ridiculous. Trying to get sound in Kopete without aRts? No way because Kopete doesn't have native ALSA support. Drives me nuts and I'm sure it keeps some people away from linux.

Last edited by Tylerious; 02-24-2006 at 07:48 AM.
 
Old 02-24-2006, 10:00 AM   #6
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
There's really no substitute for a sound card that does hardware mixing. But, try this one:

Code:
pcm.!default {
        type plug
        slave.pcm "swmixer"
}

pcm.swmixer {
        type dmix
        ipc_key 1234
        slave {
                pcm "hw:0,0"
                period_time 0
                period_size 1024
                buffer_size 4096
                rate 44100
        }
}
ctl.swmixer {
    type hw
    card 0
}
(Pretty much straight from alsa w/ste)
 
Old 02-24-2006, 10:02 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
You could also try setting 'auto-suspend' down to 0 seconds in Kde control centre - sounds & mm
 
Old 02-25-2006, 11:15 AM   #8
Tylerious
Member
 
Registered: Feb 2005
Location: USA
Distribution: Gentoo
Posts: 72

Original Poster
Rep: Reputation: 15
Thanks, your second .asoundrc example worked great. amaroK was being dumb about me stting a new ALSA device for the audio engine, but that's working now.

Thanks again! Why don't apps just output to dmix (or hardware mixers) instead of going through audio servers?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GTK multi-threaded application akhil1 Programming 2 01-20-2009 03:59 AM
global integer in the multi-thread application lordofring Programming 1 08-23-2005 09:36 PM
Multi-Langual implemention proble in application biru_vanshi Programming 1 11-05-2004 04:04 AM
Multi-Langual implemention problem in application biru_vanshi Linux - Software 1 11-04-2004 03:00 AM
how to debug multi threaded application sibtay Programming 3 10-15-2004 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration