The everyday user of a home theater audio system does not know the best way to use the speaker in order to optimize the sound quality as far as speaker placement and equalization are concerned. They usually end up just using the preset settings or attempt to change the settings manually by listening to the music and adjusting the equalization. Although adjusting the settings will help with the quality of the speaker most times, the user does not get the optimal sound from the speaker due to constructive and destructive interferences from objects and walls within the room.
The goal of our project attempts to help resolve this issue for the user. There has yet to be a device that analyzes the environment of the room and adjusts the settings of the speakers according to the room without interfacing to a computer. There is a large market of home theatre audio enthusiasts who love quality audio; the main goal is to design a device that will correct the frequency response of any speaker and in turn improve the performance of the entire sound system.
The Real Time Room Correction (RTRC) device will run in two modes, listening mode and room analysis mode. When the device is set to listening mode the device will simply pass audio through any filters that are saved. If there are no filters saved it will just send the incoming audio signal to the output. When the device is in room analysis mode it will prepare the user to send pink noise through the speakers. While the pink noise is playing it will measure the acoustical Root Mean Square (RMS) sound pressure. Next, the device will prepare to send a logarithmic sweep of the frequencies to record the amplitude with the reference microphone. The microcontroller will collect that data and perform a Fourier Transform, to analyze the frequency spectrum of the signal. Then it will analyze the peaks and valleys of the spectral analysis and use that information to create inverse correction filters. The filters used in this project are Infinite Impulse Response (IIR) filters.
The common user does not have the training or ear to equalize audio to receive the best possible sound from the speaker system. Most people rely on the preset equalization (EQ) settings from their home theater equipment which will not provide the optimal sound for the user. In order to create a correction filter the room must be analyzed. A standalone sound system will be dependent on three frequency responses. The first consideration is the frequency response of the human ear, which is dependent on the location in the room. This location will be known as the listening position. The human ear can be substituted for the frequency response of the microphone being used for the analysis. The second frequency response is the frequency response generated by the speaker. Each speaker will not only have its own spectral characteristics, but also its own spectral limitations. Lastly, and often ignored, is the frequency response of the room. Each room will have a different modal representation of standing waves.
Frequencies will interact with each other because of reflections and acoustical impedances within the room. This interaction will either cause constructive or destructive interferences, which brings us to our analysis. We will send a logarithmic sweep signal of the frequencies through the speaker and capture the response back through a microphone set at the listening position. This analysis will provide information crucial for the correction filter generated. A series of infinite impulse response (IIR) filters will be applied in parallel to obtain one final correction filter for the entire spectrum. This will dramatically increase the performance of any speaker to a calibrated position within the room, also noted as the listening position.
1.2 General Audio Background Information
Sound measurement technology has come a long way since the 17th century when the physics term “acoustics” came about, according to Keith Clark (proaudioencyclopedia.com). Starting with Thomas Edison`s invention of the carbon-button microphone in 1876 to the invention of stereo audio by Alan Blumlein in early 1930`s. Since then, there have been thousands of audio electrical devices that have been invented to understand sound properties in a scientific way.
A company by the name Shure, formerly known as Shure Brothers, developed a software that graphically displays the frequency plot of what a microphone is picking up. Typically an Omni-directional microphone will be used in order to not have an “angle of axis” conflict, like with a cardioid polar pattern. Using the Shure Smaart system, pink noise (explained in section 2.1, Decibel Matching and Pink Noise) would be played through the speakers and the Shure Smaart software would display the spectrum without any smoothing applied. In order to equalize an audio system, the usage of parametric and graphic equalizers were used while referencing the Smaart program and his ear to balance the spectrum to the engineer’s desired taste.
More modern room acoustic analysis software’s include REW (Room EQ Wizard) and Acourate. REW is a very popular tool because it is free on the internet and provides very good information about your intended listening space through the speaker system. Acourate is a very expensive software with very accurate readings and filter generators to correct your audio system. The program is intended on being used in high definition studios that have expensive sound processing through a computer. The average listener does not use a computer, instead they would typically use a home theatre receiver to distribute multiple audio inputs to the dedicated speakers in the living room of their home. The RTRC will be patched in between any audio signal and the speakers chosen and will compensate for constructive and destructive interference due to reflections in the room.
Naturally different frequencies will have a different propagation time as they travel through space. Physical properties of the room like wall distance and objects in the room will act as acoustical impedance. The frequencies will all travel at different speeds bouncing off of objects in the room and will constantly interact with each other. The position of the room that we care about is the listening position. The summation of all the frequencies of a given signal are what the listener hears. This position will consist of constructive and destructive interferences from phase differences between the frequencies, we can see the interaction of these interferences below in figure 1.1.

