Study of reverberation equation
이전 댓글 표시
Hi all,
Suppose I have following difference equation:

where x(n) is the input audio, y(n) is the output (echoed) audio, D is the echo delay (in samples), and alpha governs the amount of echo fed back.
Now, for a known x(n) as to be my quantized audio signal, I need to study the effect of different values of alpha and D on y(n) i.e. I need to be able to hear different y(n) consequently as a result of variations in D and alpha.
This is how I managed to make a sound on a particular alpha and D:
fs = 8000;
Recorder = audiorecorder(fs, 16, 1);
record(Recorder);
pause(2);
stop(Recorder);
x = double(getaudiodata(Recorder,'int16'));
x = x / max( abs(x) );
b=[1 0 0 0 0 0 0];
a=[1 0 0 0 0 0 -0.4];
y = filter(b,a,x);
sound(y,fs);
But, as mentioned before, I would like to study the impact of different values of alpha and D on y(n) perhaps in something like a for loop. Can anyone assist?
댓글 수: 2
Guillaume
2015년 9월 7일
The filter you've implemented would be:
-0.4*y(n) = x(n-6) + y(n-6)
Not really the same as your equation.
Hasan Ghorbani
2015년 9월 7일
채택된 답변
추가 답변 (1개)
Walter Roberson
2015년 9월 7일
D = 6;
b = [zeros(1,D), 1];
alphavals = -1 : .1 : 1; %I figure negative corresponds to echo cancellation
num_alpha = length(alphavals);
for K = 1 : num_alpha
alpha = alphavals(K);
a = [alpha, zeros(1,D-1), 1];
y = filter(b,a,x);
if K ~= 1
pause(2); %just to give an audible break, you can change or eliminate this
end
fprintf('alpha = %g\n', alpha);
player = audioplayer(y, fs);
playblocking(player);
delete(player);
end
Using audiplayer with blocking is to avoid the overlap in sounds that would otherwise occur in a loop. sound() is asynchronous and does not wait for the playing to finish, so if you loop sound() then you end up with multiple sounds at the same time. audioplayer allows us to block to ensure we only have one sound at a time.
카테고리
도움말 센터 및 File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!