1

Given multiple audio streams, I need to mix them into a single stream. I know that in principle all I need to do is add the corresponding samples.

The issue is: The "input" streams have different sample rates. Therefore there are no "corresponding" samples for all samples. Thus the plan to "resample" the input streams. I see two options.

  • I resample to say the highest sample rate present in the input streams.

  • Or, I resample to the lowest common multiple of the input streams' sample rates. This might require a very high number of samples.

Does the later provide a benefit quality-wise?

Example: One audio stream has a sample rate of 44.1kHz, and another a sample rate of 48kHz. The least common multiple would be 7056kHz.

  • The most sensible thing to do is to convert to the target sampling rate you want for the resulting file, then add the streams together. Make sure you provide headroom so that the resampling and the addition doesn't clip, adding distortion. – sh- Feb 26 at 16:33
2

You will only get benefit from sampling to the next highest sampling rate you are able to mix at. For instance, if you have a 32kHz stream and a 48kHz stream, resample the 32kHz stream to 48kHz. You won't achieve any additional benefit from resampling to a multiple and additionally you won't find an audio device that will support a sampling rate that high.

By resampling to a least common multiple you will lose audio bandwidth and again run into issues finding an audio device that will support a sampling rate that low.

Stick to standard sampling rates (44.1, 48, 88.2, 96.... kHz) and then up-sample to one of those.

Further to this, if you are implementing a software based mixer, the typical way to achieve this is to implement a sample-rate conversion function block on each input stream that will conform all inputs to the same sample rate using the internal sample clock. That way, you can have any input sample rate and they will all conform to the same rate for internal mixing.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.