1
$\begingroup$

I am a software engineer, currently working on a signal-processing related project, which I am new to. For evaluating the algorithm(which is written in R), I need to mix (merge) two different audio signals synthetically. The question is how to mix these two signals and obtain a “realistic” result?

To be more specific, consider the following scenario:

  1. I have recorded Signal_A, and downloaded signal_B from the internet (therefore two different microphones/settings are used for recording).

  2. The sound pressure level of both signals are known( I measured the sound pressure level of Signal_A in 1m distance, and also know the sound pressure level of Signal_B in the same distance).

  3. As far as I know, the value recorded/represented in each waveform of any signal is relative to that corresponding signal, and since two signals are recorded using different settings we can expect that one might be more amplified than the other. Therefore a simple mixing of the two won’t give us a realistic result.

Now the question is: is there a way to manipulate recorded signal_A and signal_B programatically, assuming the fact that the SPL values of the original signals at 1m distance is known, and get the merged signal as they were playing simultaneously and recorded at 1m distance? i.e. to calculate factor ‘a’ and ‘b’ in a way that the realistic merged signal is formulated by:

Mereged_Signal = a*Signal_A  + b*Signal_B

Thanks in advance!

$\endgroup$
4
  • $\begingroup$ Didn't you answer your own question? What's wrong with Merged_Signal = a*Signal_A + b*Signal_B? $\endgroup$
    – endolith
    Commented Oct 6, 2016 at 20:55
  • $\begingroup$ @endolith nothing is wrong with the formula. The problem is finding the right way to estimate the gain factors 'a' and 'b', which results in having a realistic merged signal. $\endgroup$
    – sämi
    Commented Oct 7, 2016 at 7:17
  • $\begingroup$ well sound pressure drops with inverse distance, so if you know the distance from Signal_A to the mix point, and you know the sound pressure of the source at 1 m, then new_amplitude = old_amplitude * old_distance / new_distance $\endgroup$
    – endolith
    Commented Oct 7, 2016 at 18:32
  • $\begingroup$ Are you just trying to simulate a change in distance or are you also simulating a change in the source level at the same time? $\endgroup$
    – endolith
    Commented Oct 7, 2016 at 18:47

2 Answers 2

1
$\begingroup$

I have recorded Signal_A, and downloaded signal_B from the internet (therefore two different microphones/settings are used for recording)

You might be able to achieve a "seamless" mix (or transition) but the fact that you have two different microphones and settings might add artifacts in the final product. You can tell how this sounds like if you have ever noticed the differences between microphones. Accounting for such differences might be a bit more challenging.

The sound pressure level of both signals are known( I measured the sound pressure level of Signal_A in 1m distance, and also know the sound pressure level of Signal_B in the same distance).

It is good that you have measured the SPL but most commonly you are unlikely to know the exact relationship that takes you from SPL to converted values.

As far as I know, the value recorded/represented in each waveform of any signal is relative to that corresponding signal, and since two signals are recorded using different settings we can expect that one might be more amplified than the other. Therefore a simple mixing of the two won’t give us a realistic result.

I am not entirely clear on what you mean by "a simple mixing" but the first approach would be to simply adjust the amplitudes of the two recordings and then "add" them together as per your MergedSignal equation.

Now the question is: is there a way to manipulate recorded signal_A and signal_B programatically, assuming the fact that the SPL values of the original signals at 1m distance is known, and get the merged signal as they were playing simultaneously and recorded at 1m distance?

Yes. BUT!, you have to make sure that the rest of the signal pathway was the same as well. Now:

  • Sound waves hit the transducer. The transducer converts them to voltage with a (hopefully) linear relationship of Volts per Pascal of pressure. In addition, this relationship is frequency dependent. But let's say that it is constant across the spectrum and call it $\alpha$.

  • Behind the transducer there is an amplifier whose job is to take the electrical signal and bring it up to some level. Again, this is achieved with a (hopefully) linear relationship. Let's keep things simple and assume that the job of this amplifier is to take the signal of the transducer and adapt it to a standard line level of approximately 2 Volts (peak-to-peak). Let's call this $\beta$.

  • The final stage is the Analog to Digital Converter (ADC). It converts the 2volts peak to peak to some range with a given word length (for example 0..255, -127..128 and so on).

So, assuming that $\alpha$ (mic), $\beta$ (amp/signal conditioning) are the same, you can indeed scale the recordings by the ratio of the SPLs. That is:

$$MergedSignal = (1.0 - \frac{SPL_A}{SPL_B}) \times Signal_A + \frac{SPL_A}{SPL_B} \times Signal_B$$

In the more general case and when you don't know the SPL, you can simply "match" the average level of the converted values. So, same relationship, instead of $SPL_A, SPL_B$ you have the averages of the signals.

Hope this helps.

$\endgroup$
-1
$\begingroup$

Some remark to the last reply:

In my opinion you can even do the signal mixing with different $\alpha$ and $\beta$ if you consider the difference between the measured SPL value and the computed SPL value.

Let $SPL_{Am}$ be the measured SPL value of the signal A, let $SPL_{Ac}$ be the computed SPL value of the signal A (add the A-weighted squared amplitude values in the FFT frequency spectrum). Do the same for signal B. Then:

$$MergedSignal = \frac{{SPL_A}_m}{{SPL_A}_c} \cdot Signal_A + \frac{{SPL_B}_m}{{SPL_B}_c} \cdot Signal_B$$

Be careful with the dB-values. In the merging formula you need the non-logarithmic values: $10^{\frac{dB}{20}}$.

The difference between my formula and the one of A_A:

A_A's formula makes $Signal_A$ and $Signal_B$ equally loud. My formula makes $Signal_A$ as loud as it was (before scaling with $\alpha$ and $\beta$ due to microphone and amplifier), and $Signal_B$ as loud as it was.

$\endgroup$
1
  • $\begingroup$ Any chance to use math formatting? $\endgroup$
    – jojeck
    Commented Sep 6, 2016 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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