[jitsi-dev] Question about audio mixer algorithm in libjitsi


#1

Hi all,
I have a question about the the code that in libjitsi does the actual audio mixing:

for (int i = 0; i < inStreamSampleCount; i++)
{
    int inStreamSample = inStreamSamples[i];
    int outSample = outSamples[i];

    outSamples[i]
        = (short)
            (inStreamSample
                + outSample
                - Math.round(
                        inStreamSample
                            * (outSample / maxOutSample)));
}

What is the rationale behind this formula?

Is that an implementation of some well-known mixing algorithm?

Thanks a lot,

Matteo


#2

Yes this is well know algorithm.

···

On 17 May 2017 7:31 p.m., "Matteo Campana" <matteo.campana@qnective.com> wrote:

Hi all,
I have a question about the the code that in libjitsi does the actual
audio mixing:

for (int i = 0; i < inStreamSampleCount; i++)
{
    int inStreamSample = inStreamSamples[i];
    int outSample = outSamples[i];

    outSamples[i]
        = (short)
            (inStreamSample
                + outSample
                - Math.round(
                        inStreamSample
                            * (outSample / maxOutSample)));
}

What is the rationale behind this formula?

Is that an implementation of some well-known mixing algorithm?

Thanks a lot,

Matteo

_______________________________________________
dev mailing list
dev@jitsi.org
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev


#3

Hi Vineet,

thanks for your answer!

Do you have some references to this well know algorithm?

Cheers,

Matteo

···

________________________________
From: dev <dev-bounces@jitsi.org> on behalf of Vineet Awasthi <vineetawasthi.technocrat@gmail.com>
Sent: Wednesday, May 17, 2017 4:50 PM
To: Jitsi Developers
Subject: Re: [jitsi-dev] Question about audio mixer algorithm in libjitsi

Yes this is well know algorithm.

On 17 May 2017 7:31 p.m., "Matteo Campana" <matteo.campana@qnective.com<mailto:matteo.campana@qnective.com>> wrote:
Hi all,
I have a question about the the code that in libjitsi does the actual audio mixing:

for (int i = 0; i < inStreamSampleCount; i++)
{
    int inStreamSample = inStreamSamples[i];
    int outSample = outSamples[i];

    outSamples[i]
        = (short)
            (inStreamSample
                + outSample
                - Math.round(
                        inStreamSample
                            * (outSample / maxOutSample)));
}

What is the rationale behind this formula?

Is that an implementation of some well-known mixing algorithm?

Thanks a lot,

Matteo

_______________________________________________
dev mailing list
dev@jitsi.org<mailto:dev@jitsi.org>
Unsubscribe instructions and other list options:
http://lists.jitsi.org/mailman/listinfo/dev