LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-30-2008, 02:18 AM   #1
satmeet
LQ Newbie
 
Registered: May 2008
Posts: 2

Rep: Reputation: 0
Question How to do Alsa configuration (asoundrc) on-the-run while an application is running?


Hi,
I am new to alsa and need to know if i can contorl the volume on different channels dynamically or on-the-fly by modifying file asoundrc.
We have written the following lines of code-

Code:
pcm.mycard {
    type hw
    card 0
    device 0
}

pcm.dshare {
   type dmix
   ipc_key 2048
   slave{
	pcm mycard
	rate 44100
        period_time 1024
        buffer_size 8192
	channels 2
	}
    bindings{
	0 0
	1 1
      }
}

pcm.conf1 {
         type plug
         slave{
	   pcm "dshare"
           channels 2
         }
         ttable.0.0 0.9
         ttable.1.1 0.1
}
This does the volume control statically (one time) the application (mplayer) starts using this device mentioned as 'conf1'. Now, i make following changes to the asoundrc file to

change the volume level on the channels while the application is running.

Code:
        ttable.0.0 0.1
        ttable.1.1 0.9

But the changes do not reflect. I need to restart the application for the changes to take effect.

Is there any way i can achieve this without having to restart the application?
Kindly reply.

Last edited by satmeet; 05-30-2008 at 02:22 AM.
 
Old 05-30-2008, 09:48 PM   #2
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Rep: Reputation: 70
try using amixer
 
Old 06-02-2008, 12:07 AM   #3
satmeet
LQ Newbie
 
Registered: May 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for your reply but..

We can use amixer for the purpose but how would i be able to control the volume of individual audio streams?
For example-
I have three songs being played by three instances of mplayer at the same time and i want to listen to the three different songs on three different channels/speakers. Or song1 with 90% volume in speaker1 and 10% in speaker2. and song2 with 33% in speaker1 and 33% in speaker2 and rest in speaker3. and so on...

Is it possible?
Does alsa API's provide such a functionality?

Please reply.

Thanks.
 
Old 06-02-2008, 09:18 AM   #4
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,441

Rep: Reputation: 70
I think you just need to specify the channels you want to change when you use amixer.

Quote:
Originally Posted by man amixer
set or sset <SCONTROL> <PARAMETER> ...
Sets the simple mixer control contents. The parameter can be the
volume either as a percentage from 0% to 100% with % suffix, a
dB gain with dB suffix (like -12.5dB), or an exact hardware
value. The dB gain can be used only for the mixer elements with
available dB information. When plus(+) or minus(-) letter is
appended after volume value, the volume is incremented or decre-
mented from the current value, respectively.

The parameters cap, nocap, mute, unmute, toggle are used to
change capture (recording) and muting for the group specified.

The optional modifiers can be put as extra parameters to specify
the stream direction or channels to apply. The modifiers play-
back and capture specify the stream, and the modifiers front,
rear, center, woofer are used to specify channels to be changed.


A simple mixer control must be specified. Only one device can be
controlled at a time.
Try using the scontrols arg to see what channels you can manipulate. Please see the full man page for amixer for some examples and more details on usage.

Alternatively, if you have more than one soundcard you can split the jobs among them and control them separately.
 
  


Reply

Tags
alsa, asoundrc, audio, dynamic


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ALSA sound only working with one application at a time squat001 Linux - Software 5 05-12-2013 01:58 AM
"Run Application" dialog box NOT running applications trident Linux - Desktop 5 03-12-2008 10:55 AM
With ALSA only one application plays sounds simopal6 Linux - Hardware 11 07-22-2006 04:13 AM
Need help for ALSA Sound /etc/asound.conf or .asoundrc tho_x_tran Linux - Hardware 0 08-09-2004 02:34 PM
ALSA device stuff ( asoundrc file probably) Tomasfuego Linux - Hardware 1 02-12-2004 06:05 AM


All times are GMT -5. The time now is 12:50 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration