audio - Mixing multiple sound clip -


i'm trying mix 6 sound clips together.

imagine each clip single guitar string pluck sound , want mix them produce guitar chord.

here, clip array of real numbers in range [-1,1], each number mono sample.

double mixed_sample = mix(double sample1, ..., double sample6); 

please, implement mix!

you have got kidding.

mixing simple addition of signals.

double mix(double s1, double s2, double s3, double s4, double s5, double s6) {   return (s1 + s2 + s3 + s4 + s5 + s6); } 

next step provide individual channel gains.

double variable_mix(double s1, double s2, double s3, double s4, double s5, double s6,                       double g1, double g2, double g3, double g4, double g5, double g6) {   return (s1*g1 + s2*g2 + s3*g3 + s4*g4 + s5*g5 + s6*g6); } 

of course, kind of pain in ass code, , parameter-passing overhead eat alive, have do.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -