[Stk] Stk, multi channel mixer

StephaneKyles stephane at subnetworks.org
Sun Aug 28 05:11:32 PDT 2011


Hi, I am trying to implement with the stk a multi channel mixer, very basic. I have multiple streams and their associated buffer.
I gather the buffers in the tick method :

stk frames FramesRecorder is the final output buffer.
stk frames Frames[numplayers] are the stream buffers.
int numplayers, the stream index.

the sines are normalized to -1.0 to 1.0 , float32.

for ( unsigned int i=0; i< nBufferFrames ; i++ ) 
{
	Float vol = 1.0f;
	FramesRecorder(i,0) = ( FramesRecorder(i,0) + ( Frames[numplayers](i,0) * vol ))  ;	
	FramesRecorder(i,1) = ( FramesRecorder(i,1) + ( Frames[numplayers](i,1) * vol ))  ;	 	
}
// and something like giving the sum of streams.
	FramesRecorder[0] /= numplayers;
	FramesRecorder[1] /= numplayers; 


what would be the best method to mix multi channel buffers together ? I know it’s a newbie question, but I would like to know about your experience with this. I would like to implement an efficient method as well. Thx !





More information about the Stk mailing list