What is the algorithm used by Audacity (or any other audio editing program) to mix separate sound tracks?
ie. what is the process of merging the tracks to a single one when the "Mix and Render" command is used.
信号を追加するだけです。
// fill the destination (output) with the sum of signals: input1, input2, input3
for (size_t idx(0); idx < samplesToWrite; ++idx) {
output[idx] = input1[idx] + input2[idx] + input3[idx];
}
ボリュームまたはパンニングを信号に適用するには、乗算を使用します。
// to halve the amplitude of an audio signal:
const double halfVolume = 0.5;
for (size_t idx(0); idx < samplesToWrite; ++idx) {
signal[idx] *= halfVolume;
}