Echo Generation using Room Impulse Response Using MATLAB

The following code produces auralization effects to audio sounds saved in hard disk to add echo effect. The input will be a dry sound with no echo/reverberation but the output will sound like in a tunnel or Cathedral.


Screen Display Specifications

%Measure screen size of the device
%Calculate position values of figure Windows

scrsz = get(0,'ScreenSize');
P1=[40 500 scrsz(3)/3 scrsz(4)/3];
P2=[40 80 scrsz(3)/3 scrsz(4)/3];

Read Room Impulse Response File

[x1,Fs1]=audioread('tunnel_balloon_441k.wav');
[x2,Fs1]=audioread('carpark_balloon _441k.wav');

% Discard one channel
x1=x1(:,1);
x2=x2(:,1);

Plot Impulse Response of Tunnel

figure('position', P1);
figure(1);
plot(x1,'k');
grid on
title('IR of tunnel balloon 441k.wav');
xlabel('Samples');
ylabel('Amplitude');
legend('tunnel IR');

Plot Impulse Response of Underground Carpark

figure('position', P2);
figure(2);
plot(x2,'r');
grid on
title('carpark balloon 441k.wav');
xlabel('Samples');
ylabel('Amplitude');
legend('Carpark IR');

Read Input Signal

[y,Fs2]=audioread('Asianet.wav');
y=y(:,1);

Perform Convolution

o1 = conv(x1,y);
o2 = conv(x2,y);

Playback the Output Signal

%soundsc(o1,Fs1);
%soundsc(o2,Fs1);

End of Program

No comments:

Post a Comment