DISCLAIMER

Revision: 0
Date: Aug 23rd, 1997

The effects page


Delay, echo, reverberation


Delay is nothing but a delay line, dead easy. The amount of different effects that can be constructed with it, far excedes the simplicity of its definition. As we set the delay between 50 and 100 ms, we'll get a sound on sound effect; moving to larger delays leads to a slapback effect. Feeding this delayed signal back to the input produces repetition, which is sometimes referred to as echo if the delay time is long, or reverberation (reverb) if the delay time is short (about 100ms), although some comments must be made on this. I personally prefer not to call this an echo, as a real echoed sound looses some treble content, so I would add a low-pass filter before using the delayed signal. Another similar effect is the multi-tap delay, which uses a multi-tap delay line, each tap with a different delay. If these outputs are fed back to the input, an interesting rhythm pattern is so generated, specially with long delays.

Delay block diagram

Reverb is a totally different business.
No matter the basic delay and feedback scheme produces a 'room' sensation similar to the reverberation we get on a live room, this model lacks a fundamental component that characterizes that room, which are early-reflections. The described model accurately represents what happens on a room after sound extinguishes. The feedbacked delay line acts as an IIR (Infinite Impulse Response) filter, as it keeps reproducing sound once the original excitation is no longer present. Here we have to accept that this (may be) 10 secs. the sound stays reverberating is considered infinity, as it is two magnitude orders bigger when compared to the 100 ms the early-reflections last. This early-reflecions are signals that come to us immediately after the sound's original emission, and fade away almost immediately after this. They are produced because of the existence of obstacles and parallel paths between the signal source and our ears. This reflections' intensity is comparable to the original sounds', meanwhile the late-reflections' intensity, is quite small. Late-reflections originate as bounces on the walls, floor and ceiling, and keep going for a while. People who studied this matter, as Schroeder and Moorer, had modeled early-reflections as FIR (Finite Impulse Response) filters, and late-reflections as cascaded IIR filters, getting to an accurate approximation to the real reverbarated sound.
Analog Implementation Digital Implementation DSP Implementation

Flanger


A flanger is nothing but a variable delay line with feedback (see diagram). The incoming signal is delayed between 0 and 10 ms and is then added to the original signal. A part of this delayed signal can be fed back and added to the original signal before getting into the delay line. The fact of adding both direct and delayed signals, forms a comb filter, which moves itself along the frequency axis at the time the delay time varies. This comb filter's teeth get near or far to each other as long as the delay time gets shorter or longer. This produces the already known envelope of a "jet airplane". While the feedback amount is increased, this effect is also increased, and the system may even start to oscillate. The delay time sweep must be as linear as possible, so the effect is best appreciated. A triangular wave shape should do, but even as the combīs notches movement that a linear sweep produces is noticeable and pleasant, if they are swept with an exponential function that travels equal spaces (in octaves) in equal times, the whole effect is more noticed.
If the 10 ms delay time is exceeded, a chorus-like effect will begin to be noticed. This effect is described bellow.
Analog Implementation Digital Implementation DSP Implementation

Chorus


A chorus uses a similar scheme as a flanger: a variable delay line and adding both direct and delayed signals. But, now we are dealing with longer delays, between 10 and 50 ms, and the comb effect is less noticeable (teeth are too close to each other). The chorus effect is produced because of two reasons: the variable delay produces a pitch shift as a Doppler effect's analogy, and adding this signal to the original gives the impression of having another instrument playing along with yours, slightly detuned. As this delay is constantly varying, it gives as a result a chorus of instruments along with yours. The use of a triangular signal as the delay modulating signal, whose derivative is a constant, produces two pitch shifts (one upwards and one downwards). On the ascending ramp, the delay gets shorter and the pitch is shifted upwards by a constant amount; on the other hand, on the descending ramp, the pitch is shifted downwards. This fixed amount of shift, on deep delay time modulations, may produce a disgusting detuning effect. The key is to utilize as the delay modulating signal, a signal whose derivative is constantly varying (as a sine), so the obtained pitch shift also constantly varies (a cosine); or (most dificult), a kind of exponential signal that sweeps the desired width in the given time, travelling equal spaces (in octaves) in equal times on the frequency axis. An exponential functionīs derivative is another exponential function changed in scale, so it will also travel equal spaces (in octaves) in equal times, and so the pitch shift will progressively change. As the coefficient changes (inverts) on the sweep back, the observed pitch shift will be equal (in octaves) downwards and upwards, and so the generated chorusing effect will be more deeper, real and comfortable, specially at slow sweeps where the typical "sea waves" sound won't be heard, and will be perceived as a real chorus. Care must be taken not to excede in depth with this modulation, as it is real easy to introduce a a disgusting vibrato effect instead of the chorus.
Analog Implementation Digital Implementation DSP Implementation

Pitch shift


If a signal is fed to a delay line, and this delay gets shorter and shorter, we have, as an analogy to the Doppler effect, a frequency increment, which is proportional to the delay's diminishing speed. If this speed is a constant, the delay is diminishing on a constant basis, and so the frequency increment will be a constant. So, should we plot the time delay variation vs. time, we get a straight line, whose slope is the obtained frequency shift. The new signal will have a frequency f2 = f1 + a * f1, where a is the ramp's slope, and f1 is the original signal's frequency. We know the equally tempered scale has its notes on a "2's 12th root" basis, I mean, twelve of this intervals build an octave, in which the base frequency gets multiplied by two. If we want to get a one semitone pitch shift, then f2 = f1 * ttr, where ttr is "2's 12th root". As f2 = f1 + a * f1 = (1+a) * f1, then a = ttr - 1. So, we can succesivelly find the remaining slopes. If we want to shift 'downwards', an octave down means cutting frequency in half, so we are going to move on "1/2's 12th root" intervals.
Now, all this stuff is pretty nice, but how in life can we build a constantly lenghtening or constantly shortening delay without introducing quite long delays or getting to zero delay ? Well, this is the reason why this method is not perfect; one of the possible solutions is using two delay lines and switch between them when approaching the bad behaviour limits; but this switching produces a hard phase hop on the generated signal, which can be quite disgusting. So we fade both delay line's signals in order to smooth this phase hop, introducing at least undesired tremolo and or vibrato, that can be tolerated. If the time interval during which the delay is swept, has a lenght in which the input signal fits an integer number of cycles, when the sweeping cycle is reset (or delay lines are swapped) there'll be no phase jump. Nevertheless, this requires determining the signal's period and so acting on the sweep, and this means using a DSP system. In this systems, one can play along with the signal's zero crossings to diminish the phase jump problem.
There are a couple of different methods that can perform this task, some of them much more scientific and with a solid maths base; however, I haven't tried them yet...
Analog Implementation Digital Implementation DSP Implementation

Compression, expansion, compression-expansion, compressors/limiters, downward expanders and noise-gates.


Compression is the process used to fit a determined dynamic range on a smaller one. For example, given a 2:1 compression, a 100dB dynamic range can be put on a 50dB media, I mean, a media which saturates at 0dBm and has an own noise of -50dBm. Expansion is the complementary process, it gives a 50dB dynamic range signal a new 100dB dynamic range, for a 1:2 expansion. The whole complementary process of compressing a signal before entering a reduced dynamic range media and then expanding it to get the original one is called compression-expansion. The obvious advantages this process offers are:
1- The whole original dynamic range is preserved.
2- If we limit the signal's dynamic range by other means to 50dB, so it fits the media, we'll get a -50dBm noise on the output, which originates at the media. Expanding on the output reduces this noise down to -100dBm.
The key to perform any of these processes is correctly defining a threshold upon which the processing is made. On compressor-expanders, this level is usually 0dBm, which means that any signal greater than 0dBm will be attenuated and any signal smaller than 0dBm will be amplified on the compression process. The complementary operation will be made on the expansion. The input to output level relationship will give us the compression and expansion ratio. E.g.: a 4:1 compression ratio implies (for a 0dBm threshold) that a 40dBm incoming signal will leave the compressor as a 10dBm signal, being amplified again to 40dBm at the expandor's output.
There's a particular class of compressor, which compresses only signals larger than its threshold. It is called compressor/limiter, because it limits the incoming signal compressing it. The difference between the input level and the output level on a compressor/limiter is called gain-reduction, and it represents the attenuation in dB the incoming signal suffered when compressed.

Compressor/limiter block diagram

The general formulae for a compressor/limiter is:
Vout[dB] = Vt[dB] + (Vin[dB] - Vt[dB]) / CR if Vin[dB] > Vt[dB], where CR is the compression ratio.
Vout[dB] = Vin[dB] otherwise.

So, if the threshold is set at -10 dBm, the incoming signal level is +30 dBm and the compression ratio is 4:1, then the output level will be (30 - (-10)) / 4 + (-10) = 0 dBm, and the gain reduction will be 30dB; the amount of dB the input signal was attenuated. A special case of compressor/limiter is the limiter, which compression ratio is infinite; this way, no matter how much the input signal exceeds the threshold level, the output signal will not exceed it. E.g., on the former scenario, output level will be -10dBm. Applying the compressor/limiter concept to an expander, we'll meet the downward expander, an expander that only expands signals below a certain threshold level (including noise); and in the particular case of infinite expansion, we'll have a gate that opens in presence of a signal exceding the threshold level. By carefully setting this threshold slightly over the noise level, we get a noise-gate. The time elapsed since the signal reaches the threshold level up to the circuit's actuation, (compressing/expanding it to the desired ratio on a CL/DE, open gate on a NG), is called attack time. The time elapsed since this condition no longer exists and the system stabilizes to normal functioning (unity gain on a C/L or DE, closed gate on NG), is called release time.
Analog Implementation DSP Implementation

Phaser or phase shifter


Phaser, the popular 70's effect... A phaser's scheme is somehow similar to a flanger's, and one might say its functioning principles are also similar. A phaser is a delay line, but a phase delay, nor a time delay; and it is also feedbacked. We all know that adding a phase shifted signal to itself produces an increase or decrease in amplitud, leading to a duplication if the phase difference is a multiple of 360 degrees, or even wipe it out if the phase difference is an odd multiple of 180 degrees. Then, this shifting network behaves as a chain of notch filters, sweeping along the frequency axis with the phase shift increase or decrease. As this phase shift is proportional to frequency but not directly proportional, the flanger's comb filter effect doesn't happen, and the resulting sound envelope is not so strong. The resulting notches, doesn't approach each other as in the flanger, they simply shift on the frequency axis, as system response doesn't change with the amount of shifting, it merely shifts on the frequency axis. The number of notches produced is half the number of phase shifting networks, as two of them are needed to get a 180 degrees phase shift and add both signals in opposite phase.
Matematically speaking, adding both direct and phase shifted signals (after n shifting networks) ends up in this transfer function: |T| = sqr( 1 + 2 cos(PH)), where PH is the total phase shift, which for a 4 networks phaser is PH = 8 * atan( 1/ wRC); which looks like this:

Phase shifter transfer

The phase shifting sweep should be one that makes the notches travel equal spaces (in octaves) in equal times, what leads us to a kind of exponential function, very difficult to implement by analogical means, but easily done with a DSP. Furthermore, an analog implementation must take care of some constructive details.
Analog Implementation DSP Implementation


Clarifications and additional explanations

Comb Filter


Adding a delayed signal to itself produces the following scenario:
Let's suppose we have a 1KHz signal and a 1ms delay. Both signals, original and delayed, result in phase, because 1ms is coincident with the 1KHz signal's period. Adding both, we get 1+1=2. After this deep mathematical breakthrough, let's replace de 1KHz signal for a 500 Hz one: 1ms. is now half the period lenght, so it is shifted out 180 degrees. Adding direct and delayed signals, results in 1-1=0. Going further than these high level maths show, we can see clearly that there is a transmission zero at 500 Hz and a maximum at 1KHz. Going below 500 Hz, we'll see that the period is every time larger than the delay, until approaching zero, at the limit, both signals are in phase, so we'll get another maximum at the origin. Going above 1KHz, we'll see that multiples of this frequency have an integer number of cycles inside a 1ms period, so we'll also have maximums here. But odd multiples of 500 Hz (1.5 KHz, 2.5 KHz, etc.) are delayed an integer number of cycles plus a semicycle, resulting 180 degrees out of phase, and producing a zero at that frequency. As we see, this filter has a comb's appearance, with many "teeth" downside, and this is why it is called comb filter. Mathematically speaking, we get Maximums at k/Td, and Zeroes at (2*k+1)/(2*Td), where Td is the time delay; for every integer k from zero to infinity.
The transfer function is plotted on the following graphic
Comb filter plot

