You are on page 1of 44

Audio Equalizer Project

Senior Design II
Final Report

Cody Butler
Mike Fergades
David Fritz
Hirotaka Maezawa
Fall 2006

Automated Digital Audio Equalizer

Abstract
Speaker design, speaker placement, room interactions, and many other elements in the
Source/Speaker/Listener path interfere with the frequency response of the system from
the listeners reference position. This project corrects, to a reasonable tolerance, these
interactions, providing a flatline frequency response, for a given reference point. The
system acts as a digital audio equalizer within the tape monitor loop of a receiver. By
using a microphone connected to the equalizer situated at the listeners position, the
system generates test tones to characterize the room, speakers, and other elements in the
system that interfere with the frequency response. The system then creates a filter based
on this response, to normalize the frequency response of the system, and then applies the
filter in real time to an incoming audio stream. The effect is a more accurate sounding
audio system regardless of speaker type, room interactions, and listener position.

-2-

Automated Digital Audio Equalizer

Table of Contents
Abstract ............................................................................................................................... 2
Table of Contents................................................................................................................ 3
1. Introduction..................................................................................................................... 4
2. Filter Design.................................................................................................................... 6
2.1 Initial Considerations ................................................................................................ 6
2.2 Filter Specifications .................................................................................................. 7
2.3 Filter Creation ......................................................................................................... 10
2.4 Filter Application .................................................................................................... 12
3. Implementation ............................................................................................................. 15
3.1 Implementation Overview ...................................................................................... 15
3.2 Hardware Overview ................................................................................................ 15
3.3 Filter Implementation.............................................................................................. 17
3.3.1 Interrupt Service Routine..................................................................................... 18
3.3.2 Main Path of Execution ....................................................................................... 20
3.4 User Interface Implementation ............................................................................... 23
4. Psychoacoustics Test .................................................................................................... 27
5. Results and Conclusions ............................................................................................... 30
5.1 Filter Results ........................................................................................................... 30
5.2 Filter Conclusions ................................................................................................... 34
5.3 Psychoacoustics Results.......................................................................................... 34
6. System Limitations ....................................................................................................... 36
6.1 Limitations Overview ............................................................................................. 36
6.2 Communication Speed Between The DSP Board and PC ...................................... 36
6.3 Calibration............................................................................................................... 36
6.4 Speaker type............................................................................................................ 37
7. Considerations and Tradeoffs ....................................................................................... 38
7.1 Considerations and Tradeoffs Overview ................................................................ 38
7.2 Frequency Resolution ............................................................................................. 38
7.2.1 Increase DSP Speed / Increase Memory.............................................................. 38
7.2.2 Analog bypass filter ............................................................................................. 39
8. Future Work .................................................................................................................. 40
8.1 Filter Improvements................................................................................................ 40
8.1.1 Live Feedback...................................................................................................... 40
8.1.2 Analog Bypass ..................................................................................................... 40
8.2 Psychoacoustics Tests Improvements..................................................................... 41
9. Acknowledgements....................................................................................................... 42
10. References................................................................................................................... 43
11. Appendix A................................................................................................................. 44
Specifications................................................................................................................ 44

-3-

Automated Digital Audio Equalizer

1. Introduction
Audio played on loudspeakers is affected both by the loudspeakers themselves, and the
environment it is played in. By changing the environment, the listeners position, or the
speakers themselves, the frequency response of the system is changed. This concept leads
to the study of acoustic room correction.

Prior to the 1950s, it was common practice to simply ignore a rooms acoustic properties
[1]. In the late 1960s, room correction methods began to develop and large filters were
often custom designed for large halls to compensate for their acoustic properties.

Today, many high-end home entertainment systems provide room correction


technologies. These systems however, are expensive and reserved primarily for extreme
audio enthusiasts and professional audio technicians.

This project aims to develop a digital signal processor based, automatic audio equalizer
that compensates for speaker and room aberrations present in any environment. This is
accomplished by means of producing a set of test tones, generated by the system, which
are recorded by a microphone placed at the listeners position. The recorded tones are
characterized to obtain a room and speaker response, and used to create a filter that when
applied to an audio stream, produces a normalized frequency response.

-4-

Automated Digital Audio Equalizer


To extend this work, a brief study of psychoacoustics is given. Psychoacoustics is simply
the study of how people perceive sound, and is used in this project to identify what type
of frequency response sounds best. A small test was administered to several subjects of
varying age, each of which were allowed to sample audio under different filter
configurations.

Section 2 provides a discussion of the filter algorithm, its design and a comparison of
other possible filter choices. Section 3 discusses the implementation of the system.
Section 4 discusses the psychoacoustic tests. Section 5 details the conclusions and results
from the normalized frequency response filter and its implementation, and the
psychoacoustic tests. Further sections provide concluding remarks, references, and
necessary appendices.

-5-

Automated Digital Audio Equalizer

