You are on page 1of 100

1.

INTRODUCTION

1.1. AIM OF THE PROJECT:

Realize various effects of audio signals using MATLAB software.

1.2. METHODOLOGY:

Knowing the parameter variations of audio signals will help in


classification of audio effects. These signal variations and required output signals
can be represented using Digital signal processing which has its own importance
in signal processing. MATLAB software will help to realize various effects of
audio signals through programming.

1.3. SIGNIFICANCE OF THE PROJECT:

Realization of audio effects has its importance in currently


developing audio fields like improving musical effects of electric guitar, speech
recognition, creating robotic sounds etc.
1.4. ORGANISATION OF THE REPORT:

Chapter 2 will give the information about parameters, producing audio signals.
Chapter 3 will give the information about classification of audio signals and brief
introduction to various effects.
Chapter 4 will give the information about brief explanation of time delay and
frequency effects which are having applications in currently developing audio
fields.
Chapter 5 will help in conversion of audio signals, representations of audio signal
effects in digital form.
Chapter 6 will give explanation about MATLAB software.
Chapter 7 contains flowcharts which will help to write MATLAB code.
Chapter 8 results of Realization of various effects of audio signals
2. INTRODUCTION TO AUDIO SIGNALS

2.1. SOUND:

 Most media are visual, sound is aural.


 Sound is a pressure wave in frequencies between 50Hz and 22 KHz.
 Sound is our experience of mechanical waves in air.
 Audible sound frequencies: 20Hz to 20 KHz.
 Wide range of volumes: 120 dB.
 Sounds can be perceived as coming from a location.

2.2. AUDIO FUNDAMENTALS:

 Acoustics is the study of sound.


-Generation, transmission, and reception of sound waves.
-Sound wave energy causes disturbance in a medium.
 Example is striking a drum.
-Head of drum vibrates => disturbs air modules close to head regions of
molecules with pressure above and below equilibrium sound transmitted
molecules bumping into each other.

2.3. SENDING/RECEIVING A SOUND SIGNAL:

 2.3.1. Receiving:
A micro phone placed in sound field moves according to pressures exerted
on it. Transducer transforms energy to a different form (e.g., electrical
energy).
 2.3.2. Sending:
A speaker transforms electrical energy to sound waves.
2.4. TYPES OF AUDIO SIGNALS:

2.4.1. Music:

 Uses full-frequency range.


 Musical notes: basic conceptual unit.
- Attack, steady-state, decay.
- Amplitude changes not uniform over frequencies.
- Attack is critical to instrument perception.
 Need at least 40 k samples/s and 16 bits for high-quality, doubled for stereo.
 Sensitive to data loss.

2.4.2. Speech:

 Much more complex waveforms than music.


 Narrow frequency range: 100 Hz – 10 kHz.
 Speech representation: 8 bit samples.
– 3 kHz range on telephone (200–3400).

– 8 kHz often used in computers (64 kbps).


 Speech perception is robust with respect to lost data.

2.5. IMPORTANCE OF SOUND:

 Passive viewing (e.g. film, video, etc.).


-Very sensitive to sound breaks.
 Video conferencing.
-Sound channel is more important.
-Visual channel still conveys information.
2.6. PRODUSING HIGH QUALITY AUDIO:

 Eliminate background noise.


-Directional microphone gives more control deaden the room in which you
are recording some audio systems will cancel wind noise
 One microphone per speaker
 Keep the sound levels balanced
 Sweeten sound track with interesting sound effects

2.7. BLOCK DIAGRAM OF AUDIO PATH:


3. EFFECTS OF AUDIO SIGNALS

• Effects are applied to modify sounds in many ways – we need to look at


some of the more common
• Effects processes can be broadly categorised as:
 Filtering/equalisation effects:
• Altering the frequency content of a sound
 Dynamic effects;
• Altering the amplitude of a sound
 Delay effects:
• Modifying a sound using time delays or phase shifts

3.1. FILTERING EFFECTS:

 Noise reduction: primarily noise gates.


 Filtering: hi-pass, low-pass, and notch.
 Special filters: de-essing, click repairers.

3.2. DYNAMIC EFFECTS:

• The ‘dynamics’ of a musical signal refer to how loud or soft it sounds


• Dynamic effects can be thought of as automatic volume controls
• They mostly work by turning the volume down for loud signals and back up
again for soft ones
• Differences between dynamic effects are:
– How quickly they respond
– Length of the window over which the input volume is estimated
– How much the gain is altered in response to volume changes
3.3. DELAY EFFECTS:
• This group of effects all work by combining two or more time-delayed
versions of the input signal
• Delay effects are particularly useful as they model many ‘real-world’
environments
• The differences between them are mostly concerned with the length of the
delay:
– Very short delays: Chorus, flanger, phaser
– Medium delays (>100 ms): Echo
– Long delays (several seconds): Reverberation
3.4. EQUALIZATION EFFECTS:
• Equalisation is probably the most widely used effect, so much so that it is
usually provided as standard on most mixing desks
• However, it is used for many purposes including:
– Correcting a non-uniform microphone response
– Suppressing resonant modes
– Enhancing vocal clarity
– Suppressing high-frequency noise (hiss)
– Suppressing low-frequency rumble (e.g. traffic)
– Modifying wide-band sounds (e.g. cymbals) to avoid masking other
parts
Many effects are defined, although they mostly fall under the
following categories:
 Amplitude based effects.

 Time delay effects.

 Waveform distortion effects.

 Frequency response effects (digital filters).

And various combinations of the above effects.


3.5. AMPLITUDE (MODULATION) EFFECTS:

These effects are based on variations in the loudness/volume of the signal.

 3.5.1. Volume control:

In its simplest form, volume control is the controlling of the


amplitude of the signal by varying the attenuation of the input signal. However,
an active volume control will have the ability to increase the volume (i.e. amplify
the input signal) as well as attenuating the signal.

Volume controls are useful for placing between effects, so that


the relative volumes of the different effects can be kept at a constant level.
However, most, if not all effects have volume controls built-in, allowing the user
to adjust the volume of the output with the effect on relative to the volume of the
unaffected signal (when the effect is off).

Volume pedals are commercially available that are used in a


similar way to wah-wah pedals: they are used to create "volume swell" effects and
to fade in from the attack of a note, thus eliminating the attack. This can be used,
for example, to make a guitar sound like a synthesizer by fading it in after a chord
is strummed.

A digital variation of this is the tremolo. This effect varies the


volume continuously between a minimum volume and a maximum volume at a
certain rate.

 3.5.2. Panning :

Panning is used in stereo recordings. Stereo recordings have two


channels: left and right. The volume of each channel can be adjusted - this
adjustment effectively adjusts the position of the perceived sound within the
stereo field. The two extremes being: all sound completely on the left, or all
sound completely on the right. This is commonly referred to as balance on
commercial sound systems.

Panning can add to the stereo effect, but it does not help with
stereo separation. Stereo separation can be achieved by time delaying one channel
relative to the other.

 3.5.3. Compression :

Compression is a widely used effect. The compression effect


amplifies the input signal in such a way that louder signals are amplified less, and
softer signals are amplified more. It is essentially a variable gain amplifier, whose
gain is inversely dependant on the volume of the input signal.

Compression is used by most radio stations to reduce the


dynamic range of the audio tracks, and to protect radios from transients such as
feedback. It is also used in studio recordings, to give the recording a constant
volume, especially to vocals. Using a compressor for a guitar recording makes
finger-picked passages sound smoother, and makes clean lead passages sound
smoother.

Compression tends to increase background noise, especially


during periods of silence. Thus, a noise gate is usually used in conjunction with
the compressor.

 3.5.4. Expansion:

An expander performs the opposite effect of the compressor. This


effect is used to increase the dynamic range of a signal.
 3.5.5. Noise gating :

A noise gate, quite simply, a gates (or blocks) signal whose


amplitude lies below a certain threshold, and lets other signals through. This is
useful for eliminating background noises, such as hiss or hum, during periods of
silence in a recording or performance. At other times, the recording or
performance usually drowns out the background noise.

Noise gates usually have controls for hold time, attack time, and
release time. The hold time is the time for which a signal should remain below the
threshold, before it is gated. The attack time is the time during which a signal
(that is greater than the threshold) is faded in from the gated state. The release
time is the time during which a signal (that is below the threshold) is faded into
the gated state. These controls help to eliminate the problems of distortion caused
by gating signals that are part of the foreground audio signal, and the problem of
sustained notes being suddenly killed by the noise gate.

 3.5.6. Attack delay :

Attack delay is an effect used to simulate "backwards" playing,


much like the sounds produced when a tape is played backwards. It works by
delaying the attack of a note or chord: it exponentially fades in the note or chord
so that it creates a delayed attack.

 3.6. TIME DELAY EFFECTS :

These effects are based on the addition of time-delayed samples to the current
output...
 3.6.1. Echo :

Echo is produced by adding a time-delayed signal to the output.


This produces a single echo. Multiple echoes are achieved by feeding the output
of the echo unit back into its input through an attenuator. The attenuator
determines the decay of the echoes, which is how quickly each echo dies out. This
arrangement of echo is called a comb filter.

Echo greatly improves the sound of a distorted lead guitar solo,


because it improves the sustain and gives an overall smoother sound. Very short
echoes (5 to 15ms) with a low decay value added to a voice track can make the
voice sound "metallic" or robot-like. This was a popular way of creating the
robotic-voice in movies in days gone by.

 3.6.2. Reverberation :

Reverb is used to simulate the acoustical effect of rooms and


enclosed buildings. In a room, for instance, sound is reflected off the walls, the
ceiling and the floor. The sound heard at any given time is the sum of the sound
from the source, as well as the reflected sound. An impulse (such a hand clap)
will decay exponentially. The reverberation time is defined as the time taken for
an impulse to decrease by 60dB of its original magnitude.

Concert halls and rooms have to be designed such that the


reverberation time is adequate for the type of sound that will be produced.
Reverberation time which is adequate for orchestral music can be reached only if
the volume per seat (in a theatre) is about 5m3 per person, which is expensive to
achieve. Thus, concert halls tend to have too short a reverberation time.
Reverberation time of a hall can be lengthened by using a digital reverberator
which adds reverb to the sound, and then re-radiates it in the original room by
loudspeaker arrays.
 3.6.3. Chorus :

The chorus effect is so named because it makes the recording of


a vocal track sound like it was sung by two or more people singing in chorus. This
is achieved by adding a single delayed signal (echo) to the original input.
However, the delay of this echo is varied continuously between a minimum delay
and maximum delay at a certain rate. Typically, the delay is varied between 40ms
and 60ms at a rate of about 0.25Hz.

 3.6.4. Flanging :

Flanging is a special case of the chorus effect: it is created in the


same way that chorus is created. Typically, the delay of the echo for a flanger is
varied between 0ms and 5ms at a rate of 0.5Hz. In days gone by, flanging used to
be created by sound engineers who put their finger onto the tape reel's flange, thus
slowing it down. Two identical recordings are played back simultaneously, and
one is slowed down to give the flanging effect.

Flanging gives a "whooshing" sound, like the sound is pulsating.


It is essentially an exaggerated chorus.

 3.6.5. Phasing :

Phasing is very similar to flanging. If two signals that are


identical, but out of phase, are added together, then the result is that they will
cancel each other out. If, however, they are partially out of phase, then partial
cancellations and partial enhancements occur. This leads to the phasing effect.

Other strange effects can be achieved with variations of echo and chorus.
 3.7. WAVE FORM SHAPING EFFECTS :

These effects distort the original signal by some form of transfer function (non-
linear).

 3.7.1. Symmetrical/Asymmetrical clipping :

Signal multiplied with the hard-limit transfer function (distortion).

3.7.2. Half wave/full wave rectification :

Clipping of one half of the waveform/absolute value of input samples.

 3.7.3. Arbitrary waveform shaping :

Input signal multiplied by arbitrary transfer function. Used to


perform digital valve/tube distortion emulation, etc.

 3.7.4. Distortion :

Distortion is usually achieved using one of the clipping functions


mentioned above. However, more musically useful distortion can be achieved by
digitally simulating the analog circuits that create the distortion effects. Different
circuits produce different sounds, and the characteristics of these circuits can be
digitally simulated to reproduce the effects.
 3.8. FREQUENCY (FILTER) EFFECTS :

These are effects based on filtering the input signal or modulation of its
frequency.

 3.8.1. Pitch Shifting :

This effect shifts the frequency spectrum of the input signal. It


can be used to disguise a person's voice, or make the voice sound like that of the
"chipmunks", through to "Darth Vader". It is also used to create harmony in lead
passages, although it is an "unintelligent" harmonizer.

The special case of pitch shifting is Octaving. Here, the


frequency spectrum is shifted up or down by an octave.

 3.8.2. Vibrato :

Vibrato is obtained by varying the pitch shifting between a


minimum pitch and maximum pitch at a certain rate. This is often done with an
exaggerated chorus effect.

Double sideband modulation:

This effect is more commonly known as ring modulation. In this


effect, the input signal is modulated by multiplying it with a mathematical
function, such as a cosine waveform. This is the same principle that is applied in
double sideband modulation used for radio frequency broadcasts. The cosine
wave is the "carrier" onto which the original signal is modulated.

 3.8.3. Equalization :

Equalization is an effect that allows the user to control the


frequency response of the output signal. The user can boost or cut certain
frequency bands to change the output sound to suit their tastes. It is usually
performed with a number of band pass filters all centered at different frequencies
(outside each other's frequency band), and the band pass filters have controllable
gain.Equalization can be used to enhance bass and/or treble.

 3.8.4. Wah-wah :

Also known as parametric equalization. This is a single band


pass filter whose centre frequency can be controlled and varied anywhere in the
audio frequency spectrum.

This effect is often used by guitarists, and can be used to make the guitar "talk".

 3.8.5 Vocoding :

Vocoding is an effect used to make musical instruments "talk". It


involves the dynamic equalization of the input signal (from a musical instrument)
based on the frequency spectrum of a control signal (human speech). Think of it
this way: the frequency spectrum of the human speech is calculated, and this
frequency spectrum is superimposed onto the input signal. This is done in real-
time, and continuously.

Another form of Vocoding is performed by modeling the human


vocal tract and thus synthesizing human speech in real-time.

• But importance is given to audio effects which have real time applications
such as time delay & Frequency effects.
• Those are
 Echo & Multiple echoes.
 Reverberation.
 Flanging.
 Pitch shifting.
 Equalization.
 Fading.
• These are having more applications in currently developing audio fields
4. TIME AND FREQUENCY DELAY EFFECTS

4.1. DELAY:

4.1.1. Introduction:

The delay is one of the simplest effects out there, but it is very
valuable when used properly. A little delay can bring life to dull mixes, widen
your instrument's sound, and even allow you to solo over yourself. The delay is
the also a building block for a number of other effects, such as reverb, chorus, and
flanging.

4.1.2. The Basic Delay:

Simply put, a delay takes an audio signal, and plays it back after
the delay time. The delay time can range from several milliseconds to several
seconds. Figure 4.1 presents the basic delay in a flow-graph form. This only
produces a single copy of the input, and thus is often referred to as an echo
device.

Figure 4.1: Diagram of the basic delay unit, or an echo device.


Just having a single echo effect is rather limiting, so most delays
also have a feedback control which takes the output of the delay, and sends it back
to the input, as shown in Figure 4.2. Now you have the ability to repeat the sound
over and over, and it becomes quieter each time it plays back (assuming that the
feedback gain is less than one. Most delay devices restrict it to be less than one
for stability). With the feedback, the sound is theoretically repeated forever (at
least until you turn the unit off), but after some point, it will become so quiet that
it will be below the ambient noise in the system and inaudible.

Figure 4.2: Diagram of the basic delay unit with feedback.

Delays are very useful for filling out an instrument's sound. Playing through a
delay unit with a short echo, say 50 to 100 milliseconds creates a doubling effect,
as though two instruments were being played in unison. Using several delays
together with feedback can be used to create a reverb-like sound, though a typical
reverb unit will create a more complex sound pattern.

As you increase delay times beyond 100 milliseconds or so, the


delay no longer a subtle effect. One interesting possibility is to match the delay
time to the tempo of a song so that the delayed copies of the sound fall on the
beat. Extending to very long delay times close to a second or more gives you a
chance to play over yourself and develop harmonies even though you may only
be playing one note at a time. Looping and sampling are just a short jump away.
Instead of repeating everything you play, you can record a segment of your
playing, say a chord progression, and then loop it - play the recorded audio over
and over. This lets you go a step further so you can actually solo over yourself
when you don't have a rhythm player at your command. Some delay pedals
include sampling capability, though the length of the sample may be limited to
two seconds or less. For serious looping, you will need devices with longer
recording times, such as Lexicon's JamMan and the Oberheim Echoplex, are
some of the popular units on the market for looping, and they offer other
capabilities over straight looping, such as recording additional sounds onto the
sample, playing the loop backwards.

Delays are also very important when building a mix of


instruments in a stereo environment. It can enhance stereo placement of
instruments, and making the mix sound 'bigger'. A little delay can be more
effective than panning for spreading tracks out in the stereo field. Just a simple
delay on the order of 20 milliseconds can make a big difference.

4.1.3 Echo & Multiple echoes:

Echo is produced by adding a time-delayed signal to the output.


This produces a single echo. Multiple echoes are achieved by feeding the output
of the echo unit back into its input through an attenuator. The attenuator
determines the decay of the echoes, which is how quickly each echo dies out. A
delay takes an audio signal, and plays it back after the delay time. The delay time
can range from several milliseconds to several seconds.
Figure 4.1 presents the basic delay in a flow-graph form. This only produces a
single copy of the input, and thus is often referred to as an echo device.

Multi echo filter realizes infinite number of echoes spaced "R"


sampling periods apart and with exponentially decaying amplitude.
The Block diagram of the multi-echo filter is given below.
Figure4.4: Diagram of multi echo device.

Its Transfer function is given by

H (Z) = Z-R / (1 - alpha * (Z-R)).

4.2. REVERBERATION:

4.2.1. Introduction:

Reverberation (reverb for short) is probably one of the most


heavily used effects in music. When you mention reverb to a musician, many will
immediately think of a stomp box, signal processor, or the reverb knob on their
amplifier. But many people don't realize how important reverberation is, and that
we actually hear reverb every day, without any special processors.

4.2.2. What is Reverberation?

Reverberation is the result of the many reflections of a sound that


occur in a room. From any sound source, say a speaker of your stereo, there is a
direct path that the sounds cover to reach our ears. But that's not the only way the
sound can reach us. Sound waves can also take a slightly longer path by reflecting
off a wall or the ceiling, before arriving at your ears, as shown in Figure 4.5. A
reflected sound wave like this will arrive a little later than the direct sound, since
it travels a longer distance, and is generally a little weaker, as the walls and other
surfaces in the room will absorb some of the sound energy. Of course, these
reflected waves can again bounce off another wall before arriving at your ears,
and so on. This series of delayed and attenuated sound waves is what we call
reverb and this is what creates the 'spaciousness' of a room.
Figure 4.5: Sound waves travel many different paths before reaching your ears.

It's very tempting to say that reverb a series of echoes, but this
isn't quite correct. 'Echo' generally implies a distinct, delayed version of a sound,
as you would hear with a delay more than one or two-tenths of a second. With
reverb, each delayed sound wave arrives in such a short period of time that we do
not perceive each reflection as a copy of the original sound. Even though we can't
discern every reflection, we still hear the effect that the entire series of reflections
has.

So far, it sounds like a simple delay device with feedback might produce
reverberation. Although a delay can add a similar effect, there is one very
important feature that a simple delay unit will not produce - the rate of arriving
reflections changes over time, whereas the delay can only simulate reflections
with a fixed time interval between them. In reverb, for a short period after the
direct sound, there is generally a set of well defined and directional reflections
that are directly related to the shape and size of the room, as well as the position
of the source and listener in the room. These are the early reflections (also called
the 'early echoes' despite the general meaning of the word 'echo'). After the early
reflections, the rate of the arriving reflections increases greatly. These reflections
are more random and difficult to relate to the physical characteristics of the room.
This is called the diffuse reverberation, or the late reflections. It is believed that
the diffuse reverberation is the primary factor establishing a room's 'size', and it
decays exponentially in good concert halls. A simple delay with feedback will
only simulate reflections with a fixed time interval between reflections.

Figure 4.6: Impulse response of a room.

An example impulse response for a room is depicted in Figure 4.6.Another very


important characteristic of reverberation is the correlation of the signals that reach
your ears. In order to give a listener a real feeling of the 'spaciousness' of a big
room, the sounds at each ear should be somewhat incoherent. This is partly why
concert halls have such high ceilings - with a low ceiling; the first reflections to
reach you would have bounced off of the ceiling, and reaches both of your ears at
the same time. By using a very high ceiling, the first reflections to reach the
listener would generally be from the walls of the concert hall, and since the walls
are generally different distances away, the sound arriving at each ear is different.
This characteristic is important for stereo reverb design.

A measure that is used to characterize the reverberation in a room


is the reverberation time. Technically speaking, the reverb time is the amount of
time it takes for sound pressure level or intensity to decay to 1/1,000,000th (60
dB) of its original value (or 1/1000th of its original amplitude.) Longer
reverberation times mean that the sound energy stays in the room longer before
being absorbed. Reverberation time is associated with what we sometimes call the
'size' of the room. Concert halls have reverberation times of about 1.5 to 2
seconds.

The reverberation time is controlled primarily by two factors -


the surfaces in the room, and the size of the room. The surfaces of the room
determine how much energy is lost in each reflection. Highly reflective materials,
such as a concrete or tile floor, brick walls, and windows, will increase the reverb
time as they are very rigid. Absorptive materials, such as curtains, heavy carpet,
and people, reduce the reverberation time (and the absorptivity of most materials
usually varies with frequency). You may be able to this notice difference on a gig.
During the sound check, the room will sound 'bigger', but during the actual
performance, the room may not sound as empty. People tend to absorb quite a bit
of energy, reducing the reverberation time. Bigger rooms tend to have longer
reverberation times since, on the average; the sound waves travel a longer
distance between reflections. The air in the room itself will also attenuate the
sound waves, reducing the reverberation time. This attenuation varies with the
humidity and temperature, and high frequencies are affected most. Because of
this, many reverb processors incorporate low pass filters.

Since we are so accustomed to hearing reverberation, we often


have to specifically listen for it in order to notice it. Probably the best way to
notice reverb is to listen after short, impulsive sounds, while the sound is still
bouncing around. If you want to test out the reverb in various rooms of your
house or apartment, clapping your hands works pretty well.

4.2.3. Direct and Reverberant Sound Fields:

(This section is mostly a background in acoustics, and not


directly related to reverb effects design and usage)

In acoustics, we talk about the direct and reverberant sound


fields in a room. If the direct sound from a source that reaches you is louder than
the reflections, you are in the direct field. If, on the other hand, the sound pressure
due to the reflected sounds is greater than the direct sound, you are in the
reverberant field. The point at which the direct field and reverberant field
intensity are the same is called the critical distance.

The reverberant field is extremely important. In fact, most of the


time you are in the reverberant field and without it, any performance or lecture
would be very hard to follow. As you may know, trying to speak to a group of
people outside requires that you speak louder than necessary when speaking in a
room. The reverberation of a room helps to keep the sound energy localized in the
room, raising the sound pressure level and distributing the sound throughout it.
Outdoors, many of the reflective surfaces are missing, and much of the sound
energy is lost.

The reverberant field is also important for music. First, it helps


you to hear all the instruments in an ensemble, even though some of the
performers away are further away then others. Also, many instruments, such as
the violin, don't radiate all frequencies equally in all directions. In the direct field
alone, the violin will sound quite different (and even unpleasant) as you move
with respect to the violin. The reverberant field in the room helps to spread out
the energy the instrument makes so it can reach your ears - it truly can enhance a
performance. If you can get access to an anechoic chamber (a room design to
have no reflections), see if you can get someone to bring an instrument in and see
what happens.

Of course, there can be too much of a good thing. As the


reverberation time becomes very large, it can be very difficult or impossible to
comprehend speech and follow lines of musical instruments. This can be noticed
in many gymnasiums and large rooms or hallways with many windows.

4.2.4. Why use Reverb?

If reverb is always around us, why do we add reverb to recorded


sounds? Well, many times we are listening to music, we are in environments with
very little or poor reverb. The reverberation in a car for example, may not be
sufficient to create the majestic sound of a symphony orchestra. And when using
headphones, there is no reverberation added to the music. A very dry signal can
sound quite unnatural. Since we can't always listen to music in a concert hall or
other pleasing environments, we try to add reverberation to the recording itself.

To add reverb, one could make the recordings in a highly


reverberant room such as a concert hall, but this is often impractical since such
rooms may not be easy to access, be located far away, or too expensive to use.
This has caused the development of a variety of ways to synthetically add reverb
to recordings.

4.2.5. Common Parameters:

Predelay

The predelay is the amount of time before the first reverberations


of a signal are heard, i.e. the time before the first early reflection in the
impulse response. In some cases, the predelay may be defined as the time
before the late reflections are heard. More complex reverberation units may
actually allow you to set the predelay for both the early and late reflections.
For simulation of real environments, the predelay for the early reflections
should always be smaller than for the late reflections.
Figure 4.7: A room impulse response with the predelay parameters labeled.

Reverb Decay

The reverb decay indicates how you how long the reverb can be
heard after the input stop. The actual measure of what can be 'heard' can vary
among manufacturers. The reverb decay is typically in terms of milliseconds,
which can be thought of as something like the reverb time.

Gate Time

This parameter applies to gated reverbs. The gate time is simply


the length of time that the reverb is allowed to sound. This may also refer to the
length of a reverse reverb.

Gate Decay Time

Some units with gated reverbs will also provide this parameter,
which controls how the gate is actually applied or 'closed'. A very short gate time
means that the reverb is cutoff rapidly, such as shown in Figure 4.7. Longer decay
times means that the reverb is given some time to fade away gradually.

Gate Threshold

Rather than apply a gated reverb to an entire signal, you could


very well only gate the reverb depending on signal levels. Typically, the gate on a
reverb will be kept open (the impulse response is not truncated) when signals are
above this value, but as when the signal drops below the threshold, the gate closes
and the number of reflections is reduced. The gate will open again when the
signal rises back above the threshold. Some gated reverbs may use a threshold
that is not user programmable.

4.3. FLANGING:

4.3.1. Introduction:

Flanging has a very characteristic sound that many people refer


to as a "whooshing" sound, or a sound similar to the sound of a jet plane flying
overhead. Flanging is generally considered a particular type of phasing (another
popular effect). As will be shown below, flanging creates a set of equally spaced
notches in the audio spectrum. Phasing uses a set of notches as well, but the
spacing of them can be arbitrary and the notches in a phaser are usually created
using allpass filters.

4.3.2. How it Works?

Flanging is created by mixing a signal with a slightly delayed


copy of itself, where the length of the delay is constantly changing. This isn't
difficult to produce with standard audio equipment, and it is believed that flanging
was actually "discovered" by accident. Legend says it originated while the Beatles
were producing an album. A tape machine was being used for a delay and
someone touched the rim of a tape reel, changing the pitch. With some more
tinkering and mixing of signals, that characteristic flanging sound was created.
The rim of the reel is also known as the 'flange', hence the name 'flanging'.
Most modern day flangers let you shape the sound by allowing you to control
how much of the delayed signal is added to the original, which is usually referred
to as a 'depth' control (or 'mix'). Figure 4.8 is a diagram of a simple flanger with
this depth control.

Figure 4.8: Diagram of a simple flanger. The delay changes with time

When we listen to a flanged signal, we don't hear an echo


because the delay is so short. In a flanger, the typical delay times are from 1 to 10
milliseconds (the human ear will perceive an echo if the delay is more than 50-70
milliseconds or so). Instead of creating an echo, the delay has a filtering effect on
the signal, and this effect creates a series of notches in the frequency response, as
shown in Figure 4.9. Points at which the frequency response goes to zero means
that sounds of that frequency are eliminated, while other frequencies are passed
with some amplitude change. This frequency response is sometimes called a
comb filter, as its notches resemble the teeth on a comb.
Figure 4.9: The frequency response of a simple flanger with two different delay
times (both with a depth of 1). The plot on the left would be for a flanger with a
smaller delay than that on the right

These notches in the frequency response are created by


destructive interference. Picture a perfect tone - a sine wave. If you delay that
signal and then add it to the original, the sum of the two signals may look quite
different. At one extreme, where the delay is such that the signals are perfectly out
of phase, as one signal increases, the other decreases the same amount, so the
entire signal will disappear at the output. Of course, the two signals could still
remain in phase after the delay, doubling the magnitude of that frequency
(constructive interference). For any given amount of delay, some frequencies will
be eliminated while others are passed through. In the flanger, you can control how
deep these notches go by using the depth control. When the depth is at zero, the
frequency response is flat, but as you increase the depth, the notches begin to
appear and extend downward, reaching zero when the depth is one. Even if the
notches do not extend quite all the way to zero, they will still have an audible
effect.

The characteristic sound of a flanger results when these notches


sweep up and down the frequency axis over time. Picture the notches
compressing and expanding like a spring between the two plots in Figure 4.9. The
sweeping action of the notches is achieved by continuously changing the amount
of delay used. As the delay increases, the notches slide further down into the
lower frequencies. The manner in which the delay change is determined by the
LFO (Low Frequency Oscillator) waveform (discussed below).

This changing of the delay in the flanger creates some pitch


modulation - the perceived pitch 'warbles'. This happens because you have to
'read faster' or 'read slower' from the delayed signal. Picture a flanger created by
two tape reels running the same audio signal. To increase the delay between the
two signals, you have to slow one of the reels down. As you may know from
experience, as you slow down a tape, the pitch drops. Now to decrease the delay,
you have to catch up - sort of like fast forwarding, which increases the pitch (also
known as the 'munchkin effect'). Of course only the delayed copy of the sound
has this pitch change, which is then mixed in with the unaltered signal.

4.3.3. Common Parameters:

Depth (Mix)

This is the depth parameter referred to above. The larger the


depth, the more pronounced the notches in the flanger. In multi effects
units, the depth may only be controllable in the mixer section, and not
available within the flanging processor. Some people use the term 'mix'
interchangeably with 'depth'.

Delay

The delay parameter specifies the minimum delay used on the


copy of the input signal - as the delay changes, this will be the smallest
delay. Looking at the frequency response, this value determines how high
the first notch will go. As the delay is increased, the first notch drops down.
In some cases, the delay parameter can be set to zero, in which case the
notches will sweep the uppermost frequency range, and essentially
disappear momentarily. In other cases, you may not be able to control delay
parameter.

Sweep Depth

T he sweep depth determines how wide the sweep is in terms of


delay time - essentially the width of the LFO. This sweep depth is the
maximum additional delay that is added to the signal in addition to the
delay in the delay parameter. It determines how low the first notch in the
frequency response will reach. A small value for the depth will keep the
variance in the delay time small, and a large value will cause the notches in
the frequency response to sweep over a larger area. Figure 4.10 shows how
the delay and sweep depth parameters are related to the LFO. The minimum
delay applied to the signal is given by the delay parameter, and the
maximum delay is the sum of the delay and sweep depth parameters.

As the sweep depth is increased, the pitch modulation effect


mentioned above will become more noticeable. The flanger needs to read
even faster or slower to change the delay in the same amount of time.

Note that when you vary the delay parameter, both the upper and
lower limits of the first notch are changed, but when you adjust the depth,
only the lower limit is affected. So when you are setting up a flanger to
sweep over a particular range, first set the delay so that the high point of the
sweep is where you want it, and then adjust the sweep depth to set the low
point of the sweep. (When I refer to the sweep here, I'm talking about the
notches, not the delay time. Remember that the parameters you set are
controlling the delay, and that the notches result from this delay. As the
delay increases, the notch frequencies decrease.)

Figure 4.10: The relationship between the sweep depth and delay parameters.

LFO Waveform
Some flangers will allow you to choose the LFO waveform. This
waveform determines how the delay in the flanger varies in time. Figure 4.11
show some common LFO's. The triangle is probably the more common choice in
flangers.

Figure 4.11: Two common LFO waveforms.

Feedback/Regeneration

Some units will give you an option for taking a portion of the
flanger's output and routing it to the input. In some cases, you can also specify
whether to add or subtract the feedback signal. A large amount of feedback can
create a very 'metallic' and 'intense' sound. A diagram for the flanger with
feedback is shown in Figure 5. Of course as the feedback gain approaches one,
the system can be come unstable, possibly resulting in overflow or clipping.

Figure 4.12: The more complex flanger including a feedback path and LFO
control over the delay.
Speed/Rate

The speed control is pretty straightforward. This parameter refers


to the rate at which the LFO waveform repeats itself, or equivalently, how many
times per second the notches sweep up and down. The speed also affects the
amount of pitch modulation. By increasing the speed, the flanger will have to
sweep through the depth in less time.

4.4. PITCH SHIFTING:


4.4.1. Introduction:

Following the distortion is another effect called pitch shift.


Basically every note played on the guitar corresponds to a specific pitch or
frequency. What the pitch shifter does is changes the pitch by a set amount. The
shift can be either higher in pitch or lower in pitch.

For a guitar player pitch shifting offers a different range of


pitches than the guitar normally offers (Advantage) and provides very low signal
quality due to inherent problems in the technique used (Disadvantage).

4.4.2. Creation of Pitch shifting:

The approach used to create pitch shifting is very similar to the


approach used for the delay effect. Again the signal is converted to digital at a rate
equal to the clock pulses. The signal passes through is controlled by a separate
clock. The signal is then converted back to analog at a rate equal to the clock
pulses. If the memory clock frequency is at the same frequency as the sampling
clock, a delay effect will occur.

But the pitch shifter varies the rate (At which information passes
through the memory) to a frequency that is either higher or lower than the
sampling rate. If the frequency is higher than the sampling rate the pitch of the
analog signal will increase and vice versa). This is possible because the frequency
of the output waveform is controlled by the rate at which it enters the D-A
converter. This technique however creates either a build up of data or gaps in the
digital information, due to the changed clock frequency. These gaps or overlaps of
data are then interpreted as distortion, thus making the overall tonal quality low.

4.4.3. Pitch time changer:

The pitch time changer lets you very the playback speed
(duration) and the pitch of the input signal independently.

For pitch shifting, the algorithm works by loading memory with


an incoming signal sampled at rate A and reading out the samples at rate B. The
ratio A/B determines the pitch change. To maintain a continuous output signal,
samples must be repeated for upward pitch shifts or skipped for downward pitch
shifts. Because the output address pointer repeatedly overtakes the input address
pointer for pitch increases or is overtaken by the recirculating input address
pointer for pitch decreases, the output address must occasionally jump to a new
point in the memory. To strength the time base of the input signal, the algorithm
repeats small “grains”(segments) of the input signal, while for time shrinking, it
deletes intermediate grains. The sound quality of the pitch time changer is based
on the nature of the input signal and on the ratio of pitch change it is asked to
perform. Small pitch and time changes tend to generate less-audible side effects.
4.4.4. Common parameters:

Speed

The Speed variation, where1%resultsin an unrecognizably-


elongated version of the sound and 200 corresponds to a double-speed rendition
of the input signal. Settings up to 400% (4x normal speed) are permitted.
Pitch

The Pitch variation from -200 to +200%, where 0% represents a


transposition towards extreme low frequencies and 200 transposes the input sound
up an octave. Note that negative values of pitch shifting cause the pitch of the
source signal to be shifted the same amount as positive percentage values, but the
playback direction of the individual sound fragments, or “grains” are reversed.
This can be especially interesting on speech or rhythmic sounds. For example,
pitches of -100% results playing the sound at its original pitch, but broken into
small, backwards chunks.

