Re: sndio play multiple wav files ?

Jan Stary <[email protected]>
Newsgroups gmane.os.openbsd.misc
Message-ID <[email protected]>
On Jun 05 16:09:53, [email protected] wrote:
> Hi!,
> 
> I am working on a curses C sndio app to
> play samples that are just wav files.
> I would like to be able to play them
> "over each other" like not sequentially.
> 
> (I would like for the wav file to play
> regardless if another one is already playing.)
> 
> I can play ONE wav file using sndio.
> 
> https://codeberg.org/pkw/siotest/src/branch/main/siotest.c#L130
> 
> What is the easiest and most idiomatic way
> to play multiples ones ?

If they use the same sample encoding and have the same number of channels
and use the same sample rate, then make one output sample the average
of the input samples, obviously. Doing the arithmetics might overflow
though, so you might want to convert to floats and do the arithmetics
there and then convert back to the sample encoding you want to play.

And if they do not use the same sample rate, you have resampling to do;
and if they do not use the same sample encoding, you need to convert;
and if they have different number of channels, you need to remix somehow.

> Any pointers or places to look?

Look what aucat does with more than one -i

	Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.