2. Filter Design
2.1 Initial Considerations
On designing the filter algorithm for this project, several key considerations were noted.
The filter algorithm would have to be optimized for audio applications and for the
hardware we used for testing. Specifically, CD quality audio would be a minimum
requirement, as well as the filter working over the entire range of human hearing. An
immediate limitation of the test equipment having a frequency response no lower than
30Hz limited the filter operating range to that of 30Hz to 22050Hz.

After a literature search, the Audio Team concluded that the use of a finite impulse
response filter (FIR) would best serve the application presented. The benefits of using an
FIR filter over an infinite impulse response (IIR) filter are numerous and detailed in
Table 1.
Finite Impulse Response
Strengths
Weaknesses
Easy to implement Computationally
more expensive
Stable
Uses more memory
Linear Phase
Simple filter
creation

Infinite Impulse Response


Strengths
Weaknesses
Computationally
Difficult to
less expensive
implement
Uses little memory Unstable
Non-linear phase
(usually)
Difficult to obtain
filter coefficients

Table 1. Strengths and weaknesses of FIR and IIR filters

-6-

Automated Digital Audio Equalizer

2.2 Filter Specifications


Following the decision to implement an FIR filter, several hard specifications were
chosen and derived and are shown in Table 2 and again in Appendix A. A discussion of
each specification is given.
Filter Specifications
Frequency Resolution
Amplitude Resolution1
Sample Rate
Filter Type
Phase
Total Delay
Number of Filters
Correction Range
Smoothing Bandwidth
Filter Length

10.7
Hz/bin
dB
1
44.1
kHz (CD Quality)
Finite Impulse Response
Linear (Constant Delay)
200
ms MAX
2
left and right channel
dB (per band)
12
Variable
<200Hz: 100Hz
>200Hz: 1/3rd Octave
4096
Taps
Table 2. Filter specific specifications

Note that in Table 2, a 10.7Hz/bin frequency resolution is given. This comes from the
choice to use a 44.1 kHz sample rate with a 4096 point FFT algorithm. During the course
of this project, several people questioned whether this granularity would be sufficient for
the design. After research, it was found to be sufficient due to the critical band masking
effect that occurs in human hearing.

Backus [2] describes the critical bands as bandwidths over which two tones listened to
within the critical band are indistinguishable in loudness. This is due to physiological
processes in the human auditory system and the critical band is generally accepted to be
approximately 1/3rd of an octave. This bandwidth is on an octave scale since human
hearing is logarithmic. Since 1/3rd of an octave above our filter base frequency of 30Hz is
1

Precision at which amplitude of frequency components in each bin can be adjusted. The nominal value of
1dB is a worst case condition.

-7-

Automated Digital Audio Equalizer


40Hz, and noting that our test equipment barely performs near 30Hz, and that our filter
only affects the intensity (and in the case of audio, loudness) of the input signal, it can be
concluded that a 10.7Hz resolution is sufficient.

Evidence of this results from a test performed on several students and faculty by playing
unfiltered audio vs. filtered audio (with the filter being an allpass filter). The subjects
were asked to identify differences (if any) they could distinguish between the two signals.
Even when told which stream they were listening to, not one subject could identify a
difference between the signals. This further concludes that signal reconstruction is
possible with the given frequency resolution.

Linear phase is achieved simply by setting the phase component of our filter to a constant
(in our case 0).

The delay specification is derived from the filter length and sample rate. The time to
buffer 4096 samples at 44.1 kHz is ~93ms. With a full buffer being required to filter, as
described later, twice the amount of time is required to buffer, filter, and play audio,
bringing the total delay to 186ms. The delay maximum was rounded to the nearest 100.
Tests were performed on several students and faculty members to test if the 186ms delay
was noticeable when using controls on a CD player. No subjects were able to distinguish
a delay difference.

-8-

Automated Digital Audio Equalizer


Two filters exist for each of the two channels in stereo audio. They are independently
calibrated as discussed later.

A correction range of 12db is given for practical reasons. If a signal were boosted
beyond the limits of the audio codec, distortion would occur due to clipping at the codec
output. For this reason the input signal is pushed down 12db upon buffering, and then
adjusted according to the filter coefficients. This way, no input signal can be boosted
beyond the normal maximum output level.

1/3rd octave smoothing is implemented during filter creation, as discussed in section 2.3,
to prevent correcting for spikes in the recorded signal generated due to noise or other
aberrations.

Finally, a 4096 tap filter was chosen due to limitations in resources on the DSP board and
to maintain the realtime constraint as given in the problem statement. The FFT
algorithm employed in this design is a radix-4, decimation in frequency, complex Fast
Fourier Transform. Due to the radix, only filter lengths of powers of 4 can be used. The
next power of four above 4096 is 16384, causing the DSP board to run out of several
resources (CPU time and memory), and creates an unnatural delay of almost 750ms. This
is easily detected by the user and is considered not to be realtime.

-9-

Automated Digital Audio Equalizer

2.3 Filter Creation


The filter is created by generating and recording a series of test tones. These tones are
affected by the room and speaker interactions, and listener position, recorded by a
microphone and stored into a buffer. The test tone is simply a logarithmic sweep from
30Hz to 22050 kHz. An alternative method for characterizing the room response is to
generate an impulse response. This idea was immediately discarded due to two reasons:
An impulse would be difficult to generate on speakers, and characterization of the rooms
transfer function by impulse response works only in a linear time invariant system.

Following signal generation and recording, an FFT is performed on the entire buffer and
normalized by dividing it by the known reference signal. This can also be considered as
the impulse response of the system. This normalized signal represents the rooms transfer
function. In order to receive a flatline frequency response, the filter must nullify this
transfer function. Simply finding the reciprocal of the transfer function satisfies this
requirement such that H ( j )

1
= 1 for all .
H ( j )

As shown in Figure 1, the amplitude of the normalized response of the system is very
noisy. This is possibly due in part to room reverberation. As the sweep is played, low
frequency components reflect and interfere with higher frequency components that are
currently being recorded. This can interfere with the amplitude response. In order to
compensate for this effect, a 1/3rd octave block moving average smoothing filter is
applied to the filter at this point, also shown in Figure 1.

- 10 -

Automated Digital Audio Equalizer

Unsmoothed Response

Gain (dB)

50

-50
0
10

10

10
10
Frequency (Hz)
Smoothed Response

10

10

60

Gain (dB)

40
20
0
-20
-40
0
10

10

10
10
Frequency (Hz)

10

10

Figure 1. Unsmoothed and smoothed amplitude response of a filter. Note the amount of noise in the
unsmoothed response.

After smoothing, the filter is clipped at 12dB and stored into a filter array for
application.

The entire process is completed twice, once for the left channel, and again for the right.
During calibration, the left or right channel is automatically disabled to prevent
interference to the other.

Figure 2 illustrates this process.

- 11 -

Automated Digital Audio Equalizer

Generate
Calibration
Audio

Record
Calibration
Audio

Fast Fourier Transform

Normalize

Find Reciprocal

Clip at 12db

Figure 2. The steps of filter calibration/creation.

2.4 Filter Application


After calibration has taken place, the filter is ready to be applied in real time to an
incoming signal from the audio system source. The filter is applied by simply convolving
it with the signal and then playing the result to the connected receiver. Time-domain
convolution is accomplished via frequency-domain multiplication to filter the signal. The
reason convolution is accomplished this way is that after the filter grows to
approximately 30 taps or longer, it becomes computationally less expensive to perform
frequency-domain multiplication over time-domain convolution [3].

- 12 -

Automated Digital Audio Equalizer


Additionally, since the signal being worked on is treated as having infinite length, it must
be broken into blocks, convolved with the filter, and then reassembled for playback. In
this design, the block length is 4096 samples. This however, can introduce artifacts
between blocks due to the endpoints of the blocks not matching as shown in Figure 3.
This effect can result in a popping sound or high frequency buzz during audio playback.
In order to overcome this problem, a simple overlap-and-add method is used during
filtering. The overlap-and-add method works such that blocks overlap by a certain length,
determined by the window
Result of Block Filtering Without Overlap and Add
1

function used, filtered in the

0.5
0

usual manner, and

-0.5
-1

reassembled by adding the

100

200

300

400

500
Time

600

700

800

900

1000

100

200

300

400

500
Time

600

700

800

900

1000

1
0.5

overlapping sections of each

0
-0.5
-1

block. This design uses a


Hanning window, which

Figure 3 Result of filtering without overlap-and-add.


Note the spikes at each block edge (block edge here is 250 points)

provides a 50% overlap, as shown in Figure 4. By implementing this method, endpoint


artifacts are attenuated to 0 while still preserving 100% of the power in the original signal
[4].

Figure 4 Hanning window and overlap-and-add.


Note the 50% overlapping sections.

- 13 -

Automated Digital Audio Equalizer


In order to process an audio stream, the system does the following, which is also
illustrated in Figure 5.
1. Buffer 4096 samples.
2. Apply the Hanning window.
3. FFT the buffer.
4. Multiply the signal spectra with that of the filter.
5. IFFT the filtered data.
6. Sum the overlapping section of this and the previous buffer that was worked on.
7. Store the current buffer to be summed with the overlapping section from the next
buffer.
8. Play the summed section out to the receiver.
This entire process is performed twice every 93ms - once for each channel in the stereo
audio stream.

Filter Array

Buffer

FFT

IFFT

Figure 5. Process of applying filter to the audio stream.

- 14 -

Automated Digital Audio Equalizer

3. Implementation
3.1 Implementation Overview
The Digital Audio Equalizer required two major components to be implemented A
filter implementation containing filter calibration, application, and control software
running on a Digital Signal Processor, and a graphical user interface running on a host PC
for interfacing to the DSP. Initially, the DSP implementation was intended to run
autonomously without any user intervention whatsoever. However, as features were
added to the design it became apparent that a user interface would be required.

3.2 Hardware Overview


Two hardware components are used in this system. A commercial DSP development
board obtained from Texas Instruments is used to implement the filter software. The
commercial board was chosen over in-house manufacturing for two reasons Digital
Signal Processors that are capable of supporting this application typically are
manufactured in Ball Grid Array or other dense packages. These components cannot be
manufactured in-house and must be purchased as commercially manufactured
development boards. Also, development software for digital signal processors is
prohibitively expensive ($1000 or more) when purchased as standalone software. A
limited student development environment was bundled with the development board
which kept the cost of implementation within the budget. The board purchased was a TI
DSK6713 development board. This board is optimized for audio engineering applications

- 15 -

Automated Digital Audio Equalizer


and comes complete with audio codec, Microphone, Line In, and Line Out ports, USB
interface, software development tools, and other necessary hardware. Table 3 contains
some important specifications about the DSP.
Digital Signal Processor Key Specifications:

225MHz

192kb SRAM

8 Instructions / cycle

1800 MIPS / 1350 MFLOPS

Optimized for audio

Table 3. Key DSP specifications.

A measurements microphone was also purchased to be used during calibration. Since no


practical or affordable means of characterizing the response of the microphone was
possible, the highest quality microphone that the team could afford was acquired. Ideally,
the microphone should have a constant flat frequency response over the range of human
hearing, although no such affordable device was available. A Behringer ECM8000
Measurements Microphone was purchased, and the manufacturer supplied response is
given in Figure 6.

- 16 -

Automated Digital Audio Equalizer

Figure 6 The Behringer ECM8000 frequency response. Note that over the range of human hearing, the
response does not deviate from the flatline by more than 3db.

A final list of specifications for the device is located in Appendix A.

3.3 Filter Implementation


The filter calibration, application, and control software runs entirely on the set-top Digital
Signal Processor board for two major reasons: Speed is critical in filter application and
control, and the device should be able to run autonomously without the host PC after
calibration has occurred. All software on the DSP board was written in C. Two paths of
execution appear on the DSP The interrupt service routine (ISR), and the main path

- 17 -

Automated Digital Audio Equalizer


loop. The ISR is responsible for outputting and buffering/recording all audio. The main
path is responsible for coordinating filter calibration and filtering buffered audio.

3.3.1 Interrupt Service Routine


The ISR is called automatically by the audio codec when new data is ready to be serviced
(and when new data is requested to be played, although these happen concurrently).
Given the sample rate of 44.1 kHz, the ISR occurs approximately every 23us. Figure 7
shows the ISR flow diagram.

Check Status
Passthrough

Mute

Output = Input

Output = 0

Filter

NO

Store input sample to input buffer


Play sample from output buffer

Calibrate

YES
Buffer full?

Swap buffers
output buffer = work buffer
work buffer = input buffer
input buffer = output buffer
Sweep Buffer
Full?
NO

Check for data from PC


(non blocking read command)

Sweep Buffer = MIC Input


Output = sweep(i)

YES
Set
channel done
flag
Output = 0

Return

Figure 7. Flow diagram of the Interrupt Service Routine on the DSP board.

- 18 -

Automated Digital Audio Equalizer


At each ISR entry, a board status flag is checked. This flag represents what type of output
the board should produce and is one of four modes: Passthrough, Mute, Filter, and
Calibrate.

For passthrough mode, the ISR simply outputs to the receiver the current input sample
from the audio codec. No filtering is done.

For mute mode, the ISR simply outputs nothing to the receiver. No filtering is done.

In Filter mode, the ISR manages a three buffer system of data used for input, output, and
filtering. At each ISR entry, the incoming audio sample is stored to an input buffer and a
sample from the output buffer is played to the receiver. If the ISR detects that the input
buffer is full, it performs a buffer switch. The input buffer is swapped into the work
buffer, which is then flagged to be filtered by the main path of execution. The work
buffer, which has already been filtered, is swapped into the output buffer for playback.
Finally the output buffer, which contains invalid data, is recycled to the input buffer for
new data.

In calibrate mode, the ISR plays a sample from a previously generated logarithmic sweep
(30Hz to 22050Hz). This sweep is 32768 samples in length (743ms). The ISR also stores
a sample from the microphone input to a large buffer to be worked on after the sweep has
been played. When the sweep is complete, the ISR marks a channel done flag. This flag

- 19 -

Automated Digital Audio Equalizer


is used by the main path of execution to allow the next step in calibration to take place as
discussed in the next section.

Before the ISR returns to the main path of execution, a read command is issued to
attempt to receive a new mode flag from the user interface. The command is nonblocking and is scheduled by the real time operating system running on the DSP to
handle any incoming data. If data exists, the mode flag is set to the new value.

3.3.2 Main Path of Execution


A simplified diagram of the main path of execution is shown in Figure 8. The main path
of execution runs inside an infinite loop, constantly checking for filter mode updates or
filter requests from the ISR. At program start, many initialization procedures are run,
including initializing all the filter arrays to allpass filters, generating the digit reverse
table for the FFT routine, enabling the ISR and other global interrupts, enabling
RTDX/JTAG, and setting the initial status mode. After setup, the program falls into the
infinite loop and branches at one of four status modes.

- 20 -

Automated Digital Audio Equalizer


Setup Buffers
Initialize Filters
Generate Digit Reversal Table
Setup ISR
Enable RTDX
Set Default Mode To Passthrough
Check Status
Mute

Filter

Passthrough

Calibrate

Apply Window

FFT

User

Flatline
Filter Mode

Play sweep

Generate Original Sweep


Apply Filter

FFT

Smooth

Apply Filter

Normalize
Apply Psychoacoustic Filter

Apply filter to
original sweep

Create and Store Filter


Set status to
filter

Upload Filter Data


to PC

YES

First Pass?

IFFT

NO

Sum overlapped samples

Figure 8 Main path of execution flow diagram.

For both the mute and passthrough status modes, nothing is done within the main path,
and a simple busy wait occurs.

If the status mode is set to filter, the main path first checks if the work buffer (described
in 3.3.1) has been flagged for filtering. If so, the filter operation occurs as detailed in
section 2.4. After filtering, the block flag is cleared and a busy wait occurs until either the
status mode changes or a new work buffer is prepared.

If the status mode is set to calibrate, the main path coordinates calibration with the ISR.
First, by generating a logarithmic sweep, setting output to the left channel only, and
clearing the channel done flag, the main path waits for the ISR to play and record the

- 21 -

Automated Digital Audio Equalizer


sweep on the left channel and set the channel done flag. Once set, the main path sets
the channel output to the right channel and clears the flag again. After the ISR sets the
flag, both the left and right channel responses can be calculated from the recordings as
discussed in section 2.3. After filter creation, the original sweep is played and recorded
again on the left and right channels through the filter. These new recordings can be used
to evaluate the effectiveness of the filter and are uploaded to the PC for examination by
the user. After uploading to the PC, the status mode is changed to filter.

- 22 -

Automated Digital Audio Equalizer

3.4 User Interface Implementation


All interfacing with the device occurs from a PC connected to the device via USB. The
user interface on the PC is designed to provide the user with several key features:

One-Button Auto Calibration


Viewing of filter spectra (one plot for each channel)
Filter selector (flat line, results from psychoacoustic tests, user specified)
Mute/Unmute

A screenshot of the user interface is provided in Figure 9.

The user interface is written in C++ with Microsoft Foundation Class in Visual Studio
2005. Since the only communication to the board is via USB, most common Windows
XP systems should be able to run the software without any problems.

Figure 9. Graphical User Interface

- 23 -

Automated Digital Audio Equalizer


To calibrate the device, the user simply needs to select the Flatline radio button and
select the Calibrate button. Auto calibration takes approximately 30 seconds to
complete, due mainly to the transfer rate of the USB connection.

If the user chooses to supply his or her own filter data, a User Defined option is
provided. A file format has been defined as containing two columns of floats and 4096
rows. It would appear as:
1.00
1.01
1.02
.
.
.
1.50

.500
.501
.502
.
.
.
1.00

The left column represents the left channel filter spectra and the right column represents
the right channel. This format contains no phase adjustment capability. The first row
represents the most negative frequency (-22050Hz), with the midpoint being 0Hz (DC).
The data should be symmetric about the midpoint. To set a user defined filter, select the
User Defined radio button, select the file in the Filename field, and click the
Download button. The Download button appears where the Calibrate button is in
Figure 9.

A third radio button Passthrough mode is available to apply no filter to the audio
stream.

To mute or unmute the system, click the Mute button.

- 24 -

Automated Digital Audio Equalizer

The Toggle Input button is used to switch between microphone and line-in inputs. This
is used primarily for testing the microphone and this button is not used for calibration.
The device automatically switches between line-in and microphone input during
calibration.

A Psychoacoustics button is provided to enter the psychoacoustics test menu. Details


on the psychoacoustics tests are provided in section 4, with conclusions and results in
section 5.3. After selecting the Psychoacoustics button (which can only be selected
after calibration), the menu shown in figure 10 is given.

Figure 10. Psychoacoustics menu.

A choice of four filters (detailed in section 4) is given. To perform a double blind test, a
Double Blind button is provided that randomizes the filters and masks the names as
shown in figure 11.

Figure 11. Double blind psychoacoustics menu.

- 25 -

Automated Digital Audio Equalizer


After the test is completed, selecting the Reveal button will reveal the mask and allow
the tester to record the results (results from our tests are shown in section 5.3).

Finally, two plot windows are provided to allow the user to view the filter and filter
effectiveness spectra. Three plots exist on each of the two channel windows. The red plot
shows the unfiltered frequency response of the room with respect to the listeners
position. The blue plot shows the filter spectra. Finally, the green plot shows the filtered
frequency response.

- 26 -

Automated Digital Audio Equalizer

4. Psychoacoustics Test
Psychoacoustics is the study of the psychology of the human perception of sound [5].
Psychoacoustics is a subjective measurement, not an objective measurement. Therefore,
personal preference, the persons mood, and a host of other psychological factors can
come in to play when making use of the mental framework of the psychoacoustic field.