Pitch change mix

Ranges from 0-100%. Sets the mix of time stretched signal;


100% means all pitch shifted signal.

Pitch changer

This effect is called” Pitch Shift”. The pitch changer varies the
pitch of the input signal. The algorithm works by loading memory with an
incoming signal sampled at rate A and reading out the samples at rate B. The ratio
A/B determines the pitch change. To maintain a continuous output signal, samples
must be repeated for upward pitch shifts or skipped for downward pitch shifts.
Because the output address pointer repeatedly overtakes the input address pointer
for pitch increases or is overtaken by the recirculating input address pointer for
pitch decreases, the output address must occasionally jump to a new point in the
memory.

4.4.5. Way to change the pitch of the sound:


There are several different ways of changing a sound’s pitch. The
best method to use depends on what the sound is, what quality is required, and
how much processor power we have. Here are the main methods of pitch
changing.

If the signal we want to pitch shift is speech then we can split the
signal into small blocks and then add or remove blocks to make the speech lost
longer/shorter (more/less samples). Then to speed up, play at a faster rate (or
convert the sample rates [2-3]). The sections must be split at zero crossings or
cross-faded so that clicks are not produced between blocks. Detecting the pitch
sections (pitch pulses) requires knowledge of how speed is produced and is the
main obstacle in using this method. Auto-correlation is probably the most popular
way of detecting these sections although it requires lots of computing power.

For any other type of signal a version of the chorus can be used.
The chorus effect [3-4] changes the pitch of a signal by changing the sampling
frequency, causing the time to “wobble” around its normal value. If a saw tooth
wave is used to modulate the sampling frequency then the signal is pitch shifted
up (or down). When the edge of the saw tooth occurs there will be a click on the
output. To get around this, some form of filter could be used. If there modulation
signals are out of step with each other then we can switch the output between the
two flangers so that we avoid the click. In order to prevent the clicks when the
change of output source is made some form of filtering may be needed.

The final method of pitch shifting is the most complex but gives
the best quality results. We can transform the input signal into the frequency
domain (using the Fourier transform) and stretch the frequency information, so
that the frequencies of the signals are changed. Reverse transforming this new
frequency domain representation will give a pitch shifted signal.

4.5. EQUALIZATION:
4.5.1. Introduction:
By using the Low-Pass, High Pass and Band-Pass Filters, an
audio equalizer can be built. This allows the user to magnify or dampen any
frequencies that they choose. Many equalizers on the market allow users to
change up to 20 different frequency bands. For simplification we designed an
equalizer with three bands: the lower band, a middle band, and the upper band.
This was done with the
Mat lab code that follows and the output is also shown below.
The user can go through and change the gains to see the different effects that
occur to the signal.

A simple block diagram of the equalizer is given below

Figure 4.13: Diagram of the equalizer

Equalization is the process of boosting or cutting certain


frequency components in the signal. The name originates from the application of
trying to obtain a flat frequency response-no correlation. For example, when
transmitting voice signals over long distances of wire, the high frequencies would
be attenuated. By applying some equalization filters, this loss could be ‘undone’
so that the voice would sound more natural on the receiving end. Equalization is
very important tool in recording for bringing out an instrument’s sound.

The equalizer feature analyzes the apparent audio frequency


response of the receiver by averaging the input signal and then creating an
equalization curve which it apply against the input to flatten the overall response.
Typically the high frequencies are amplified and low frequencies are reduced.
While this doesn’t reduce noise, it does make the signal more natural and pleasant
to listen to.

4.5.2. Tone controls:


The most common equalization system is probably the tone
controls that can be found on most stereo systems. They provide a quick and easy
way to adjust the sound to suit our tests and partially compensate for the room.
We will often find the controls labeled ‘bass’ and ‘treble’. Each of those knobs
controls a special type of filter called a shelving filter, or more precisely, a low
pass shelving filter and a high pass shelving filter respectively. The frequency
responses for those two filters are shown in figures. The plots are of the frequency
response magnitude, which shows us the gain at each frequency component. If the
gain is greater than one then it will boost the signal and if the gain is less than one
then it cuts the sound.

Figure 4.14: The frequency responses of low pass shelving filter


Figure 4.15: The frequency responses of high pass shelving filter

In most applications, low pass and high pass filters arty to totally
remove a portion of the spectrum. For example, a low pass filter tries to eliminate
all the high frequencies. But with the shelving filters, we are not always trying to
remove any thing we are just boosting or cutting one portion while leaving the
rest unaffected.

The frequency where the frequency response makes the


transition between the two levels of gain (even though it may be very gradual) is
called the cut of frequency. We could design a tone control that let us change this
cut of frequency in addition to the level of cut or boost, but this is usually fixed at
the design state and cannot be adjusted by the user.

In addition to bass and treble controls, we may find ‘mid’


controls such as the 3-band equalizer commonly found on mixers. As we may
guess, this affects frequencies in between the highs and lows. This is often
referred to as a peaking or band pass filter. Again, it generally does not attempt to
isolate certain frequencies, but rather boost or cut a small portion of the audio
spectrum without affects the other frequency bands.

This type of filter generally does not have a defined cut off
frequency, but this instead defined by two other characteristics. The frequency at
which the peaking filter is at its maximum (or when cutting the signal, the
minimum) gain is called the center frequency. The other important characteristic
is the bandwidth, which basically means how wide the peaking filter is (how wide
of a frequency rage it offers). Generally we are only able to adjust the boost or
cut, and the center frequency and bandwidth are fixed.

Figure 4.16: The frequency response of a peaking filter

Tone controls are very simple equalization system since they


only have two or occasionally three filters. Because of this simplicity, the filters
are typically connected in series. Selectively boosting or cutting bands of
frequencies to improve the performance of a sound reinforcement system is called
equalization.
4.5.3. Uses of Equalization:

