Wednesday, March 14, 2012

AV Sync, Mixing two audio tracks in android

1. AV sync is undetectable if sound is rendered -100ms to +25 ms to video
- Sound Delayed
+ Sound advanced


2.How android audio flinger is mixing two or more tracks in mixer thread ?

 [How to mix two or more audio streams/tracks together ?]

If you want to mix streams A & B, you simply sum the corresponding samples: A1+B1=C1, A2+C2=B2... An+Bn=Cn...
Of course, both streams must have the same sample rate (and with integer formats, both must have the same bit-depth) before you sum.

    With integer formats you have to scale the input streams before summing (i.e. divide by 2), or you need to allow for
larger numbers (more bits) in the output stream. Even with 32-bit floating point, you'll normally want to scale before or after mixing to avoid clipping.
(The 32-bit data won't clip, but you can clip the DAC output.)

And frequently with audio mixing, you'll want to scale the input levels because you don't always want a 1:1 mix... You may want one signal to be louder in the mix.  Audio flinger is mixing one or more tracks as mentioned above.

 

From:http://www.hydrogenaudio.org/forums/index.php?showtopic=79430

 

2 comments:

jerry john said...

you'll want to scale the input levels because you don't always want a 1:1 mix... You may want one signal to be louder in the mix. Audio flinger is mixing one or more tracks as mentioned above. song mastering

Sundar said...

I forgot to mention this ... RealTime scenario is while playing songs, Any notification sound is coming that time sounds will be rendered as mixed with song audio
That means that time we will reduce the song mixing level and notification sound volume ratio will be higher... In such a way mixing will happen in AudioFlinger