Mixing Algorithm

Started by
0 comments, last by SikCiv 24 years, 6 months ago
I need to capture the sound output from my game into a wave file.

I am trying to create my own 16bit sound mixer to implement in my program, so I can dump the output to a file.
Does anyone know where I can get the algorithm/procedure to mix numerous 16bit Stereo 44k samples into one buffer/file?

Or is there a library available?
Basically, I need the source code for the conversion utility MOD2WAV.


  Downloads:  ZeroOne Realm

Advertisement
Basically, you just add the two samples (let it loop around):
Why not do it in asm, much faster and easier that c(pp):

pseudo_c/asm==>
mix(pSource1,pSource2,pDest) {
mov esi,pSource1
mov edi,pSource2
mov edx,pDest
nextsample:
mov ax,word ptr [esi]
add ax,word ptr [edi]
mov word ptr [edx],ax
add esi,2
add edi,2
IF(!DONE) jmp nextsample
}

this is for 16-bit pcm (uncompressed)

This topic is closed to new replies.

Advertisement