Noticeably, but not dramatically, improve the naturalness or


intelligibility of a sound reinforcement system by emphasizing the frequency
ranges most critical for speech. Noticeably, but not dramatically, improve the
naturalness or intelligibility of a sound reinforcement system by reducing the
system’s output in the frequency bands at which feedback occurs. These
frequency bands will differ from system to system based on many variables,
including room acoustics, micro phone placement/design, loud speaker
location/design, even air temperature.
4.5.4. Equalization cannot do:

Make a poorly designer sound reinforcement system work


satisfactorily. Every well designed sound reinforcement system is subject to the
laws of physics described by the potential acoustic gain equation.

Improve intelligibility problems caused by reverberation,


reflections mechanical vibration, high background noise levels, or other problems
caused by the location or physical design of the room. These problems are
acoustical in nature and cannot be solved electronically. They must be resolved
with acoustical solutions, such as sound absorbent panels and heavy drapes.

Improve intelligibility problems caused by the talker being too


far from the microphone. Improve the performance of substandard audio
components in the sound reinforcement system. Eliminate distortion or noise
problems caused by mismatched audio levels between system components.
Improve echo return problems in teleconferencing systems.

4.6. FADING:
4.6.1. Introduction:

Fading is the most important cause of distortion that detracts


from the enjoyment program material transmitted on short wave. Fading occurs
on strong signals and weak signals. Increasing the transmitter power does little to
improve the distortion caused by fading. An analysis of the different causes of
fading is presented along with some ideas on measures broadcasters and listeners
can take to reduce the effects of fading .

4.6.2. Reasons for occurrence of fading:

There are two primary causes of signal fading on short wave


multipath cancellation and polarization rotation. Each type of fading results from
different mechanisms and each has its own remedies. These effects can be
minimized by appropriate design of transmitting antennas, receiving antennas,
receiving techniques, and redundancy in the receiver configuration.

Multipath propagation results in the signal being received by the


listener over two or more paths. A typical diagram is shown in figure.

Figure 4.17: Multi path propagation.

Multipath propagation causes fading when waves arrive out of


phase. In the figure one path consists of a single, low angle hop from the
transmitter to the receiver. The other path consists of two hops at a higher angle.
The two hop path is physically longer than the single hop path. When the two
waves combine at the receiver they can be in phase. In this case the waves act to
reinforce one another making the received signal stronger. Because the delay
difference is a function of the path length difference., the waves can just as easily
arrive out of phasing causing cancellation or what we normally call fading.

Wave length is inversely proportional to frequency. The


bandwidth of an AM transmission is normally about 10 kHz. Side bands extend
above or below the carrier frequency by 5 kHz or more. Wave arriving via
multiple paths can cancel at one frequency but not at another. This effect is
called” selective fading”. Selective fading can result in the carrier fading while
the sidebands remain strong. The result is severe distortion similar to over
modulation. Selective fading can also result in one side band fading while the
other remains strong. Distortion also results from this condition.

Fading-out applies a linear fade-out to the selected audio. For a


logarithmic fade, we use the envelope tool.

4.6.3. Fade-in & Fade-out effects:

From the above explanation of occurrence of fading the wave


arriving via multiple paths can cancel at one frequency but not at another, if that
frequency is below original frequency, the effect is called fade-in effect and if that
is above called fade-out effect. The direction of change in signal magnitude in
dB/period is dependent on whether a fade-in or fade-out currently in progress.
5. INTRODUCTION TO D.S.P.

 5.1. What is DSP?

Digital Signal Processing (DSP) is used in a wide variety of


applications, and it is hard to find a good definition that is general.
We can start by dictionary definitions of the words.

 Digital:
Operating by the use of discrete signals to represent data in the form of numbers

 Signal:
A variable parameter by which information is conveyed through an electronic
circuit

 Processing:
To perform operations on data according to programmed instructions
Which leads us to a simple definition of?

 Digital Signal processing:


Changing or analyzing information which is measured as
discrete sequences of numbers Note two unique features of Digital Signal
processing as opposed to plain old ordinary digital processing. Signals come from
the real world - this intimate connection with the real world leads to many unique
needs such as the need to react in real time and a need to measure signals and
convert them to digital numbers.
Signals are discrete - which means the information in between discrete samples
is lost.
The advantages of DSP are common to many digital systems and include:
 Versatility:
Digital systems can be reprogrammed for other applications (at least where
programmable DSP chips are used).
Digital systems can be ported to different hardware (for example a different
DSP chip or board level product).

 Repeatability:
Digital systems can be easily duplicated.
Digital systems do not depend on strict component tolerances.
Digital system responses do not drift with temperature.

 Simplicity:
Some things can be done more easily digitally than with analogue systems
DSP is used in a very wide variety of applications.
But most share some common features:

They use a lot of moths (multiplying and adding signals)


They deal with signals that come from the real world
They require a response in a certain time
Where general purpose DSP processors are concerned, most applications deal
with signal frequencies that are in the audio range.

 5.2. ANTIALIASING:

Nyquist showed that to distinguish unambiguously between all


signal frequency components we must sample at least twice the frequency of the
highest frequency component. To avoid aliasing, we simply filter out all the high
frequency components before sampling.

Note that antialias filters must be analogue - it is too late once


you have done the sampling.
This simple brute force method avoids the problem of aliasing.
But it does remove information - if the signal had high frequency components, we
cannot now know anything about them.
Although Nyquist showed that provide we sample at least twice
the highest signal frequency we have all the information needed to reconstruct the
signal, the sampling theorem does not say the samples will look like the signal.

The diagram shows a high frequency sine wave that is


nevertheless sampled fast enough according to Nyquist's sampling theorem - just
more than twice per cycle. When straight lines are drawn between the samples,
the signal's frequency is indeed evident - but it looks as though the signal is
amplitude modulated. This effect arises because each sample is taken at a slightly
earlier part of the cycle. Unlike aliasing, the effect does not change the apparent
signal frequency. The answer lies in the fact that the sampling theorem says there
is enough information to reconstruct the signal - and the correct reconstruction is
not just to draw straight lines between samples.
The signal is properly reconstructed from the samples by low pass filtering: the
low pass filter should be the same as the original antialias filter.
The reconstruction filter interpolates between the samples to
make a smoothly varying analogue signal. In the example, the reconstruction
filter interpolates between samples in a 'peaky' way that seems at first sight to be
strange. The explanation lies in the shape of the reconstruction filter's impulse
response.

The impulse response of the reconstruction filter has a classic


'sin(x)/x shape. The stimulus fed to this filter is the series of discrete impulses
which are the samples. Every time an impulse hits the filter, we get 'ringing' - and
it is the superposition of all these peaky rings that reconstructs the proper signal.
If the signal contains frequency components that are close to the Nyquist, then the
reconstruction filter has to be very sharp indeed. This means it will have a very
long impulse response - and so the long 'memory' needed to fill in the signal even
in region of the low amplitude samples.

 5.3. CONVERTING ANALOGUE SIGNALS:

Most DSP applications deal with analogue signals.


The analogue signal has to be converted to digital form
The analogue signal - a continuous variable defined with infinite precision - is
converted to a discrete sequence of measured values which are represented
digitally.
Information is lost in converting from analogue to digital, due to:
Inaccuracies in the measurement.
Uncertainty in timing.
Limits on the duration of the measurement.
These effects are called quantization errors.

The continuous analogue signal has to be held before it can be sampled.


Otherwise, the signal would be changing during the measurement.

Only after it has been held can the signal be measured, and the measurement
converted to a digital value
The sampling results in a discrete set of digital numbers that
represent measurements of the signal - usually taken at equal intervals of time.
Note that the sampling takes place after the hold. This means that we can
sometimes use a slower Analogue to Digital Converter (ADC) than might seem
required at first sight. The hold circuit must act fast - fast enough that the signal is
not changing during the time the circuit is acquiring the signal value - but the
ADC has all the time that the signal is held to make its conversion.

We don't know what we don't measure. In the process of


measuring the signal, some information is lost. Sometimes we may have some a
priori knowledge of the signal, or be able to make some assumptions that will let
us reconstruct the lost information.

 5.4. FREQUENCY RESOLUTION:


We only sample the signal for a certain time.
We cannot see slow changes in the signal if we don't wait long enough.
In fact we must sample for long enough to detect not only low frequencies in the
signal, but also small differences between frequencies. The length of time for
which we are prepared to sample the signal determines our ability to resolve
adjacent frequencies - the frequency resolution.
We must sample for at least one complete cycle of the lowest frequency we want
to resolve.

