# Convolution : Anechoic Speech signal and Impulse response

I am trying to perform convolution in MATLAB of an anechoic speech signal (2.1 s) and a impulse response (20 s) using the following code:

[y_anech,fsSig]=audioread('MA03_03.wav'); %speech signal fsSig = 48000

%%% Resampling the speech signal
[P,Q] = rat(fsIR/fsSig);
y_anech_resampled = resample(y_anech, P,Q);

sig_conv_meas = cconv(y_anech_resampled,y_IR)/fsIR;
sig_conv_meas = sig_conv_meas/max(abs(sig_conv_meas));

player1 = audioplayer(sig_conv_meas,fsIR);
play(player1);


Running the above code, it gives me the required convolved signal, however at 20s, I also hear the anechoic speech signal. I have the following questions:

1. What the reason behind that I hear the original signal after the convolved signal? How should I remove it?

See the attached plots. In the last plot, around 20 s, there appears the anechoic signal:

ETC plot of IR:

1. When performing convolution, why do I need to divide the convolved signal with sampling frequency as I do in my code (sig_conv_meas = cconv(y_anech_resampled,y_IR)/fsIR)?

Thank you!

• Hi. Do you seriously mean the IR is 20s long and audio file is 2.1s? Aren't the durations flipped? – jojek Jul 16 '20 at 7:34
• Yes, the IR is 20 s long and audio file is 2.1s. I have now zeropadded my audio file such that its length is 5 s but still I can hear the anechoic part. – Tanmayee Pathre Jul 16 '20 at 15:54
• Any way to have this example? – jojek Jul 16 '20 at 15:57
• I can share the audio file as it is from the Harvard Speech Corpus. salford.figshare.com/articles/media/Speech_corpus_-Harvard-_edited_end-pointed_zero-padded_audio/7862186. However, I cannot share the IR. – Tanmayee Pathre Jul 16 '20 at 16:03

• IR from here (mono/r1_omni.wav) - it's a really long one
• Anechoic recording from here (operatic-voice/mono/singing.wav)

Resampled voice signals:

Final convolved signal:

1.

As you did the plot of IR in logarithmic scale it's clearly visible that towards its end there is another peak at 20s. Once convolving with speech it will yield another repetition of the speech signal. If you look at the first plot, your audio starts around 1s mark. As you are convolving the IR with the input signal, it will repeat it after 20s, and this is what you see in your convolved output around 21s.

Think about how an IR would look like if you want to produce an echo after 20s - one strong peak at 0s and another, smaller at 20s. I am guessing that this "peak" at the end is, in fact, the build-up before the main peak and should actually precede the main one (you can tell it by digital zeros and low energy samples in-between), or potentially a result of harmonic distortion that was moved to the end. Definitely, someone must've extracted/saved this IR in such a way.

Nonetheless, you can easily ignore anything past the 10s mark as it doesn't carry any extra information during convolution. TBH, I would ignore the part after 5s, where it roughly meets the noise floor. Otherwise, it's a waste of computational resources to convolve with full length.

Possibly you can automate the cropping. It looks like the IR file is stored in 16-bit audio, and when the noise-floor ends (around the 10s mark), you get sample values equal to 1. If you look when they start in the vector, you can find your cut-off point automatically, should you have more IR's.

2.

First of all your division by fsIR has no effect as it's normalized by the maximum value in the line that follows. Anyway, most likely your IR is reverberant and generally increases the energy. Think of it as a filter that has a lot of frequency boost. Here is a comparison for resampled anechoic recording and unscaled auralised signal.

• Hello! Thank you for answering my questions. I have attached the plot to be more clear. – Tanmayee Pathre Jul 16 '20 at 16:01
• I've checked your code again and there is something fishy going on with your example. There shouldn't be any repetition (you are doing linear convolution). Could you double-check if: your signals are single-channel, IR doesn't have any rubbish close to its end, there is no re-definition of cconv function somewhere in your code and does it still happen if you truncate your IR to let's say 15 seconds. Which version of MATLAB are you using? – jojek Jul 16 '20 at 19:16
• I am using MATLAB R2019a. The source signals are single-channel. I truncated the IR to 15 second and now I can no longer hear the original signal. I did not understand when you meant by "rubbish close to the ends of the IRs". – Tanmayee Pathre Jul 16 '20 at 20:52
• Try to plot 10*log10(y_IR.^2). Is it decreasing approximately linearly till it reaches noise floor or is there some extra increased energy towards its end? – jojek Jul 16 '20 at 20:56
• Thank you very much for both the answers: The delayed version and convolution. They totally work. – Tanmayee Pathre Jul 17 '20 at 12:53