tags:

views:

80

answers:

1

What is an algorithm for joining PCM files? I have several PCM files I need to Join them in a way like speakers are speac at the same time.

So How to Join PCM files?

+1  A: 

First find a way to process them sample by sample, then just add the samples from all streams together.

You will run into the problem of overflows. If that happens just clamp the resulting value to the maximum/minimum sample value.

You may also want to offer an option to scale the output before clamping to the user and you may also want to report some statistics how often (per second or so) clamping happed, so the user has some control over the sound quality.

Nils Pipenbrinck