We can see that we face a forced compromise. We must sample


fast to avoid and for a long time to achieve a good frequency resolution. But
sampling fast for a long time means we will have a lot of samples - and lots of
samples means lots of computation, for which we generally don't have time. So
we will have to compromise between resolving frequency components of the
signal, and being able to see high frequencies.

 5.5. QUANTIZATION:

When the signal is converted to digital form, the precision is


limited by the number of bits available.
The diagram shows an analogue signal which is then converted to a digital
representation - in this case, with 8 bit precision.
The smoothly varying analogue signal can only be represented as a 'stepped'
waveform due to the limited precision.

Sadly, the errors introduced by digitization are both non linear and signal
dependent.
Non linear means we cannot calculate their effects using normal math’s.
Signal dependent means the errors are coherent and so cannot be reduced by
simple means.
This is a common problem in DSP. The errors due to limited
precision (i.e. word length) are non linear (hence incalculable) and signal
dependent (hence coherent). Both are bad news, and mean that we cannot really
calculate how a DSP algorithm will perform in limited precision - the only
reliable way is to implement it, and test it against signals of the type expected.
The non linearity can also lead to instability - particularly with IIR filters.

The word length of hardware used for DSP processing determines the available
precision and dynamic range.
Uncertainty in the clock timing leads to errors in the sampled signal.
The diagram shows an analogue signal which is held on the rising edge of a clock
signal. If the clock edge occurs at a different time than expected, the signal will be
held at the wrong value. Sadly, the errors introduced by timing error are both non
linear and signal dependent.
A real DSP system suffers from three sources of error due to limited word length
in the measurement and processing of the signal:
Limited precision due to word length when the analogue signal is converted to
digital form.
Errors in arithmetic due to limited precision within the processor itself
Limited precision due to word length when the digital samples are converted
back to analogue form.
These errors are often called 'quantization error'. The effects of
quantization error are in fact both non linear and signal dependent. Non linear
means we cannot calculate their effects using normal moths. Signal dependent
means that even if we could calculate their effect, we would have to do so
separately for every type of signal we expect. A simple way to get an idea of the
effects of limited word length is to model each of the sources of quantization error
as if it were a source of random noise.

The model of quantization as injections of random noise is helpful in gaining an


idea of the effects. But it is not actually accurate, especially for systems with
feedback like IIR filters.
The effect of quantization error is often similar to an injection of random noise.
The diagram shows the spectrum calculated from a pure tone.
The top plot shows the spectrum with high precision (double precision floating
point).
The bottom plot shows the spectrum when the sine wave is quantized to 16 bits.
The effect looks very like low level random noise. The signal to noise ratio is
affected by the number of bits in the data format, and by whether the data is fixed
point or floating point.

 5.6. FILTERING:

 10.6.1. Digital filter equation:


Output from a digital filter is made up from previous inputs and previous outputs,
using the operation of convolution:

Two convolutions are involved: one with the previous inputs, and
one with the previous outputs. In each case the convolving function is called the
filter coefficients.
The filter can be drawn as a block diagram:
Two convolutions are involved: one with the previous inputs, and
one with the previous outputs. In each case the convolving function is called the
filter coefficients.
The filter can be drawn as a block diagram:
The filter diagram can show what hardware elements will be required when
implementing the filter:
The left hand side of the diagram shows the direct path, involving previous
inputs: the right hand side shows the feedback path, operating upon previous
outputs.

5.7. DIGITAL REPRESENTATION OF AUDIO EFFECTS

5.7.1. Echo:

y (n)=x (n) + a* x (n-N). Where a=attenuation constant, N=delay.

5.7.2. Multiple echoes:

y (n)=x (n) + a * x (n-N) + a^2 * x (n-2N) + ---------

5.7.3. Reverberation:

y (n)=x (n) + x (n) + α * ( x (n) – x (n-N ))

H (Z) = (alpha + Z-R) / (1 + alpha * Z-R)

α= Reverberation coefficient.
5.7. 4. Flanging:

y (n) =x (n) + g*x [n-M (n)]


x (n) = I/P signal amplitude at time n=0, 1, 2…
y (n) = O/P at time n and g=depth of the flanging effect
M (n) =the length of the delay-time at time n.

6. INTRODUCTION TO MATLAB

 6.1. WHAT IS MATLAB?

Matlab is a commercial "Matrix Laboratory" package which operates as an


interactive programming environment.
Matlab is available for PC's, Macintosh and UNIX systems.
Matlab is well adapted to numerical experiments.
Matlab program and script files (m-files) always have filenames ending with
".m";
The programming language is exceptionally straightforward since almost
every data object is assumed to be an array.
Graphical output (figure) is available to supplement numerical results.
Online help is available from the Matlab prompt (a double arrow) by typing help.

 6.2. HOW TO START AND QUIT MATLAB?

PC - a double click on the Matlab icon


UNIX system - setup Matlab (return) Matlab
On both system leave a Matlab session by typing: Quit
Or by typing: Exit
at the Matlab prompt.

 6.3. USING HELP IN MATLAB:

Online help is available from the Matlab prompt (>> a double arrow),both
generally (listing of all available commands):

>> help
[A long list of help topics follows]

And for specific commands:

>> help fft

[A help message on the fft function follows].

 6.4. MATRIX, VECTOR AND SCALAR:

• Three fundamental concepts in MATLAB, and in linear algebra, are scalars,


vectors and matrices.
• A scalar is simply just a fancy word for a number (a single value).
• A vector is an ordered list of numbers (one-dimensional). In MATLAB they can
be represented as a row-vector or a column-vector.
• A matrix is a rectangular array of numbers (multi-dimensional). In MATLAB, a
two-dimensional matrix is defined by its number of rows and columns.

Matlab uses variables that are defined to be matrices.


A matrix is a collection of numerical values that are organized
into a specific
configuration of rows and columns. The number of rows and columns can be any
number.

A= [ 1 2 3 4
5 6 7 8];

A is for example, 2 rows and 4 columns define a 2 x 4 matrix which has 8


elements
in total.
A scalar is represented by a 1 x 1 matrix in Matlab: a=1;

A vector of n elements can be represented by a n x 1 matrix, in


which case it is called a column vector, or a vector can be represented by a 1 x n
matrix, in which case it is called a row vector of n elements.

x = [3.5, 33.22, 24.5]; x is a row vector or 1 x 3 matrix

x1=[2 x1 is column vector or 4 x 1 matrix


5
3
-1];
The matrix name can be any group of letters and numbers up to 19, but always
beginning with a letter.
Matlab is "case sensitive", that is, it treats the name 'C' and 'c' as two different
variables.
Similarly, 'MID' and 'Mid' are treated as two different variables.

 6.5. SOME BASIC COMMANDS :


pwd prints working directory
demo demonstrates what is possible in Matlab
who lists all of the variables in your Matlab workspace
whos list the variables and describes their matrix size
clear erases variables and functions from memory
clear x erases the matrix 'x' from your workspace
close by itself, closes the current figure window
figure creates an empty figure window
hold on holds the current plot and all axis properties so that subsequent graphing
commands add to the existing graph
hold off sets the next plot property of the current axes to "replace"
find find indices of nonzero elements e.g.:
d = find(x>100) returns the indices of the vector x that are greater than
100
break terminate execution of m-file or WHILE or FOR loop
for repeat statements a specific number of times, the general form of a FOR
statement is:
FOR variable = expr, statement, ..., statement END
for n=1:cc/c;
magn(n,1)=NaNmean(a((n-1)*c+1:n*c,1));
end
diff difference and approximate derivative e.g.:
DIFF(X) for a vector X, is [X(2)-X(1) X(3)-X(2) ... X(n)-X(n-1)].
NaN the arithmetic representation for Not-a-Number, a NaN is obtained as a
result of mathematically undefined operations like 0.0/0.0
INF the arithmetic representation for positive infinity, a infinity is also
produced
by operations like dividing by zero, e.g. 1.0/0.0, or from overflow, e.g.
exp(1000).
save saves all the matrices defined in the current session into the file,
matlab.mat, located in the current working directory
load loads contents of matlab.mat into current workspace
save filename x y z saves the matrices x, y and z into the file titled
filename.mat
save filename x y z /ascii save the matrices x, y and z into the file titled
filename.dat
load filename loads the contents of filename into current workspace;
the file can
be a binary (.mat) file
load filename.dat loads the contents of filename.dat into the variable
filename
xlabel(‘ ’) : Allows you to label x-axis
ylabel(‘ ‘) : Allows you to label y-axis
title(‘ ‘) : Allows you to give title for
plot
subplot() : Allows you to create multiple
plots in the same window

 6.6. SOME BASIC PLOT COMMANDS :

