Clear Filters
Clear Filters

Implement a reverbration effect on an audio

1 view (last 30 days)
I faced diffiulties in implentenig revrerbartion with the feedback filter y[?] = ?[? − ?] + ?[?], where D is related to the dimensions of the simulated room, and
0 < ? < 1 is the absorption coefficient of the wallsusing tho and audio using this eqution. so whats it the mistake and how the code should be
x=audioread("SpeechDFT-16-8-mono-5secs.wav")
sound(x)
y=zeros(1,length x)
for
n=10
a=1
d=0.500
y(n)=a*y(n-d)+x(n)
end

Answers (1)

Walter Roberson
Walter Roberson on 29 Apr 2020
In MATLAB, for loops must have one of these syntaxes:
for variable = start : stop
for variable = start : increment : stop
for variable = expression
Using plain for without something that looks like an assignment on the same line, is not valid syntax.
y=zeros(1,length x)
You need to use the function form of length
y=zeros(1,length(x));
  4 Comments
Mrutyunjaya Hiremath
Mrutyunjaya Hiremath on 29 Apr 2020
Edited: Mrutyunjaya Hiremath on 29 Apr 2020
y(n) =a*y(n-d)+x(n)
d = 0.5
but array index (n-d) must be integer.
Walter Roberson
Walter Roberson on 29 Apr 2020
y(n-d) does not appear anywhere in your posted equation, y[?] = ?[? − ?] + ?[?]
Perhaps it should have been . If so then take note that the [] are not indices and instead represent functional relationship. The value at time n depends upon the value at time n - D. D is time, not relative index. When you convert your equation over to using vectors, you need to convert that D from being time to being relative index, by multiplying the time by the sample rate.
Often when time is converted to delay in samples, the result is not an integer. You can choose to ignore that, using floor() or ceil() or round() of the delay-in-samples; this will result in the signal not really being right, especially if it has to pass through more processing. For example, two stages of delays of 22.5 samples should logically be the same as a single delay of 45 samples, not of 2*floor(22.5) = 44 or 2*ceil(22.5) = 26. The higher your sample rate, the less significant the difference will be for perception. But to get it right, you might choose to use fractional delay techniques.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!