Doppler effect analogy


Let's see first the Doppler effect in sound waves:
When a sound source is moving, a stationary observer will detect a different frequency to that which is produced by the source. The wavelength of the sound emitted will be foreshortened in the direction of motion by an amount proportional to the velocity of the source. Conversely the wavelength of a receding sound source will increase. This is what is heard when an ambulance passes near us, when it passes by, we notice a sudden drop in the siren's pitch. Example: A sound source emits 1000 waves per second (1 kHz), and is moving directly towards an observer at a speed of 100 m/sec. After 1 second, the wave front, travelling at the speed of sound, will have travelled 340 meters, while the sound source will have moved 100 meters towards the observer. Therefore, the same number of waves will occupy a space of 340 - 100 = 240 meters and the wavelength will be 240 / 1000 = 0.24 meters. To the observer the frequency heard will be the speed of sound divided by its wavelength = 340 / 0.24 = 1416.7 Hz. If the observer is the one who is moving towards the sound source, there is no change in wavelength. In one second, the observer will hear the number of waves emitted per second plus the number of waves which s/he has passed in the time 1000 + 100 / 0.34 = 1294.1 Hz.
This distinction between which one is the one who moves, is possible due to the fact that there exists a media, the air, in which the sound propagates. The air is stationary and the moving object (source or observer) moves with respect to the air.
Having a delayed signal whose delay is continually varying, can be thought as having a signal whose source is continually coming near and going far from us. By continually diminishing the delay, the source appears to come closer, producing an increase in the perceived frequency, which is proportional to its position's variation derivative respect to the time (a.k.a the speed). By continually increasing the delay, the signal takes longer to reach us, as if its source were going far from us, producing a decrease in the perceived frequency. If the approaching/departing speed is constant, the perceived increase/decrease will also be constant.
Here, we don't have a media in which waves can propagate, so we can't discriminate between the source and the observer moving, which is moving and which is steady, as in sound waves. Although, is clear that the wavelenght foreshortening effect will no longer produce, as there's no propagation in our case. We can say the source is approaching/departing from the observer or the observer is approaching/departing from the source. Considering the last case, we'll say that the observer will see so many cycles of the signal as the source emits, plus the number of cycles he crosses when approaching the source, as an analogy to the Doppler effect.
For example: we have a 1KHz signal passing through a continually diminishing delay, with a speed of 10 ms/s; this is, if the delay is now 50 ms, it will continually diminish so in a second it will have diminished 10 ms, and will be a 40 ms delay, and so on, and so on. We can say this is equivalent to having an observer approaching the coordinate origin at a speed of 10 ms/s (travelling along the time axis), where a source is emitting signals with a period of 1ms, so it will emit 1000 cycles in one second. Once a second has elapsed, the source will have emitted 1000 cycles, and the observer will have travelled 10 ms, crossing the equivalent in cycles of the distance, that is 10 ms * 1000 cycles/s = 10 cycles. So he will see a signal whose frequency is 1000 + 10 = 1010 Hz.
Let f1 be the signal's frequency; let 'a' be the delay variation speed; we'll get a frequency shift of a * f1, and so a new signal of frequency f2 = f1 + a * f1 = (1+a) * f1.

Phase shifter network


An RC network with an operational amplifier, produces a phase lead between almost 0 and almost 180 degrees.
As we can see, phase shift depends on frequency. If the value R is modified, the 90 degrees shift point (set at wRC=1) moves along conveniently. Two of these networks are needed to get a 180 degrees phase shift, getting it at wRC=1. The amount of phase shift at any given frequency is Ph = 2 * arc tg( 1 / wRC ).
Phase shifter network

Transfer function calculation


To calculate the transfer functions of a phase shifter and a comb filter, we examine the circuit response to a known function, e.g. u = e ^jwt. In the comb filter it will be u' = e ^jw(t-Td) and in the phaser will be u' = e ^j(wt-PH).
Both signals are added, so the output will be u + u' and the transfer function (u + u') / u
Then we operate and find the modulus, knowing some basic trigonometric equivalences as e ^ja = cos(a) + j sen(a).


This page hosted by GeoCities Get your own Free Home Page