In what format are your files ?
Explanation of the code above:
- Transform the samples of each signal from Short to Float: float samplef1 = music1 / 128.0f; (between -1 to 1)
- Add the two values and divide by 2 : float mixed = (samplef1 + samplef2) / 2;
- Limit the signals to 1 and -1 if (mixed < -1.0f)
mixed = -1.0f;
- Transform the sum sample back to Short: byte outputSample = (byte) (mixed * 128.0f);
hi thnx for your help
i have no information about music but most of my files is wav
i think in forum that i copied the code from is about mix wav files
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.