Psychoacoustics is relevant to our project in that it allows us to build a bridge between


the technical ways of talking about sound and the human listeners perception of sound.
Sound being played in a room and recorded and analyzed by a microphone and computer
is only half of the picture; the other half is the human experience of that sound. It is
argued by the Audio Equalizer Team that the flatline response does not sound best
when compared to other equalizer settings. This is likely due to an array of reasons
ranging from the physiological working of the human ear to cultural influences on how
sound should be heard.

Double blind tests were conducted in order to study how listeners would rate audio that
had been room corrected and then processed in with additional filters shown in figure 12.

- 27 -

Automated Digital Audio Equalizer

Filter 1
dB

0
-6

Filter 3

Filter 2
dB

dB

6
0

6k

-5

300

Frequency (Hz)

6k

30

Frequency (Hz)

6k

Frequency (Hz)

Figure 12 Filters (1) Low end boost (2) Midrange boost (3) Low and High boost

Figure 13 shows how the tests were set up. The room correction device was first allowed
to characterize the rooms response with respect to the position of the listener. The
listener / test subject is then brought in and seated with a wireless keyboard which
allowed them to interact with the computer which is controlling the room corrector.

Figure 13. Setup for psychoacoustic testing

A song is played on a set-top CD player and passed through the equalizer. With the
keyboard, the user can switch between several versions of the room correction filter. The
first is just a filter which created a flatline response. There are three additional filters
which are then applied on top of the flatline filter. These additional filters, shown in
figure 12 are as follows:

- 28 -

Automated Digital Audio Equalizer

Filter 1 boosted frequencies up to 6 k.

Filter 2 boosted midrange frequencies of 300 to 6k Hz.

Filter 3 boosted the low end and high end frequencies.

Using the psychoacoustics menu on the user interface running in double blind mode, the
user selects between the four filters and rates them from most favorite to least favorite.

Since the test is double blind, the information telling which letter corresponded to which
filter is not revealed to anyone until the test is done. This made sure that the testers do
not unduly influence the test.

Results from the test are detailed in section 5.3.

- 29 -

Automated Digital Audio Equalizer

5. Results and Conclusions


5.1 Filter Results

Figure 14. Filter performance evaluation. The blue plot is the unfiltered response,
the green is the filtered response. The gray band is the target 3dB band for the filter.
This response was generated by Boston Acoustics Speakers, listening point was at 6 feet
directly facing the speakers.

By the end of the allotted project design time, all specifications as given in Appendix A
have been met. The filter corrects the room response with respect to the listeners
position to within a 3dB band in most configurations. Certain other configurations cause
the improvement to deteriorate. Several examples are shown on the following pages.

- 30 -

Automated Digital Audio Equalizer


In each plot provided, the blue curve is the unfiltered response. The green curve is the
filtered response, and the gray bar is a 3dB target band. The horizontal axis is frequency
in Hz, and the vertical axis is gain in decibels.

Figure 15. Boston Acoustics speakers with microphone 1 foot away.

Figure 15 shows an evaluation of correction with a pair of Boston Acoustics speakers and
the listening position at 1 foot from the speakers. Note that the low frequency mode near
100Hz is not corrected very well. Most of the unfiltered response is situated above the
flatline. Likely, the user should lower the volume on the receiver slightly and attempt to
recalibrate.

- 31 -

Automated Digital Audio Equalizer

Figure 16 Paradigm speakers with microphone 5.5 feet away.

Figure 16 shows a pair of Paradigm speakers with the listening point at 5.5 feet. The
signal is easily corrected to within the 3dB band.

Figure 17 Paradigm speakers with microphone 5.5 feet away and speakers rotated 45 degrees.

Figure 17 shows the Paradigm speakers with the listening position at 5.5 feet, with the
speakers turned in at 45 degrees. Again, the correction works quite well. Notice the
second mode near 200Hz, likely caused by a room reflection.

- 32 -

Automated Digital Audio Equalizer

Figure 18 Paradigm speakers with microphone placed in corner of room.

The Paradigm speakers are again used in figure 18. The listening point is in the corner of
the room, facing the speakers. While not entirely visible here, human subjects noticed a
large bass boost when listening from the corner of the room.

Figure 19 Paradigm speakers with microphone placed in open metal cabinet adjacent to speakers.

Paradigm speakers are used again in figure 19, with the listening position inside a metal
cabinet. We are very surprised with the results. Notice the large null near 2kHz.

- 33 -

Automated Digital Audio Equalizer

5.2 Filter Conclusions


Acknowledging that all specifications have been met, combined with verification of the
filer performance from Matlab and a spectrum analyzer, the Audio Equalizer Team is
very pleased with the results of this system. We feel confident that this device is a
marketable product with a large target audience. All stages of development and testing,
while not without mistakes made, went smoothly and were completed in an efficient
manner.

5.3 Psychoacoustics Results


The results of the psychoacoustics tests were a bit unexpected. We knew that traditionally
people preferred the low end frequency boost in combination with a high end frequency
boost. It is also known that a midrange boost can often sound rather unpleasant when
listening to music.

