Mixing sound files of different sizes

I want to mix audio files of different sizes into one .wav file without trimming any file, i.e. The resulting file size must be equal to the maximum file size.

There is a sample through which we can mix files of the same size

[( http://www.modejong.com/iOS/#ex4 ) (Example 4)].

I changed the code to get a mixed file as a .wav file.

But I can’t figure out how to change this code for files of unequal size. If someone can help me with some piece of code, I will be very grateful.

+3
source share
2 answers

, . - , , . , .

, , , ( , ). , . "headroom" . , , X% . (~ 80-90%, ). - , < 1.0, .

, - , , / , . , .

(Clipping , , . , , , . :

-, , "", , , .

+1

:

mix_buffers, , 2 mixbufferNumSamples. . , 0 .

, , . , :

 mixed = s1/2 + s2/2;

, int16_t. , .

, , .

int32_t, () , , + 32767/-32768.

0

Source: https://habr.com/ru/post/1786886/


All Articles