OpenStax-CNX

You are here: Home » Content » Modeling reverb in Matlab

Recently Viewed

This feature requires Javascript to be enabled.

Modeling reverb in Matlab

Summary: A very simple reverb implementation in Matlab

Reverb with a guitar is exactly the same as creating reverb with any other sound signal. This can be modeled with a difference equation of the form:

a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb) - a(2)*y(n-1) - ... - a(na+1)*y(n-na)

For this implementation, the difference equation I used had both feedback and feedforward delay. The difference equation was:

y(n) = gain * x(n) + x(n – delay) – gain * y(n – delay)

In order to get the desired reverb effect, the guitar signal is passed through this difference three times with increasing delay. This adds multiple delayed copies of the signal to the original signal.

The Matlab code that implements this reverb is:

function [output]=rev(sound, gain, delay)

output = sound;
d = delay * 5000;

for i = 1:3,
b=[gain zeros(1,round(d/i)) 1];
a=[1 zeros(1,round(d/i)) gain];
output = filter(b, a, output);
end

output = sound + output;

Content actions

Give feedback:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks