[Vorbis] [Fwd: RE: Mixing inputstreams.]

Tor-Einar Jarnbjo tor-einar at jarnbjo.name
Mon Mar 2 12:57:35 PST 2009


Hi Gerry,

You will introduce rounding errors at some point, no matter where you 
normalize the samples. To reduce these as well as possible (if best 
fidelity is really required), it would be best to modify the decoder's 
AudioInputStream to return floating point samples or 24/32 bit wide 
integer samples, apply panning and level effects, mix, reduce the level 
and then convert to 16 bit samples to be played by the JavaSound API.

Tor

Fish schrieb:
> Thanks Ross,
> So you think that I can just numerically add up the appropriate Bytes 
> from each of the streams? If that's so would we be better add first, 
> then to normalise after the additon, so the final byte size is the same 
> as the individual ones, what ever that may be.
>
> -------- Original Message --------
> Subject: 	RE: [Vorbis] Mixing inputstreams.
> Date: 	Tue, 3 Mar 2009 01:12:35 +1300
> From: 	Ross Levis <ross at stationplaylist.com>
> Organisation: 	http://www.stationplaylist.com
> To: 	'Fish' <fish at ghostsofp.com>
> References: 	<49ABBDD0.1040505 at ghostsofp.com>
>
>
>
> You can simply add the values of each sample together, but you will have to
> ensure the final result is not larger than the maximum allowed or you will
> have distortion.  You could divide the sample value by 4 for each sound file
> and then add them together.
>
> Ross.
>
> -----Original Message-----
> From: vorbis-bounces at xiph.org [mailto:vorbis-bounces at xiph.org] On Behalf Of
> Fish
> Sent: Tuesday, 3 March 2009 12:07 a.m.
> To: vorbis at xiph.org
> Subject: [Vorbis] Mixing inputstreams.
>
> With the help of a java programmer, we have created an application to 
> play multiple local ogg sound files, all triggered from a single 'play' 
> event. The event triggers an instance of the ogg.vorbis player for each 
> file to be played. However we are finding that these 'tracks' are not 
> synchronised, since the audioinputstream for each is passed to the 
> dataline, and so gets handled by the OS. We are now looking for a way to 
> combine these inputstreams, into a single input stream, (mixed), so that 
> the combined stream can be output to the dataline, and so guarantee, 
> that the combined or mixed sound is indeed synchronised. Since we have 
> some controls within each of the players, pan, level, mute, we should be 
> able to still use these for each of the channels before they are 
> combined. There may indeed be a solution already to this problem, and 
> pointers in the right direction would be a help. Otherwise a suggested 
> approach would we most welcome.
>
> Thanks in advance
> Gerry Abbott
> _______________________________________________
> Vorbis mailing list
> Vorbis at xiph.org
> http://lists.xiph.org/mailman/listinfo/vorbis
>
>
>
>   




More information about the Vorbis mailing list