Mixing 16 bit linear PCM streams and avoiding clipping/overflow

前端 未结 6 649
逝去的感伤
逝去的感伤 2021-01-31 12:45

I\'ve trying to mix together 2 16bit linear PCM audio streams and I can\'t seem to overcome the noise issues. I think they are coming from overflow when mixing samples together.

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 13:20

    There's a discussion here: https://dsp.stackexchange.com/questions/3581/algorithms-to-mix-audio-signals-without-clipping about why the A+B - A*B solution is not ideal. Hidden down in one of the comments on this discussion is the suggestion to sum the values and divide by the square root of the number of signals. And an additional check for clipping couldn't hurt. This seems like a reasonable (simple and fast) middle ground.

提交回复
热议问题