I have a model for audio processing. The model receives as input, a source, convolved with a room impulse response (RIR). I would like to test the performance of the model against inputs containing directional interference. The sources and interferences are simply audio recordings (for example human speech, a dig bark, car engine, etc.). both source and interference are convolved with two different RIRs (with respect to angle) and then a gain $A$ is applied to the noise in order to control the desired SIR.

The signals power: $P_s(t)=mean(x^2(t))$

The interference (noise) power: $P_n(t)=mean(n^2(t))$

The amplified interference power: $P_{An}(t)=mean(A^2n^2(t))=A^2mean(n^2(t))=A^2P_n(t)$

And if we want to isolate $A$, we have: $$SIR=10 \log\left(\frac{P_s(t)}{A^2P_N(t)}\right)$$ $$A=\sqrt{\frac{P_s(t)}{10^{\frac{SNR}{10}}P_N(t)}}$$

Now, considering I am working from a dataset of audio files with variable length, will this not cause a problem due to the averaging process? For example, if the interference is of length $T_1$ and the source is of length $T_2>T_1$. The interference will be of worst than the desired SIR in the interval $0<t<T_1$ and better in the interval $T_1<t<T_2$.

  • Is my thought process correct?
  • Is there a known method of dealing with such a problem?
  • How do I set the correct SNR for such an experiment?
  • $\begingroup$ I am really confused about the purpose of what you are trying to do? What goal are you trying to achieve? When you say isolate A then is there a known noise level and an unknown amplification of that noise that you are trying to solve for? Giving a very clear purpose and desired outcome would be helpful in case you are too far down the wrong path. $\endgroup$ Nov 11, 2019 at 12:46
  • $\begingroup$ @DanBoschen As written in the question, the SIR is "desired" hence known and the goal and purpose are to test the performance of the model against inputs containing directional interference. When I say isolate $A$ I am trying to isolate the amplification that will lead me to the desired $SIR$. Note that I did edit the post so that SNR became SIR. $\endgroup$
    – havakok
    Nov 11, 2019 at 13:20
  • $\begingroup$ I see- yes that is clearer now. Do you have the ability to transmit a known sounding pattern? If so I have a direct approach you can use to compute SIR if that is your quesiton. $\endgroup$ Nov 11, 2019 at 13:25
  • $\begingroup$ What do you mean by a "known sounding pattern"? Are you referring to a coherent sound? in general, my source and interference are recordings of some classes. I don't think that they fall under the definition of "known". Am I understanding you correctly? $\endgroup$
    – havakok
    Nov 11, 2019 at 13:30
  • $\begingroup$ Yes a known reference that occupies all the frequencies of interest in your band. If you have such a noise free sound reference that you can transmit then you can use correlation to determine the SIR at the receiver. But arbitrary recordings of classes wouldn't apply as you only have the received signal, not the noise free reference and those sources may not sufficiently occupy the frequency band. $\endgroup$ Nov 11, 2019 at 13:38

1 Answer 1


You do need to be careful how exactly you define the SNR. I think you are actually talking about SIR (signal to interference ratio). The way you describe it, it sounds like you plan to just compute the power (time averaged energy) emitted by the signal and interference and use that to get after the SIR. This would be fine but, as you mentioned, sometimes the interference is not present. I might think about using a different definition such as instantaneous SIR, since it sounds like sometimes you have signal + interference and sometimes it is just signal. For this reason, I'm not convinced that computing the power as you described is the right thing to do.

I would suggest doing this: take the source audio file and interference audio file, figure out which is longer, zero pad the shorter one so they are of equal length. Now compute the metric, "sample-by-sample SIR", by doing $\frac{s[n]^2}{i[n]^2}$. Just be careful when $i[n]=0$. This is where knowledge of the noise (real noise, not interference) would be helpful so that you could ideally report SINR (signal to interference plus noise ratio) and avoid the denominator being $0$ problem.

  • $\begingroup$ Is the sample by sample SIR a common operation? Will it mean that I will have a different gain for each sample? If so, is it reasonable to average the gains after extracting them from the sample-wise SIR? $\endgroup$
    – havakok
    Nov 11, 2019 at 13:13
  • 1
    $\begingroup$ Right. The other way, that I can think of, would be to zero pad, compute the average powers like you described and do your gain calculation. But you need to sure to distinguish between times when the interference is present and not. If during 10 seconds, you have interference present in the last 6 seconds then how will you report the SINR for it? Showing a plot would be nice, during the first 4 seconds no interference so SINR = SNR, then interference kicks on so you get whatever SINR you choose $A$ to set to $\endgroup$
    – Engineer
    Nov 11, 2019 at 13:33

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.