All of lore.kernel.org
 help / color / mirror / Atom feed
* Sound programming confusion
@ 2004-02-25 19:16 Ken Bass
  2004-02-26  4:39 ` Ken Bass
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Bass @ 2004-02-25 19:16 UTC (permalink / raw)
  To: alsa-devel

I'm trying to accomplish a programming task and am pretty confused about
the capabilities of the sound drivers and how I would accomplish this in
an application. I've been through the HOWTO and tutorial as well as
attempted to read the PCM interface parts of the also-lib docs. But I've
got more questions than answers. The SB-Live-mixer.txt was not helpful.

I've got an SB Live! 5.1 (EMU10K1) device that is my target using analog
outputs.

High Level:

1) I've got 3 separate PCM 'mono' streams of data that I want to send to
3 different outputs.

  a) How many PCM inputs do these cards/drivers support? Under OSS,
there were 2, /dev/dsp and /dev/dsp1. Ideally I would like each input
stream to have a seperate sample rate. In practice, 2 of them will be
25kHz, and one will be 22050Hz.
  
2) I want to reconfigure the 'routing' on the fly. How do I do this?
I've seen documentation (which wasn't clear) about .asoundrc files and
such, but I need to change this programmaticaly.
  Input 1- 25 kHz PCM stream 
  Input 2- 25 kHz PCM stream
  Input 3- 22050Hz PCM stream
  Output 1 - Front L
  Output 2 - Front R
  Output 3 - Rear L
  
  I want to route (on the fly) any of those inputs to any of those
outputs (being careful to erase all routes and recreate them each time I
reconfigure).

3) I'm totally confused about the capabilities of this card. Is this
described at a high level somewhere or can someone explain this?

4) I'm not clear how to control these routes, what 'hw' device names to
use, etc. I've seen references to ld10k1, 

5) In the SB-Live-mixer.txt, section 3, PCM stream related controls --
I'm lost. What is a PCM Send Routing, what are A, B, C, D destinations,
why is there a distinction between mono and left/right, and how are
these controlled?

6) I see references to 'surround40' or 'surround51'. I'm not sure if
that is what I want because they cannot be changed on the fly.




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sound programming confusion
  2004-02-25 19:16 Sound programming confusion Ken Bass
@ 2004-02-26  4:39 ` Ken Bass
  2004-02-26 10:05   ` Patrick Shirkey
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Bass @ 2004-02-26  4:39 UTC (permalink / raw)
  To: alsa-devel@lists.sourceforge.net

Here is another questions (to make it easier):

7) How do I do accomplish this using an asoundrc file? I can't even
figure that out. I've got an SB Live! 5.1 (EMU10K1).
How do I 'simply' setup 2 'streams' (not sure I'm using the correct
terminology).
  The first stereo 'stream' would output to the front L/R speakers at
25kHz. This first stream would only require an input 'wav' file of 2
channels (stereo).
  The second 'stream' would output to the rear L speaker at 22050Hz.
This second would only require an inpt 'wav' file of 1 channel (mono).

  I mean under OSS this is so simple! Open /dev/dsp at 25kHz and open
/dev/dsp1 at 22050Hz. Unfortunately, I cannot get the routing to work
reliably under OSS which is why I'm attempting the world of ALSA. 


On Wed, 2004-02-25 at 14:16, Ken Bass wrote:
> I'm trying to accomplish a programming task and am pretty confused about
> the capabilities of the sound drivers and how I would accomplish this in
> an application. I've been through the HOWTO and tutorial as well as
> attempted to read the PCM interface parts of the also-lib docs. But I've
> got more questions than answers. The SB-Live-mixer.txt was not helpful.
> 
> I've got an SB Live! 5.1 (EMU10K1) device that is my target using analog
> outputs.
> 
> High Level:
> 
> 1) I've got 3 separate PCM 'mono' streams of data that I want to send to
> 3 different outputs.
> 
>   a) How many PCM inputs do these cards/drivers support? Under OSS,
> there were 2, /dev/dsp and /dev/dsp1. Ideally I would like each input
> stream to have a seperate sample rate. In practice, 2 of them will be
> 25kHz, and one will be 22050Hz.
>   
> 2) I want to reconfigure the 'routing' on the fly. How do I do this?
> I've seen documentation (which wasn't clear) about .asoundrc files and
> such, but I need to change this programmaticaly.
>   Input 1- 25 kHz PCM stream 
>   Input 2- 25 kHz PCM stream
>   Input 3- 22050Hz PCM stream
>   Output 1 - Front L
>   Output 2 - Front R
>   Output 3 - Rear L
>   
>   I want to route (on the fly) any of those inputs to any of those
> outputs (being careful to erase all routes and recreate them each time I
> reconfigure).
> 
> 3) I'm totally confused about the capabilities of this card. Is this
> described at a high level somewhere or can someone explain this?
> 
> 4) I'm not clear how to control these routes, what 'hw' device names to
> use, etc. I've seen references to ld10k1, 
> 
> 5) In the SB-Live-mixer.txt, section 3, PCM stream related controls --
> I'm lost. What is a PCM Send Routing, what are A, B, C, D destinations,
> why is there a distinction between mono and left/right, and how are
> these controlled?
> 
> 6) I see references to 'surround40' or 'surround51'. I'm not sure if
> that is what I want because they cannot be changed on the fly.
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sound programming confusion
  2004-02-26  4:39 ` Ken Bass
