# E85.2607 - Practical: Schroeder Allpass Reverberator

Write a MATLAB function that uses Schroeder allpass sections in series to produce an artificial diffuse reverb. The function declaration should be:

```function output = schroederReverb(x, k, fs)
% y = schroederReverb(x, k, fs)
%
% where x is the input signal, k is the number of allpass
% sections, and fs is the sampling rate.
```

To do this you should write a function corresponding to a single allpass section, with the following signature:

```function output = schroederAllpass(x, M, g)
% y = schroederAllpass(x, M, g)
%
% where M is the length of the delay line and g is the gain.
```
which you should call from `schroederReverb`. Each allpass filter should have a transfer function of the form:
```H(z) = (-g + z^(-M)) / (1 - g * z^(-M))
```
where `g = 0.7`, and the delay length M for allpass section `i=0,1,...,k-1` is given by:
```M = ceil(0.1 * fs / (3^i))
```

That is, 100ms worth of samples divided by `3^i` (as recommended by Schroeder), rounded up. So, for the first allpass filter (`i=0`), `M = ceil(0.1*fs)`, for the second (`i=1`), `M = ceil(0.1*fs/3)`, etc., up to `i=k-1`.

Make some cool sounds (you can find a good input here), and show what's happening in some spectrograms. Describe what happens for different values of `k` and `g`.

(borrowed again from Matt Hoffman)

Last updated on 2010-02-18.