The test results, shown in figure 20, show that the midrange boost filter, when applied to
the flat line response, was the most popular. The least popular was the filter which
boosted the bass and high frequencies. The error bars shown in figure 20 show that it is
not possible to determine which filter came in first, but the midrange filter does have a
lead over all the other filters error bars aside. Surprisingly, the flatline room corrected
filter came in second or third.

- 34 -

Automated Digital Audio Equalizer

Figure 20. Listening test results for psychoacoustic testing.


The vertical axis is the average rank given to each filter.

The results differ from what was expected. We thought that the flatline response and the
bass and treble boosting filters would be the preferred choices of listeners, but that is not
the case.

It has been found that a flatline room response is not the best or most desirable type of
filter, but it could serve as a good starting point upon which additional filters could be
added.

Several other considerations for this test have been made and are discussed in section 8.2.

- 35 -

Automated Digital Audio Equalizer

6. System Limitations
6.1 Limitations Overview
This system has several practical limitations that were not resolved for several reasons
including time constraints, lack of equipment, small budget, and lack of knowledge in the
field of acoustics engineering.

6.2 Communication Speed Between The DSP Board and PC


One of the most obvious limitations of this device is shown whenever data is sent from
the development board to the PC. The only available means of communication with the
board is through USB using the RTDX protocol provided by TI which simulates a JTAG
controller. This is unavoidable using this development board, but a production model of
this system could provide a simple high speed interface that does not require JTAG.

6.3 Calibration
The major limitation of the calibration phase is that the user must adjust the volume
manually to ensure proper calibration. The reason this is inconvenient is because the
calibration phase takes approximately 30 seconds. If the volume is too high, the filter
will clip and not be calibrated properly. The same will occur if the volume is too low. If
this occurs, the user must adjust the volume appropriately and re-calibrate.

- 36 -

Automated Digital Audio Equalizer


A previous version of the calibration control software normalized the volume by
subtracting the mean value of the amplitude before filter creation. While this method
works well in a one speaker environment, it fails to account for the loudness difference
between stereo speakers and can result in the amplitude of one speaker to be shifted
significantly from the other. This occurs primarily when the listener is not positioned
equidistant from both speakers. The result can lead to one speaker sounding much louder
than the other.

6.4 Speaker type


This device is designed for bookshelf loudspeakers. It is not guaranteed to work with
any other types of loudspeakers. Although the system may work with other speaker
types, tests have not been performed and no guarantees are made to the effectiveness of
the system under such conditions. A modification for other speaker types is trivial, and
multiple versions of the system can be made for different speaker types.

- 37 -

Automated Digital Audio Equalizer

7. Considerations and Tradeoffs


7.1 Considerations and Tradeoffs Overview
Throughout the project timeline, several decisions had to be made concerning design
implementation. While most decisions were either ideal or immaterial, several key design
choices were made after weighing the tradeoffs with other ideas.

7.2 Frequency Resolution


The greater frequency resolution the system has in general, the more control over the
signal the system has. Frequency resolution was limited mainly by CPU speed and
memory constraints. Several methods for increasing resolution were presented, but
eventually abandoned as discussed below.

7.2.1 Increase DSP Speed / Increase Memory


One way to increase performance of the system is to make use of a more powerful
processor with more available on-chip memory. The main benefit of this would be the
ability to increase the size of the input, work, and output buffers, which would directly
lead to the ability to use a longer FFT. This would increase the frequency resolution. As
an example, our current system uses a 4096 tap FIR filter, with a 44.1 kHz sample rate,
leading to a frequency resolution of approximately 10.7 Hz/bin. Because our FFT
algorithm is radix-4, the next FFT length would be 16,384 points. Given the sample rate

- 38 -

Automated Digital Audio Equalizer


of 44.1 kHz, this will result in a frequency resolution of about 2.7Hz, which is a quarter
of the current frequency resolution. Two drawbacks exist with this implementation: Cost
and delay. A more powerful development board can cost as much as $500 more, greatly
exceeding the teams budget. Also, a 16,384 sample input buffer creates a 744ms delay in
the system, easily exceeding the real-time constraint required in the project description.

7.2.2 Analog bypass filter


To increase low frequency resolution, an analog bypass filter has been suggested. It is
believed that it is less important to filter high frequency components due to several
reasons. One being that human hearing is logarithmic, so differences in lower frequencies
are much easier to distinguish than higher frequencies. Also, when dealing with music,
most of the frequencies are in the lower end of the spectrum of human hearing. An analog
bypass filter would split the high frequencies from the low frequencies. The low
frequencies would then be worked on just like our device is currently doing to the whole
spectrum of human hearing. The high frequencies would simply be sent through a delay
circuit and recombined with the low frequencies after processing and then played out.
The obvious benefit of this implementation is that it grants a much greater frequency
resolution in the lower frequencies when sampled at a lower sampling rate (allowing
more samples and a longer FFT). The difficulties in realizing this solution would most
likely come in trying to get the high frequency delay circuit just right so they would
arrive at the same time, every time, as the low frequencies after being filtered. Time
constraints prevented the team from implementing this circuit.