@ 2004-02-26 10:05   ` Patrick Shirkey
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick Shirkey @ 2004-02-26 10:05 UTC (permalink / raw)
  To: Ken Bass; +Cc: alsa-devel@lists.sourceforge.net

Ken Bass wrote:
> Here is another questions (to make it easier):
> 
> 7) How do I do accomplish this using an asoundrc file? I can't even
> figure that out. I've got an SB Live! 5.1 (EMU10K1).
> How do I 'simply' setup 2 'streams' (not sure I'm using the correct
> terminology).
>   The first stereo 'stream' would output to the front L/R speakers at
> 25kHz. This first stream would only require an input 'wav' file of 2
> channels (stereo).
>   The second 'stream' would output to the rear L speaker at 22050Hz.
> This second would only require an inpt 'wav' file of 1 channel (mono).
> 
>   I mean under OSS this is so simple! Open /dev/dsp at 25kHz and open
> /dev/dsp1 at 22050Hz. Unfortunately, I cannot get the routing to work
> reliably under OSS which is why I'm attempting the world of ALSA. 
>

use:

	hw:0,0
  	hw:0,1

They should be seperate subdevices for that card.


-- 
Patrick Shirkey - Boost Hardware Ltd.
Http://www.boosthardware.com
Http://www.djcj.org/LAU/guide/ - The Linux Audio Users guide
Http://www.djcj.org/gigs/ - Gigs guide Korea
========================================


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



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sound programming confusion
@ 2004-02-26 19:36 p z oooo
  0 siblings, 0 replies; 4+ messages in thread
From: p z oooo @ 2004-02-26 19:36 UTC (permalink / raw)
  To: kbass; +Cc: alsa-devel

Hi,

>1) I've got 3 separate PCM 'mono' streams of data that I want to 
>send to
>3 different outputs.

Should work.

>  a) How many PCM inputs do these cards/drivers support? Under OSS,
>there were 2, /dev/dsp and /dev/dsp1. Ideally I would like each 
>input
>stream to have a seperate sample rate. In practice, 2 of them will 
>be

If you how many PCM streams you may play at one time, then 32.

>25kHz, and one will be 22050Hz.

This should work.

>2) I want to reconfigure the 'routing' on the fly. How do I do this?
>I've seen documentation (which wasn't clear) about .asoundrc files 
and
>such, but I need to change this programmaticaly.
>  Input 1- 25 kHz PCM stream 
>  Input 2- 25 kHz PCM stream
>  Input 3- 22050Hz PCM stream
>  Output 1 - Front L
>  Output 2 - Front R
>  Output 3 - Rear L

Then you must use control (mixer) interface too.

>3) I'm totally confused about the capabilities of this card. Is this
>described at a high level somewhere or can someone explain this?

http://people.freenet.de/kxdev/docs/original/emu10k1-overview.pdf
http://people.freenet.de/kxdev/docs/original/fx8010-arch.pdf

>5) In the SB-Live-mixer.txt, section 3, PCM stream related 
controls --
>I'm lost. What is a PCM Send Routing, what are A, B, C, D 
destinations,
>why is there a distinction between mono and left/right, and how are
>these controlled?

Look at previous docs. 
Alsa uses for pcm playback wavetable synth of emu10k1. Each voice of 
this synth can by connected
up to 4 DSP inputs and "PCM send Routing". DSP has actualy 16 of 
this inputs (FX bus). Then DSP executes 
program and process these inputs and outputs it to DAC. 
For example if you play one PCM stream, one voice of wavetable synth 
is used. Output of this voice
can be send to 4 (this is A, B, C, D) FX bus inputs (this is 
destination - 0 - 15).

Alsa uses these FX busses - they are forwarded to outputs.
FXBUS_PCM_LEFT		0x00 - everything from this goes to Front 
Left speaker
FXBUS_PCM_RIGHT		0x01 - everything from this goes to Front 
Right speaker
FXBUS_PCM_LEFT_REAR	0x02 - everything from this goes to Rear 
Left speaker
FXBUS_PCM_RIGHT_REAR	0x03 - everything from this goes to Rear 
Right speaker
FXBUS_MIDI_LEFT		0x04 - not usefull for you
FXBUS_MIDI_RIGHT	0x05 - not usefull for you
FXBUS_PCM_CENTER	0x06 - everything from this goes to Center 
speaker
FXBUS_PCM_LFE		0x07 - everything from this goes to Subwoffer
FXBUS_PCM_LEFT_FRONT	0x08 - not usefull for you - used on Audigy
FXBUS_PCM_RIGHT_FRONT	0x09 - not usefull for you - used on Audigy

For mono PCM stream 1 voice is used.
For stereo PCM stream 2 voices are used.

For device 0 of sb live there are 32 substreams (0-31).
you can open any of them using hw:x,0,y device name where x is card 
number - for you 0
and y is substream number (0-31). Warning you should use free stream 
(check /proc/asound)

You can control routing using these controls (they control 1 voice 
for mono PCM stream and 2 voices for stereo PCM stream):
EMU10K1 PCM Volume - this controls volume of PCM stream and there 
are 32 of these control with
index 0-31 - this is substream number.
It has three values:
0 - mono, default 0xffff (no attenuation) - this controls volume of 
mono stream
1 - left, default 0xffff (no attenuation) - this controls volume of 
left channel of stream
2 - right, default 0xffff (no attenuation) - this controls volume of 
right channel of stream

When you open mono stream only value 0 is used
When you open stereo stream only values 1,2 are used

EMU10K1 PCM Send Routing - this controls routing (means where to 
send) of PCM stream and there are 32 of these control with
index 0-31 - this is substream number.
It has 12 values:
0 -  mono, A destination (FX-bus 0-15), default 0
1 -  mono, B destination (FX-bus 0-15), default 1
2 -  mono, C destination (FX-bus 0-15), default 2
3 -  mono, D destination (FX-bus 0-15), default 3
4 -  left, A destination (FX-bus 0-15), default 0
5 -  left, B destination (FX-bus 0-15), default 1
6 -  left, C destination (FX-bus 0-15), default 2
7 -  left, D destination (FX-bus 0-15), default 3
8 - right, A destination (FX-bus 0-15), default 0
9 - right, B destination (FX-bus 0-15), default 1
10 - right, C destination (FX-bus 0-15), default 2
11 - right, D destination (FX-bus 0-15), default 3

this means, where you want route this stream.

When you open mono stream only value 0,1,2,3 are used
When you open stereo stream only values 4,5,6,7,8,9,10,11 are used

EMU10K1 PCM Send Volume - this controls routing (means how much to 
send) of PCM stream and there are 32 of these control with
index 0-31 - this is substream number. This is pair with EMU10K1 PCM 
Send Routing
It has 12 values:
0 -  mono, A destination attn, default 255 (no attenuation)
1 -  mono, B destination attn, default 255 (no attenuation)
2 -  mono, C destination attn, default 0 (mute)
3 -  mono, D destination attn, default 0 (mute)
4 -  left, A destination attn, default 255 (no attenuation)
5 -  left, B destination attn, default 0 (mute)
6 -  left, C destination attn, default 0 (mute)
7 -  left, D destination attn, default 0 (mute)
8 - right, A destination attn, default 0 (mute)
9 - right, B destination attn, default 255 (no attenuation)
10 - right, C destination attn, default 0 (mute)
11 - right, D destination attn, default 0 (mute)

When you open mono stream only value 0,1,2,3 are used
When you open stereo stream only values 4,5,6,7,8,9,10,11 are used

For example:
You want play mono stream to front right and rear left speaker
then you should set values like this:
EMU10K1 PCM Send Routing[stream_number][0] = 1 (FXBUS_PCM_RIGHT)
EMU10K1 PCM Send Routing[stream_number][1] = 2 (FXBUS_PCM_LEFT_REAR)
EMU10K1 PCM Send Routing[stream_number][2] = 0 (not used)
EMU10K1 PCM Send Routing[stream_number][3] = 0 (not used)

EMU10K1 PCM Send Volume[stream_number][0] = 255 (FXBUS_PCM_RIGHT)
EMU10K1 PCM Send Volume[stream_number][1] = 255 (FXBUS_PCM_LEFT_REAR)
EMU10K1 PCM Send Volume[stream_number][2] = 0 (not used)
EMU10K1 PCM Send Volume[stream_number][3] = 0 (not used)

You want play stereo stream left channle to front right and rear 
left speaker
then you should set values like this:
EMU10K1 PCM Send Routing[stream_number][4] = 1 (FXBUS_PCM_RIGHT)
EMU10K1 PCM Send Routing[stream_number][5] = 0 (not used)
EMU10K1 PCM Send Routing[stream_number][6] = 0 (not used)
EMU10K1 PCM Send Routing[stream_number][7] = 0 (not used)
EMU10K1 PCM Send Routing[stream_number][8] = 0 (not used)
EMU10K1 PCM Send Routing[stream_number][9] = 2 (FXBUS_PCM_LEFT_REAR)
EMU10K1 PCM Send Routing[stream_number][10] = 0 (not used)
EMU10K1 PCM Send Routing[stream_number][11] = 0 (not used)

EMU10K1 PCM Send Volume[stream_number][4] = 255 (FXBUS_PCM_RIGHT)
EMU10K1 PCM Send Volume[stream_number][5] = 0 (not used)
EMU10K1 PCM Send Volume[stream_number][6] = 0 (not used)
EMU10K1 PCM Send Volume[stream_number][7] = 0 (not used)
EMU10K1 PCM Send Volume[stream_number][8] = 0 (not used)
EMU10K1 PCM Send Volume[stream_number][9] = 255 (FXBUS_PCM_LEFT_REAR)
EMU10K1 PCM Send Volume[stream_number][10] = 0 (not used)
EMU10K1 PCM Send Volume[stream_number][11] = 0 (not used)

This may be not correct (I think that this is how it works). I newer 
tryed this, but I want
know if this works.
Maybe you must (if you can't set controls values) remove "lock true" 
from /usr/share/alsa/conf/cards/emu10k1.conf
under 
name "EMU10K1 PCM Send Volume"
and
name "EMU10K1 PCM Send Routing"
otherways you can change routing on the fly (maybe, I don't know).


>7) How do I do accomplish this using an asoundrc file? I can't even
>figure that out. I've got an SB Live! 5.1 (EMU10K1).
>How do I 'simply' setup 2 'streams' (not sure I'm using the correct
>terminology).
 
Look at /usr/share/alsa/conf/cards/emu10k1.conf (devices front, 
rear, ...)

If you have more questions then ask, I'll try to help if I know 
(latency may be high :-)).

Peter Zubaj



____________________________________
http://www.logofun.pobox.sk - urobte radost svojmu telefonu



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-26 19:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-25 19:16 Sound programming confusion Ken Bass
2004-02-26  4:39 ` Ken Bass
2004-02-26 10:05   ` Patrick Shirkey
  -- strict thread matches above, loose matches on Subject: below --
2004-02-26 19:36 p z oooo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.