All of lore.kernel.org
 help / color / mirror / Atom feed
* Multiple PCM files
@ 2002-07-30  9:50 Nick French
  2002-07-30 10:11 ` Paul Davis
  0 siblings, 1 reply; 11+ messages in thread
From: Nick French @ 2002-07-30  9:50 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

Sorry I am new to ALSA so forgive me if this is obvious.

Is there any way with ALSA to play multiple PCM files at the same time. Say for example under OSS open DSP0 and DSP1. I thought I read that it could but have only found samples for playing a single PCM stream. Any pointers gratefully appreciated.

Cheers

Nick

[-- Attachment #2: Type: text/html, Size: 920 bytes --]

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

* Multiple PCM files
@ 2002-07-30  9:52 Nick French
  0 siblings, 0 replies; 11+ messages in thread
From: Nick French @ 2002-07-30  9:52 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

Sorry I am new to ALSA so forgive me if this is obvious.

Is there any way with ALSA to play multiple PCM files at the same time. Say for example under OSS open DSP0 and DSP1. I thought I read that it could but have only found samples for playing a single PCM stream. Any pointers gratefully appreciated.

Cheers

Nick

[-- Attachment #2: Type: text/html, Size: 964 bytes --]

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

* Re: Multiple PCM files
  2002-07-30  9:50 Nick French
@ 2002-07-30 10:11 ` Paul Davis
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Davis @ 2002-07-30 10:11 UTC (permalink / raw)
  To: Nick French; +Cc: alsa-devel

>Sorry I am new to ALSA so forgive me if this is obvious.

don't be sorry about that. instead, be sorry for this: whether you
know it or not, the email program you are using is sending out copies
of your mail in both plain text and HTML formats. increasingly on the
net, there are filters being put in place that silently dump
HTML-formatted email. some mailing lists will not ever accept such
posts. as long as you do this, you are (1) wasting network bandwidth
by sending messages that are typically more than twice as long as they
could be (2) making it harder for people using traditional email
readers to read them (3) risking the chance that people will never see
your mail because its filtered before reaching their email inbox.

>Is there any way with ALSA to play multiple PCM files at the same time. =
>Say for example under OSS open DSP0 and DSP1. I thought I read that it =
>could but have only found samples for playing a single PCM stream. Any =
>pointers gratefully appreciated.

Your question isn't very well defined. There are several things you
might be thinking of:

1) a single process playing multiple audio files to a single audio
   interface
2) multiple processes playing multiple audio files to a single audio
   interface
3) multiple processes playing multiple audio files to multiple audio
   interfaces
4) a single process playing multiple audio files to multiple audio
   interfaces

tell us which one it is, and we can provide more specific help. the
use of /dev/dsp0 and /dev/dsp1 under OSS corresponds to either 3 or 4
in the list above, but its not clear which.

--p


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
@ 2002-07-30 10:43 Nick French
  2002-07-30 11:29 ` Paul Davis
  0 siblings, 1 reply; 11+ messages in thread
From: Nick French @ 2002-07-30 10:43 UTC (permalink / raw)
  To: Paul Davis; +Cc: alsa-devel

Ok set the option ( you guessed it Outlook Express ) to text only. Sorry
don't have a go at me as it is the default setting I believe.

Option 1 or 2 would be what I am looking at. What I have is a program with
multiple threads needing to play PCM streams to the same device.

Thanks and sorry for the HTML.

Cheers

Nick

----- Original Message -----
From: "Paul Davis" <pbd@op.net>
To: "Nick French" <nick@greensignal.com>
Cc: <alsa-devel@lists.sourceforge.net>
Sent: Tuesday, July 30, 2002 11:11 AM
Subject: Re: [Alsa-devel] Multiple PCM files


> >Sorry I am new to ALSA so forgive me if this is obvious.
>
> don't be sorry about that. instead, be sorry for this: whether you
> know it or not, the email program you are using is sending out copies
> of your mail in both plain text and HTML formats. increasingly on the
> net, there are filters being put in place that silently dump
> HTML-formatted email. some mailing lists will not ever accept such
> posts. as long as you do this, you are (1) wasting network bandwidth
> by sending messages that are typically more than twice as long as they
> could be (2) making it harder for people using traditional email
> readers to read them (3) risking the chance that people will never see
> your mail because its filtered before reaching their email inbox.
>
> >Is there any way with ALSA to play multiple PCM files at the same time. =
> >Say for example under OSS open DSP0 and DSP1. I thought I read that it =
> >could but have only found samples for playing a single PCM stream. Any =
> >pointers gratefully appreciated.
>
> Your question isn't very well defined. There are several things you
> might be thinking of:
>
> 1) a single process playing multiple audio files to a single audio
>    interface
> 2) multiple processes playing multiple audio files to a single audio
>    interface
> 3) multiple processes playing multiple audio files to multiple audio
>    interfaces
> 4) a single process playing multiple audio files to multiple audio
>    interfaces
>
> tell us which one it is, and we can provide more specific help. the
> use of /dev/dsp0 and /dev/dsp1 under OSS corresponds to either 3 or 4
> in the list above, but its not clear which.
>
> --p
>



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
  2002-07-30 10:43 Nick French
@ 2002-07-30 11:29 ` Paul Davis
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Davis @ 2002-07-30 11:29 UTC (permalink / raw)
  To: Nick French; +Cc: alsa-devel

