Suppose I've got a 16-bit PCM audio file. I wanna pan all of it completely to the left. How would I do this, purely through byte manipulation? Do I just mix the samples of the right channel with those of the left channel?

I'd also like to ask (since it seems related), how would I go about turning stereo samples into mono samples?

I'm doing this with Haxe, but code in something like C (or just an explanation of the method) should be sufficient. Thanks!

有帮助吗?

解决方案

You'll first need to convert the raw bytes into int arrays. Your output for the left channel will be the sum divided by 2.

for (int i = 0 ; i < numFrames ; ++i)
{
   *pOutputL++ = (*pInputL++ + *pInputR++) >> 1;
   *pOutputR++ = 0;
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top