Audio Equalizer Project

44
Audio Equalizer Project Senior Design II Final Report Cody Butler Mike Fergades David Fritz Hirotaka Maezawa Fall 2006

description

Audio Equalizer design process

Transcript of Audio Equalizer Project

  • Audio Equalizer Project Senior Design II Final Report Cody Butler Mike Fergades David Fritz Hirotaka Maezawa Fall 2006

  • Automated Digital Audio Equalizer

    - 2 -

    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.

  • Automated Digital Audio Equalizer

    - 3 -

    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

  • Automated Digital Audio Equalizer

    - 4 -

    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.

  • Automated Digital Audio Equalizer

    - 5 -

    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.

  • Automated Digital Audio Equalizer

    - 6 -

    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 Infinite Impulse Response Strengths Weaknesses Easy to implement Computationally

    more expensive Stable Uses more memoryLinear Phase Simple filter creation

    Strengths Weaknesses Computationally less expensive

    Difficult to implement

    Uses little memory Unstable Non-linear phase

    (usually) Difficult to obtain

    filter coefficients Table 1. Strengths and weaknesses of FIR and IIR filters

  • Automated Digital Audio Equalizer

    - 7 -

    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 10.7 Hz/bin Amplitude Resolution1 1 dB Sample Rate 44.1 kHz (CD Quality) Filter Type Finite Impulse Response Phase Linear (Constant Delay) Total Delay 200 ms MAX Number of Filters 2 left and right channel Correction Range 12 dB (per band) Smoothing Bandwidth Variable

    200Hz: 1/3rd Octave

    Filter Length 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.

  • Automated Digital Audio Equalizer

    - 8 -

    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.

  • Automated Digital Audio Equalizer

    - 9 -

    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.

  • Automated Digital Audio Equalizer

    - 10 -

    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 1)(

    1)( = jHjH for all .

    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.

  • Automated Digital Audio Equalizer

    - 11 -

    100 101 102 103 104 105-50

    0

    50

    Frequency (Hz)

    Gai

    n (d

    B)

    Unsmoothed Response

    100 101 102 103 104 105-40

    -20

    0

    20

    40

    60

    Frequency (Hz)

    Gai

    n (d

    B)

    Smoothed Response

    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.

  • Automated Digital Audio Equalizer

    - 12 -

    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].

  • Automated Digital Audio Equalizer

    - 13 -

    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

    function used, filtered in the

    usual manner, and

    reassembled by adding the

    overlapping sections of each

    block. This design uses a

    Hanning window, which

    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].

    0 100 200 300 400 500 600 700 800 900 1000-1

    -0.5

    0

    0.5

    1

    Time

    Result of Block Filtering Without Overlap and Add

    0 100 200 300 400 500 600 700 800 900 1000-1

    -0.5

    0

    0.5

    1

    Time

    Figure 3 Result of filtering without overlap-and-add. Note the spikes at each block edge (block edge here is 250 points)

    Figure 4 Hanning window and overlap-and-add. Note the 50% overlapping sections.

  • Automated Digital Audio Equalizer

    - 14 -

    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.

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

    Filter Array

    FFT

    Buffer

    X

    +

    IFFT

  • Automated Digital Audio Equalizer

    - 15 -

    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

  • Automated Digital Audio Equalizer

    - 16 -

    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.

  • Automated Digital Audio Equalizer

    - 17 -

    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

  • Automated Digital Audio Equalizer

    - 18 -

    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.

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

    Check Status

    Passthrough Mute Filter

    Output = Input Output = 0

    Buffer full?

    Store input sample to input buffer Play sample from output buffer

    NO

    Swap buffers output buffer = work buffer work buffer = input buffer input buffer = output buffer

    YES

    Calibrate

    Sweep Buffer Full?

    Set channel done

    flag

    Output = 0

    YES

    Sweep Buffer = MIC Input Output = sweep(i)

    Check for data from PC (non blocking read command)

    Return

    NO

  • Automated Digital Audio Equalizer

    - 19 -

    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

  • Automated Digital Audio Equalizer

    - 20 -

    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 non-

    blocking 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.

  • Automated Digital Audio Equalizer

    - 21 -

    Setup BuffersInitialize Filters

    Generate Digit Reversal TableSetup ISR

    Enable RTDXSet Default Mode To Passthrough

    Check Status

    Passthrough

    Mute Filter

    Calibrate

    Apply Window FFT

    Apply Filter

    Apply Psychoacoustic Filter

    Filter Mode

    Apply Filter

    FlatlineUser

    IFFT

    Sum overlapped samples

    Play sweep

    FFT Smooth Normalize

    Apply filter to original sweep First Pass?

    YES

    Upload Filter Datato PC

    NOSet status tofilter

    Create and Store Filter

    Generate Original Sweep

    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

  • Automated Digital Audio Equalizer

    - 22 -

    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.

  • Automated Digital Audio Equalizer

    - 23 -

    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

  • Automated Digital Audio Equalizer

    - 24 -

    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 .500 1.01 .501 1.02 .502 . . . . . . 1.50 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.

  • Automated Digital Audio Equalizer

    - 25 -

    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.

  • Automated Digital Audio Equalizer

    - 26 -

    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.

  • Automated Digital Audio Equalizer

    - 27 -

    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.

  • Automated Digital Audio Equalizer

    - 28 -

    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:

    Frequency (Hz)

    dBFilter 1

    6k

    0

    -6

    Frequency (Hz)

    dBFilter 2

    6k300

    0

    6

    Frequency (Hz)

    dB

    Filter 3

    6k30

    -5

    3

  • Automated Digital Audio Equalizer

    - 29 -

    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.

  • Automated Digital Audio Equalizer

    - 30 -

    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.

  • Automated Digital Audio Equalizer

    - 31 -

    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.

  • Automated Digital Audio Equalizer

    - 32 -

    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.

  • Automated Digital Audio Equalizer

    - 33 -

    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.

  • Automated Digital Audio Equalizer

    - 34 -

    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.

  • Automated Digital Audio Equalizer

    - 35 -

    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.

  • Automated Digital Audio Equalizer

    - 36 -

    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.

  • Automated Digital Audio Equalizer

    - 37 -

    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.

  • Automated Digital Audio Equalizer

    - 38 -

    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

  • Automated Digital Audio Equalizer

    - 39 -

    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.

  • Automated Digital Audio Equalizer

    - 40 -

    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.

  • Automated Digital Audio Equalizer

    - 41 -

    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.

  • Automated Digital Audio Equalizer

    - 42 -

    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.

  • Automated Digital Audio Equalizer

    - 43 -

    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.

  • Automated Digital Audio Equalizer

    - 44 -

    11. Appendix A

    Specifications

    Filter Specifications Frequency Resolution 10.7 Hz/bin Amplitude Resolution2 1 dB Sample Rate 44.1 kHz (CD Quality) Filter Type Finite Impulse Response Phase Linear (Constant Delay) Total Delay 250 ms MAX Number of Filters 2 left and right channel Correction Range 12 dB (per band) Smoothing Bandwidth Variable

    200Hz: 1/3rd Octave

    Power (powered by included AC adaptor) Input Voltage 5 VDC Current 3 ADC MAX Mechanical Specifications Board Length 8.75 inch Board Width 4.50 inch Case Length 10.25 inch Case Width 5.00 inch Case Height 1.50 inch Total Weight 68.5 ounce Case Material Aluminum Body, Steel Hinge

    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)

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