>Ok set the option ( you guessed it Outlook Express ) to text only. Sorry
>don't have a go at me as it is the default setting I believe.
>
>Option 1 or 2 would be what I am looking at. What I have is a program with
>multiple threads needing to play PCM streams to the same device.

there are some hardware interfaces that support "multi-open", meaning
that several calls to snd_pcm_open() can be made to the same named
device (e.g. "plughw:0,0"). these interfaces have a hardware mixer
that mixes all the streams together before delivering them to the
connectors on the back. on these devices, each thread could open the
device, and do its own writing.

there are other interfaces that have more than one PCM output
device. for example, some have "front" and "back" devices, or "analog"
and "spdif" devices. these are distinct PCM devices that can be
accessed independently from each other. this is basically what you
were using when you used /dev/dsp0 and /dev/dsp1 (assuming you had
only one audio interface installed).

however, you cannot rely on such interfaces in general - there are
many that do not support either of these functions, and your software
will not work if you were to use it on such hardware. this might not
matter to you if your software is only for your own use.

so, instead you need to provide your own internal mixer. your own
threads write into buffers, and then a single thread mixes it together
and delivers it via snd_pcm_write or its cousins and uncles.

--p

ps. personally, as everyone here knows, i would recommend that you use
JACK (jackit.sf.net) and forget about the ALSA layer, but that's your
choice. JACK doesn't make a design with multiple threads delivering
the data any simpler, but it gets rid of all the ALSA device/hardware
related stuff and replaces it with a very simple abstraction.






-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
@ 2002-07-30 12:24 Nick French
  2002-07-30 13:18 ` Paul Davis
  0 siblings, 1 reply; 11+ messages in thread
From: Nick French @ 2002-07-30 12:24 UTC (permalink / raw)
  To: Paul Davis; +Cc: alsa-devel

So does JACKs allow two separate applications to stream PCM audio at the
same time to the same device and if so will it then overlay them? If it will
why would two threads each registering with JACKs not work.

Thanks again

Nick

----- Original Message -----
From: "Paul Davis" <pbd@op.net>
To: "Nick French" <nick@greensignal.com>
Cc: <alsa-devel@lists.sourceforge.net>
Sent: Tuesday, July 30, 2002 12:29 PM
Subject: Re: [Alsa-devel] Multiple PCM files


> >Ok set the option ( you guessed it Outlook Express ) to text only. Sorry
> >don't have a go at me as it is the default setting I believe.
> >
> >Option 1 or 2 would be what I am looking at. What I have is a program
with
> >multiple threads needing to play PCM streams to the same device.
>
> there are some hardware interfaces that support "multi-open", meaning
> that several calls to snd_pcm_open() can be made to the same named
> device (e.g. "plughw:0,0"). these interfaces have a hardware mixer
> that mixes all the streams together before delivering them to the
> connectors on the back. on these devices, each thread could open the
> device, and do its own writing.
>
> there are other interfaces that have more than one PCM output
> device. for example, some have "front" and "back" devices, or "analog"
> and "spdif" devices. these are distinct PCM devices that can be
> accessed independently from each other. this is basically what you
> were using when you used /dev/dsp0 and /dev/dsp1 (assuming you had
> only one audio interface installed).
>
> however, you cannot rely on such interfaces in general - there are
> many that do not support either of these functions, and your software
> will not work if you were to use it on such hardware. this might not
> matter to you if your software is only for your own use.
>
> so, instead you need to provide your own internal mixer. your own
> threads write into buffers, and then a single thread mixes it together
> and delivers it via snd_pcm_write or its cousins and uncles.
>
> --p
>
> ps. personally, as everyone here knows, i would recommend that you use
> JACK (jackit.sf.net) and forget about the ALSA layer, but that's your
> choice. JACK doesn't make a design with multiple threads delivering
> the data any simpler, but it gets rid of all the ALSA device/hardware
> related stuff and replaces it with a very simple abstraction.
>
>
>
>
>



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
  2002-07-30 12:24 Nick French
@ 2002-07-30 13:18 ` Paul Davis
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Davis @ 2002-07-30 13:18 UTC (permalink / raw)
  To: Nick French; +Cc: alsa-devel

>So does JACKs allow two separate applications to stream PCM audio at the
>same time to the same device and if so will it then overlay them? If it will
>why would two threads each registering with JACKs not work.

it might, but it would be very inefficient. every JACK connection
requires a new thread in the client, and implies an IPC per client per
process() callback cycle.

the code to mix down your own threads' output buffers is a few
lines. why bother with anything else?

