# Connexions

You are here: Home » Content » MATLAB Simulation of Audio Localization

### Recently Viewed

This feature requires Javascript to be enabled.

# MATLAB Simulation of Audio Localization

Module by: Elizabeth Gregory, Joseph Cole. E-mail the authors

Summary: In this section, we will go over the Matlab code we used to simulate our project, the various algorithms we tried, how we simulated "real-time", and how the matlab simulation dealt with real signals.

sinω(t τ 2 )+ φ 2 +sinω(t τ 1 )+ φ 1 =2sinωt+ φ 1 + φ 2 ω( τ 1 + τ 2 )2cos φ 1 φ 2 ω( τ 1 + τ 2 )2 ω t τ 2 φ 2 ω t τ 1 φ 1 2 ω t φ 1 φ 2 ω τ 1 τ 2 2 φ 1 φ 2 ω τ 1 τ 2 2
(1)
Equation 1 shows that the sum of two sinusoids that are out of phase is just another sinusoid with an amplitude directly related to the phase difference. Our goal is to adjust the phase difference by adding time delays to the incoming signals so as to maximize the amplitude of the output. The maximum occurs when the phase difference is zero, because the signals will add constructively. Once the maximum is found, the time delays used to achieve it tell us from which direction the signals originated.

Since we are working with discrete-time signals, the time delays we tried were limited by the sampling frequency of the DSP boards, which is 48 kHz. By dividing the desired time delay by that sampling period and rounding to the nearest integer, we converted our trial time delays into indices that could be used to select the correct sample out of the buffer.

So, the algorithm for delay-and-sum beamforming is straightforward, but there is room for a little bit of creativity in finding the amplitude of the summed sinusoids. We experimented with two methods to accomplish that task. We will call the first method "amplitude extraction," and the second "signal integration."

A flow diagram for the amplitude extraction method is shown in Figure 1. We split the signal into two parts and multiply one part by sinωt ω t and the other by cosωt ω t . By low-pass filtering the results, we obtain the DC part of the signal which contains the amplitude information. This algorithm has the obvious disadvantage that it is dependent on knowing the frequency of the incoming signal so that the correct w is used in the multiplication step. In spite of that, we were originally selected it for implementation on the DSP board because it showed extremely robust performance in the presence of loud noise. Adding gaussian white noise with a variance of 1 to a signal in the range -1 1 -1 1 had no affect on the performance of the beamformer in our Matlab simulation. Unfortunently, the algorithm is too slow to be used in real time. Evaluating two low-pass filters for every time delay combination tried was simply not practical.

The signal integration method is much simpler computationally, which made it a better choice for our final implementation. We only had to square the beamformer output to make all the numbers positive, and sum the results over approximately one cycle of the incoming signal. The sum is similar to an integral over one period of the signal, except that the samples aren't multiplied by the sampling period to make an "area." Our matlab simulation showed that the algorithm should work, but that it is somewhat more sensitive to noise than amplitude extraction.

We were unable to try either of our Matlab simulations with real signals recorded from our microphone array because we had difficulty making stereo recordings. The computers we used defaulted to recording from the microphone input (which is mono) instead of the line-in input, and we didn't have administrator access to change the settings.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks