Download presentation
Presentation is loading. Please wait.
Published byBartholomew Pearson Modified over 8 years ago
1
Sound Source Localization & Surround System A Blackfin 533 DSP Application by Jordan Arnold & Adam Hanafi
2
Objectives To create a program capable of the following: Determining the angle of incidence of a source sound using two-microphone input Play back sound at any perceived angle using multiple speaker output Record a played sound and its angle(s) over a reasonable duration And to integrate these three functions, to record and playback sound with position.
3
Program Setup: This program requires the use of two microphones, which must be connected to the two input channels of the board. Only the left input channels are used for input It also requires the use of three speakers, which are connected to channel 0 left, channel 0 right, and channel 1 left.
4
Program Interface: Control of the program functions is achieved through the use of the four buttons, PF8-11. PF8 starts the system calibration. This accounts for any delay inherent to the setup, and should be run before any recording is performed. A test sound must be played at 90 degrees to the two microphones, after which the LEDs will light until the calibration is complete. PF9 enables surround sound testing. This will play whatever sound is on the Channel 0 Input, sweeping the output angle from 0 to 180 degrees. Pressing the button again disables this operation.
5
Program Interface II: PF10 starts the board recording. It will record a played sound through both microphones for five seconds, then calculate the angle(s) of incidence of that sound. This calculation is expected to take approximately 1Min. 30Secs. The LEDs will light until the calculation is completed. PF11 triggers playback of the recorded sound. The most recent recording will be output through the three speakers, at the correct angle(s) of incidence as calculated by the record function.
6
Implementation I: Cross-Correlation The program calculates the angle of incidence of a sound based on the time delay between the two microphones. To accomplish this, a cross-correlation is performed between the two input samples at all possible delays, to find the maximum correlation. The formula is: Where d is the delay, x and y are the two input arrays, and mean_x and mean_ y are their averages. This formula will have a maximum value at the correct d for any given two sound samples.
7
Implementation II: Angle Calculation The angle is calculated based on the delay found. Given d, the delay in # of samples, the angle of incidence was: arccos( (d/s * v_sound) /distance) Where s is the sample rate in Hz, v_sound is the speed of sound in air in m/s, and distance is the distance between the two microphones in meters. Based on this formula, using the maximum angles of 0 and 180 degrees, the maximum delay can be calculated. For our setup, this meant that the delay must be between 42 and -42 samples.
8
Implementation III: Angled Playback To play a sound at an angle, the relative gains of two speakers are adjusted. The sound will seem to be in between the two, closer to the louder speaker. Each two speakers represent 90 degrees, so three are required for 180 degrees and four for 360. Since the microphone correlation can only detect angles over a 180 degree sweep, the playback is also limited to 180 degrees. For convenience, the gain of the louder speaker is fixed to 1, and the other speaker is calculated accordingly: If phi > 0: If phi <= 0:
9
Optimization: The calculation of angles and their respective gains over a recorded sound is very time-consuming for the processor, so the following measures were taken to improve performance: A fixed number of potential gains were calculated and stored in a lookup table. There are 100 possible gains over the possible 180 degrees of playback. All variables necessary to the calculation functions were declared globally, so as not to waste time creating them on each call The various fractions of π used by the program were stored as constants to prevent unnecessary division operations.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.