Kinds of plots:
plot(x,y) creates a Cartesian plot of the vectors x & y
plot(y) creates a plot of y vs. the numerical values of the elements in the y-
vector
semilogx(x,y) plots log(x) vs y
semilogy(x,y) plots x vs log(y)
loglog(x,y) plots log(x) vs log(y)
polar(theta,r) creates a polar plot of the vectors r & theta where theta is in radians
bar(x) creates a bar graph of the vector x. (Note also the command
stairs(x))
bar(x,y) creates a bar-graph of the elements of the vector y, locating the bars
according to the vector elements of 'x'
Plot description:
grid creates a grid on the graphics plot
title('text') places a title at top of graphics plot
xlabel('text') writes 'text' beneath the x-axis of a plot
ylabel('text') writes 'text' beside the y-axis of a plot
text(x,y,'text') writes 'text' at the location (x,y)
text(x,y,'text','sc') writes 'text' at point x,y assuming lower left corner is (0,0)
and upper right corner is (1,1)
axis([xmin xmax ymin ymax]) sets scaling for the x- and y-axes on the current
plot

 6.7. ALGEBRIC OPERATIONS IN MATLAB:

Scalar Calculations:
+ Addition
- Subtraction
* Multiplication
/ Right division (a/b means a ÷ b)
\ left division (a\b means b ÷ a)
^ Exponentiation
For example 3*4 executed in 'matlab' gives ans=12
4/5 gives ans=0.8

Array products: Recall that addition and subtraction of matrices


involved addition or subtraction of the individual elements of the matrices.
Sometimes it is desired to simply multiply or divide each element of an matrix by
the corresponding element of another matrix 'array operations”.
Array or element-by-element operations are executed when the operator is
preceded by a '.' (Period):
a .* b multiplies each element of a by the respective element of b
a ./ b divides each element of a by the respective element of b
a .\ b divides each element of b by the respective element of a
a .^ b raise each element of a by the respective b element

 6.8.READING AND WRITING SOUND FILES IN MATLAB:

WAVREAD Read Microsoft WAVE (".wav") sound file. Y=WAVREAD(FILE)


reads a WAVE file specified by the string FILE, returning the sampled data in Y.
The ".wav" extension is appended
If no extension is given. Amplitude values are in the range [-1,+1].
[Y,FS,NBITS]=WAVREAD(FILE) returns the sample rate (FS) in Hertz
And the number of bits per sample (NBITS) used to encode the data in the file.
[...]=WAVREAD(FILE,N) returns only the first N samples from each channel in
the file.
[...]=WAVREAD(FILE,[N1 N2]) returns only samples N1 through N2 from each
channel in the file.
SIZ=WAVREAD(FILE,'size') returns the size of the audio data contained in the
file in place of the actual audio data, returning the vector SIZ=[samples channels].
[Y,FS,NBITS,OPTS]=WAVREAD(...) returns a structure OPTS of additional
information contained in the WAV file. The content of this structure differs from
file to file. Typical structure fields include '.fmt' (audio format information) and
'.info' (text which may describe subject title, copy right, etc.). Supports multi-
channel data, with up to 16 bits per sample.

WAVWRITE Write Microsoft WAVE (".wav") sound file.


WAVWRITE(Y,FS,NBITS,WAVEFILE) writes data Y to a Windows WAVE file
specified by the file name WAVEFILE, with a sample rate of FS Hz and with
NBITS number of bits. NBITS must be 8 or 16.
Stereo data should be specified as a matrix with two columns.
Amplitude values outside the range [-1,+1] are clipped.
WAVWRITE(Y,FS,WAVEFILE) assumes NBITS=16 bits.
WAVWRITE(Y,WAVEFILE) assumes NBITS=16 bits and FS=8000 Hz.

 6.9. WHY USE MATLAB:

• Advantages:
Handles vector and matrices very nice
Quick plotting and analysis
EXTENSIVE documentation (type ‘help’)
Lots of nice functions: FFT, fuzzy logic, neural nets, numerical integration,
OpenGL
• Drawbacks:
Slow compared to C or Java

7. FLOW CHARTS

7.1. FLOW CHART FOR ECHO EFFECT OF A SIGNAL:


7.2. FLOW CHART FOR MULTIPLE ECHOES EFFECT OF A
SIGNAL:
7.3. FLOW CHART FOR REVERBERATION EFFECT OF A
SIGNAL:
7.4. FLOW CHART FOR FLANGING EFFECT OF A SIGNAL:
7.5. FLOW CHART FOR PITCH SHIFTING UP EFFECT OF A
SIGNAL:
7.6. FLOW CHART FOR PITCH SHIFTING DOWN EFFECT
OF A SIGNAL:
7.7. FLOW CHART EQUALIZER:
7.8. FLOW CHART FOR FADING IN EFFECT OF A SIGNAL:
7.9. FLOW CHART FOR
FADING OUT EFFECT OF A SIGNAL:
8. WAVEFORMS AND RESULTS
GENERAL PROCEDURE:

8.1. ECHO:
Echo device:
Waveforms:
8.2. MULTIPLE ECHOES:

Multiple echo device:

Waveforms:
8.3. REVERBERATION:
Reverberation device:

Waveforms:
8.4. FLANGING:

Flanging device:

Waveforms:
8.5. PITCH SHIFT UP:

Waveforms:
8.6. PITCH SHIFT DOWN:

Waveforms:
8.7. EQUALIZER:
Equalizer:

ORIGINAL SIGNAL
LOWPASS FILTERED OUTPUT

BAND PASS FILTERED OUTPUT


HIGH PASS FILTERED OUTPUT

RECONSTRUCTED SIGNAL
8.8. FADING-IN:

Waveforms:
8.9. FADING-OUT:

Waveforms:
APPLICATIONS OF AUDIO EFFECTS

1. Calculation of sea depths.


2. Accident avoidance of submarines, boats etc.
3. Sound effects in electric guitar.
4. Creating various sound effects with electric musical instruments.
5. Text recognition.
6. Speech enhancement.
7. Speech recognition.
8. In RADAR systems.
9. In SONAR systems.
10. In creating robotic sounds etc.
-
CONCLUSION

Music signal processing includes a wide variety of effects


and filtering techniques. Many of the algorithms discussed can be
implemented quite easily with a few lines of MATLAB code. The effects
covered above have been around for quite some time but can still be heard in
many of the bands we listen to today. In the past the effects were implemented
with analog technology, or in some cases two tape reels spinning at different
speeds. Today, however, almost all musical signal processing effects are done
digitally allowing for a wider variety of manipulation. We are able to see that
in the past few years, how sound quality has improved tremendously. This
will be greatly useful wherever sound transmission or its processing is done.

The developed generalized programs are applicable to above


mentioned currently improving audio field applications. That is the programs
are capable to convert audio into waveform and apply different delays, then
modify as desired. And if the resulted signal is beyond the characteristics of
audio signal then the equalization, fading effects will be applied to bring into
audio signal characteristics. And for pitch shifting effects the program will
provide clear pitch variations & capable to create any type of pitch by varying
delay as well as frequency.

Finally, we conclude that the developed programs satisfy all


the requirements of effects of audio signals in order to introduce those in
currently developing audio fields.
BIBLIOGRAPHY

1.”Physical audio signal processing”, by Julius O. Smith III, (December 2005


DRAFT)
2. Center for computer research in Music & Acoustics, Stanford University.
3. Wikipedia founder Jimmy Wales's papers.
4. Understanding digital signal processing, R. G. Lyons, Addison-Wesley
Publishing, 1996.
5. The scientist and engineer’s guide to digital signal processing, S. W. Smith.
6. Discrete-time signal processing, A. V. Oppeheim & R. W. Schafer, Prentice
Hall, 1999.
7. On bandwidth, David Slepian, IEEE Proceedings, Vol. 64, No 3, pp 291 -
300.
8. Getting started with Mat lab by Rudhra prathap. Oxford University press
2003.
9. Introduction to Mat lab (Michigan tech department of electronic &
computer engineering)
10. Website: www.hormony-centrol.com

You might also like