Figure 1.1: Constructive vs Destructive Interference
There is no amount of acoustic treatment that can be applied to a room in order to correct the interaction of frequencies. Therefore they must be dealt within the digital domain which is what the RTRC does without the user adjusting an equalizer themselves. The RTRC also performs the automatic equalization in a tasteful manner that is pleasant to the ears. The human ear understands audio tones in octaves and can recognize harmonics of the original tone and can be represented with a Fibonacci curve. This is demonstrated below in figure 1.2.

Figure 1.2: Fibonacci Representation of Musical Notes
Figure 1.3 below shows that we have the same Fibonacci curve in the basilar membrane in our ears which maps out how we perceive frequencies. For this reason audio engineers will often use pink noise as a test tone.

Figure 1.3: Human Ear Physical Interpretation of Frequencies
After understanding how the human ear understands and interprets frequencies it apparent that there will be a need for a low-pass filter to account for the overcompensation of the correction filter. This target low-pass filter was designed for equalization of headphones however it is coherent to sensitivity of different frequencies in human ears and is known as the Harman Target Curve (Innerfidelity.com) shown below in Figure 1.4. For simplicity sake the RTRC only performs a normal low pass filter and is not concerned with the boost below 100Hz and at 3 kHz. Instead we created a low pass filter with cutoff frequency of 3kHz that will fall -6dB per octave.

Figure 1.4: Harman Target Curve
1.3 General DSP Background Information
This circuit will require a good amount digital signal processing (DSP) in order to take an analog signal input and process it with a correction filter to then send the final signal to the amplifier. For starters we are using the microcontrollers on-board analog to digital converter (ADC) and the digital to analog converter (DAC) for the input and output. These converters will use the clock source of the microcontroller crystal to sample the incoming audio signal at a sampling frequency 44.1kHz with a bit depth of 16 bits. In Figure 1.5 below the process of digital sampling of an analog signal amplitude that is constantly changing. With the sampling frequency being 44.1kHz, we will have a sampling time of 22.6μs according to formula (1.1) below.

So every 22.6μs the clock will trigger for the ADC to capture another sample of the amplitude of the signal.
This sampling rate meets the Nyquist conditions according to the sampling theorem, therefore can create an accurate representation of the original signal. The Nyquist rate is a rate that will achieve exact replication of the analog signal in the digital domain the signal must be sampled with twice the frequency of the highest frequency in the signal. The human ear is able to hear frequencies from 20Hz – 20kHz but we like to give a buffer of 2.05 kHz to ensure accuracy of our measurements and therefore we will over-sample the audio at a rate of 44.1 kHz.
The bit depth will determine how many steps of voltage are possible. As mentioned before, we are sampling with a 16 bit depth and 16 bits is equivalent to 65,536 discrete binary voltage steps that are possible. This is found through equations 2 and 3 below



Figure 1.5: Digital Sampling of an Analog Signal
The amplitude will be discrete values that will normalized and will range from -1 to 1. This data represents the signal amplitude in the time domain. The information we need is in the frequency domain, so a Fourier Transform must be made to the time domain data captured. Fourier analysis will break up the signal into its frequency components and is calculated through equation (1.4) below.

After the signal has been converted into frequency domain, equalization filters may be applied to the signal, which are described in detail in chapter 3 below in the Filter Design section.
1.4 Microcontroller Background
The microcontroller that we have decided to use in the project is the teensy 3.2. The reason that we chose the teensy is because of the programing software the controller uses to upload the code and the ability of the system to handle audio applications. The programing of the teensy can be done on the Arduino software. This allows us to use software that we are familiar with and create the code in an easily adaptable language, with libraries built in. This will help when we need to perform Fourier Transform to our audio signal.
The board itself works well for the project that we are trying to accomplish based on the specs. The teensy has a Cortex-M4 processor core in it and is clocked at 72 MHz, the reason we need the high frequency of the clock is because we are capturing a lot of data at various times in order to do the analysis in the room. It has 256 kilobytes memory which allows us to save and store more data than other microcontrollers that could have been used. The Direct Memory Access is 16 channels and 64 kilobytes of RAM which allows the higher process speed. The teensy gives 34 digital and analog input and output pins which gives a large amount of freedom for the audio applications needed.

Figure 1.6: Teensy 3.2 Microcontroller
The Teensy Microcontroller has specialized shields, similar to Arduino products, that handle typical audio applications Each shield has a stereo input and output in which the output has a parallel headphone jack built onto the shield. This made it simple to set-up the audio connections. There may be up to two audio shields per Teensy controller. This will allow for double the I/O while handling the same data processing. Figure 1.7 demonstrates the Teensy ontop of two audio shields.

Figure 1.7: Teensy 3.2 with Two Audio Shields