Answer the question
In order to leave comments, you need to log in
How to merge two wav files into one using OpenTK?
We need to mix two wav files into one in .net core. To do this, I use the OpenTK OpenAl wrapper for C#.
1) I load wav like in this example
2) I create two byte[] arrays:
var sound_data1 = LoadWave(path1, FileMode.Open), out channels, out bits_per_sample, out sample_rate);
var sound_data2 = LoadWave(path2, FileMode.Open), out channels, out bits_per_sample, out sample_rate);
for (int i = 0; i < sound_data1; i++)
{
result_sound_data[i] = (byte)((sound_data1[i] + sound_data2[i]) / 2);
}
AL.BufferData(buffer, GetSoundFormat(channels, bits_per_sample), result_sound_data, result_sound_data.Length, sample_rate);
AL.Source(source, ALSourcei.Buffer, buffer);
AL.SourcePlay(source);
Answer the question
In order to leave comments, you need to log in
https://www.codeproject.com/Articles/29676/CWave-A...
well, as I understand it, you can't just take two files and send the average data to another array ..
headers. number of channels, sample rate.
that is, your version of "banal" gluing will work in fact only for "same-type" files. Yes, and probably the same length.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question