--p


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
@ 2002-07-30 13:58 Nick French
  0 siblings, 0 replies; 11+ messages in thread
From: Nick French @ 2002-07-30 13:58 UTC (permalink / raw)
  To: Paul Davis; +Cc: alsa-devel

New to this sound thing most of the stuff we have done is graphical what is
the formula for mixing n streams is it as simple as  (stream 1 / number
streams) + ( stream 2 / number of streams ) ..... + (stream n / number of
streams ). What about different sample rates, stereo and mono. Any sample
code around?


Cheers

Nick

----- Original Message -----
From: "Paul Davis" <pbd@op.net>
To: "Nick French" <nick@greensignal.com>
Cc: <alsa-devel@lists.sourceforge.net>
Sent: Tuesday, July 30, 2002 2:18 PM
Subject: Re: [Alsa-devel] Multiple PCM files


> >So does JACKs allow two separate applications to stream PCM audio at the
> >same time to the same device and if so will it then overlay them? If it
will
> >why would two threads each registering with JACKs not work.
>
> it might, but it would be very inefficient. every JACK connection
> requires a new thread in the client, and implies an IPC per client per
> process() callback cycle.
>
> the code to mix down your own threads' output buffers is a few
> lines. why bother with anything else?
>
> --p
>



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
  2002-07-31 20:58 Multiple PCM files Philipp Vollmer
@ 2002-07-31 20:20 ` Nick French
  2002-07-31 22:18   ` Paul Davis
  0 siblings, 1 reply; 11+ messages in thread
From: Nick French @ 2002-07-31 20:20 UTC (permalink / raw)
  To: Philipp Vollmer; +Cc: alsa-devel

Exactly. I would prefer the second as if I needed to add a third, 4th its
takes no effort and I don't reinvent the wheel as they say.

Does alsa support 2 or is this just JACK's.

The mathematics may be simple for 1 but why should it be done over and over
again. An API is meant to take away repetitive annoyances ;)

Cheers

Nick

----- Original Message -----
From: "Philipp Vollmer" <vollmer.philipp@t-online.de>
To: <nick@greensignal.com>
Cc: <alsa-devel@lists.sourceforge.net>
Sent: Wednesday, July 31, 2002 9:58 PM
Subject: Re: Multiple PCM files


Hello,

Maybe you're working at the same problem as me. At this
point of time.
There are two possibilities:
1. Open one device with one handler and mix the two files
    with arimethic operations as they will be mixed by the sound
    card although.

2. Open one devices but with two handlers in two threads
     and write your pcm data to it.

regards

Philipp ( DO1YPV )





-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

* Re: Multiple PCM files
@ 2002-07-31 20:58 Philipp Vollmer
  2002-07-31 20:20 ` Nick French
  0 siblings, 1 reply; 11+ messages in thread
From: Philipp Vollmer @ 2002-07-31 20:58 UTC (permalink / raw)
  To: nick; +Cc: alsa-devel

Hello,

Maybe you're working at the same problem as me. At this
point of time.
There are two possibilities:
1. Open one device with one handler and mix the two files
    with arimethic operations as they will be mixed by the sound
    card although.

2. Open one devices but with two handlers in two threads
     and write your pcm data to it.

regards

Philipp ( DO1YPV )



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code1

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

* Re: Re: Multiple PCM files
  2002-07-31 20:20 ` Nick French
@ 2002-07-31 22:18   ` Paul Davis
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Davis @ 2002-07-31 22:18 UTC (permalink / raw)
  To: Nick French; +Cc: Philipp Vollmer, alsa-devel

>Exactly. I would prefer the second as if I needed to add a third, 4th its
>takes no effort and I don't reinvent the wheel as they say.
>
>Does alsa support 2 or is this just JACK's.

No, ALSA does not support it *in general*. Some interfaces will work
this way, some will not. In theory, the ALSA "share" device type will
allow this, but apparently almost no-one has ever used it except its
main author.

>The mathematics may be simple for 1 but why should it be done over and over
>again. An API is meant to take away repetitive annoyances ;)

the mathematics, such as they are, consist of addition.

the real problems you face have to do with sample rate and sample bit
width conversion, which are entirely different. i and others have said
before that it would be nice if alsa-lib exposed the code it contains
to do this stuff so that it could used in other contexts (not just
hidden as part of "plug" or "plughw" device implementation.

--p


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

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

end of thread, other threads:[~2002-07-31 22:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-31 20:58 Multiple PCM files Philipp Vollmer
2002-07-31 20:20 ` Nick French
2002-07-31 22:18   ` Paul Davis
  -- strict thread matches above, loose matches on Subject: below --
2002-07-30 13:58 Nick French
2002-07-30 12:24 Nick French
2002-07-30 13:18 ` Paul Davis
2002-07-30 10:43 Nick French
2002-07-30 11:29 ` Paul Davis
2002-07-30  9:52 Nick French
2002-07-30  9:50 Nick French
2002-07-30 10:11 ` Paul Davis

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.