- 39 -

Automated Digital Audio Equalizer

8. Future Work
8.1 Filter Improvements
8.1.1 Live Feedback
A possible entry point for a future redesign of this project would be to add a live
feedback system to the filter. This would incorporate constant microphone recording
from the listeners position to account for changing room noise or other interferences. A
major hurdle to overcome in this addition would be the delay shift from audio output to
the microphone. Sound travels relatively slow through air and the system would have to
be aware of the distance from the speakers that the listener was at. The system could use
this data to look ahead in the audio stream to make dynamic filter corrections based on
current room conditions.

8.1.2 Analog Bypass


Another future redesign, as discussed earlier in section 7.2.2, is an additional circuit
board containing an analog bypass circuit that would split the high frequencies from the
low, allowing the DSP board to concentrate on the more useful low frequencies while
simply passing the high frequencies to the receiver. The addition would require a delay
circuit, possibly a bucket brigade CCD to match the high frequency delay to the low
frequency delay.

- 40 -

Automated Digital Audio Equalizer

8.2 Psychoacoustics Tests Improvements

It is thought that having a larger sample size will allow for an increased understanding of
how people, in general, perceive the filtered test music. A larger sampling of listeners is
recommended for any future tests performed.

In the tests a single song, Les Toreadors, from the Carmen Suite, was used. The use of
a variety of types of music would make the testing procedure much longer but would
perhaps allow for a better understanding of how people rate the different filters.

Listeners expect different types of results from different types of music. Orchestral
music is often expected to be very clear and precise. In orchestral music, a listener is
much more likely to react negatively to dissonance caused by a bad listening
environment. In other types of music, such as heavy metal, the dissonance caused by a
bad listening environment might be less bothersome to the listener.

The use of an anechoic chamber would be beneficial in terms of studying the listeners
response to music. The anechoic chamber would ideally remove any reflections or
reverberations that exist in a normal room which would make the room correction much
easier and possibly not necessary, reducing influences to the test made by shortcomings
of the flatline filter.

- 41 -

Automated Digital Audio Equalizer

9. Acknowledgements
We would like to thank Dr. Damon Chandler for his devoted effort to our project and our
sanity during this last semester. Dr. Chandler provided endless ideas and suggestions that
gave our team the ability to complete our project. His interest in our well being and
defense of our design proved invaluable when criticism came our way. Thank you.

We would also like to thank Dr. Jim West, Dr. Keith Teague, Dr. Sohum Sohoni, Dr.
Jack Allison, Dr. Rao Yarlagadda, and Dr. Alan Cheville for their input both in design
ideas and equipment.

A very special thanks goes to the entire fourth floor of Engineering South. We apologize
for playing that logarithmic sweep that loud so often this semester.

- 42 -

Automated Digital Audio Equalizer

10. References
[1] Ronald Genereux, Adaptive Filters for Loudspeakers and Rooms, in 93rd
Convention of Audio Engineering Society, 1992.
[2] Backus, John, The Acoustical Foundations of Music, 2nd Ed, W W Norton, New
York, 1977
[3] Dr. Chandler, (personal communication), August 31, 2006.
[4] Helms, H.D. Fast Fourier Transform Methods of Computing Difference Equations
and Simulating Filters. IEEE Transactions on Audio and Electroacoustics, AU-15,
No. 2 (June, 1967), pp. 85-90.
[5] Wikipedia Contributors, Wikipedia, The Free Encyclopedia, Psychoacoustics,
September 29, 2006, http://en.wikipedia.org/wiki/Psychoacoustics.

- 43 -

Automated Digital Audio Equalizer

11. Appendix A
Specifications
Filter Specifications
Frequency Resolution
Amplitude Resolution2
Sample Rate
Filter Type
Phase
Total Delay
Number of Filters
Correction Range
Smoothing Bandwidth

10.7
1
44.1
Finite Impulse Response
Linear (Constant Delay)
250
2
12
Variable
<200Hz: 100Hz
>200Hz: 1/3rd Octave

Hz/bin
dB
kHz (CD Quality)
ms MAX
left and right channel
dB (per band)

Power (powered by included AC adaptor)


Input Voltage
Current

5
3

VDC
ADC MAX

Mechanical Specifications
Board Length
Board Width
Case Length
Case Width
Case Height
Total Weight
Case Material

8.75
4.50
10.25
5.00
1.50
68.5
Aluminum Body, Steel Hinge

inch
inch
inch
inch
inch
ounce

User Interface
A Win32 application is used for calibration, demonstration, and debugging.
The software provides:

One-Button Auto Calibration


Viewing of filter spectra (one plot for each channel)
Indicators for current status (not calibrated, calibrating, calibrated)
Filter selector (flat line, results from psychoacoustic tests, user specified)

Precision at which amplitude of frequency components in each bin can be adjusted. The nominal value of
1dB is a worst case condition.

- 44 -