1
$\begingroup$

I have two speech audio wav files. file1 is primary speech, file2 is supposed to be interference.

I want to add them so that the SIR (signal to interference ratio) is 10 dB.

  • How do I proceed?
  • Do I do sample by sample addition like below?

    Assuming $N$ is the data-length of both the files (single channel).

    for i = 1:N
       x = 0.1 * file1(i)^2 / file2(i)^2 
       file3(i) = file1(i) + x*file2(i)  
    end

    file3 is the output file.

  • Are there any better ways to do this?

Note: $\textrm{SIR(in dB) = 10 log (Power(signal) / Power(interference))}$

$\endgroup$
5
  • $\begingroup$ better first confirm what the different energies are of the two files. $\endgroup$ Mar 29, 2016 at 3:32
  • $\begingroup$ @robertbristow-johnson In one case they're about the same, -80 and -78 (I used this one liner to compute average energy 10*log(sum(data.^2)/length(data)) $\endgroup$
    – user13107
    Mar 29, 2016 at 3:45
  • 1
    $\begingroup$ well, assuming the interference file is the -80 dB file, then i would scale the interference file by $10^{-(10-2)/20}$ and add it to the signal file. if the interference file is the -78 dB file, i would add 2 to the 10 rather than subtract. $\endgroup$ Mar 29, 2016 at 4:12
  • $\begingroup$ This might be useful, sen is signal and noise is interference signal_power = (1/length(sen))*sum(sen.*sen); noise_variance = signal_power / ( 10^(SNR/10) ); Y = sen + sqrt(noise_variance)/std(noise)*noise(1:length(sen)); $\endgroup$
    – Arpit Jain
    Mar 29, 2016 at 4:17
  • $\begingroup$ @robertbristow-johnson that works. thanks. my original approach was giving scratchy sound. $\endgroup$
    – user13107
    Mar 29, 2016 at 7:41

0

Your Answer

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

Browse other questions tagged or ask your own question.