diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
| commit | 386b7d3366f1359a265da207a9cafa3edf553b64 (patch) | |
| tree | c76120c2c138faed822e4ae386be6ef22a738a78 /baseline/source/audiobeam | |
| parent | 54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff) | |
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'baseline/source/audiobeam')
| -rw-r--r-- | baseline/source/audiobeam/README | 86 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeam.c | 594 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeam.h | 50 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeaminput.c | 5784 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeamlibm.c | 423 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeamlibm.h | 59 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeamlibmalloc.c | 14 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeamlibmalloc.h | 27 | ||||
| -rw-r--r-- | baseline/source/audiobeam/audiobeamlibmath.h | 69 | ||||
| -rw-r--r-- | baseline/source/audiobeam/changeLog.txt | 36 | ||||
| -rw-r--r-- | baseline/source/audiobeam/license.txt | 21 |
11 files changed, 7163 insertions, 0 deletions
diff --git a/baseline/source/audiobeam/README b/baseline/source/audiobeam/README new file mode 100644 index 0000000..e228eda --- /dev/null +++ b/baseline/source/audiobeam/README | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | Readme file for Oxygen beamforming source code distribution | ||
| 2 | ----------------------------------------------------------- | ||
| 3 | |||
| 4 | This is a very very beta distribution of beamforming source code from | ||
| 5 | MIT LCS. | ||
| 6 | |||
| 7 | There is only one source file, main.c, and one header file, | ||
| 8 | main.h. You can compile everything using the Makefile included in the | ||
| 9 | distribution. | ||
| 10 | |||
| 11 | The input to the program is a text file containing floating | ||
| 12 | point values for the signal read on each of the microphones. For n | ||
| 13 | microphones, each line of the text files represents a temporal sample | ||
| 14 | and should contain n floating point values separated by spaces, e.g.: | ||
| 15 | |||
| 16 | -1.8569790e-004 -9.0919049e-004 3.6711283e-004 -1.0073081e-005 ... | ||
| 17 | |||
| 18 | There are several modes of operation for the program: | ||
| 19 | |||
| 20 | 1. The most basic mode is to process the microphone data and to | ||
| 21 | calculate the output based on one beam focused on a particular point | ||
| 22 | in space. The coordinates for the microphones and the focus point are | ||
| 23 | specified inside main.c (eventually to be moved to a separate file). | ||
| 24 | |||
| 25 | 2. Far field search mode. This mode assumes a far-field source (which | ||
| 26 | means we have a planar wavefront) and a linear array, and sweeps over | ||
| 27 | 180 degrees in the plane of the array. The microphone coordinates are | ||
| 28 | specified in main.c, and the NUM_ANGLES constant defines how many | ||
| 29 | angle values should be tested (a value of 180 means one beam per each | ||
| 30 | degree). The energy of the signal over a particular window | ||
| 31 | (ANGLE_ENERGY_WINDOW_SIZE) is computed for each beam. The direction | ||
| 32 | with maximum energy is considered the direction that the speech signal | ||
| 33 | is coming from, and is printed out by the program. | ||
| 34 | |||
| 35 | 3. Near-field hill climbing mode. This mode accepts a starting | ||
| 36 | coordinate and attempts to "hill-climb" through the space seeking the | ||
| 37 | maximum energy. Each of the x, y, and z coordinates are perturbed in | ||
| 38 | the positive and negative directions at each time interval | ||
| 39 | (GRID_ENERGY_WINDOW_SIZE) by a step size (GRID_STEP_SIZE). This | ||
| 40 | perturbation, along with the original coordinate, produces seven | ||
| 41 | coordinates to be tested. The direction with the maximum energy | ||
| 42 | replaces the current reference coordinate. For instance, if we have a | ||
| 43 | starting reference coordinate of (1,1,0) and our step size is 0.01, we | ||
| 44 | will evaluate the energy for the following seven beams: | ||
| 45 | |||
| 46 | (1,1,0) | ||
| 47 | (0.99,1,0) | ||
| 48 | (1.01,1,0) | ||
| 49 | (1,0.99,0) | ||
| 50 | (1,1.01,0) | ||
| 51 | (1,1,-0.01) | ||
| 52 | (1,1,0.01) | ||
| 53 | |||
| 54 | Now let's say the beam (1,1.01,0) has the maximum energy; then this | ||
| 55 | coordinate will replace the original reference coordinate of (1,1,0). | ||
| 56 | |||
| 57 | For methods 2, and 3, we are not outputting anything to disk, we are | ||
| 58 | just printing the result. This is because we have just started to work | ||
| 59 | with these methods, and have not applied them in real systems. This | ||
| 60 | code is currently being ported to RAW. | ||
| 61 | |||
| 62 | To get a list of parameters for the delay_and_sum executable that is | ||
| 63 | generated when the source is compiled, just type ./delay_and_sum . | ||
| 64 | |||
| 65 | There is some sample data included with the program, in the data | ||
| 66 | directory. There is some data for a near-field and far-field | ||
| 67 | source. The README.txt file in each directory specifies the microphone | ||
| 68 | and source position. The data1 file, when processed with a beamformer | ||
| 69 | aligned in the proper direction should produce something like a sinc | ||
| 70 | function (see | ||
| 71 | http://ccrma-www.stanford.edu/~jos/Interpolation/sinc_function.html). | ||
| 72 | |||
| 73 | The data2 file should produce an audio signal of a woman saying "the | ||
| 74 | simplest method". If the beamformer is aligned properly, the noise | ||
| 75 | should be reduced significantly over the source signal from only one | ||
| 76 | of the microphones (use print_datafile.pl to isolate one | ||
| 77 | microphone). You can convert the data file that the program produces | ||
| 78 | to wave files using sox. | ||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | --------------------------------- | ||
| 85 | Eugene Weinstein | ||
| 86 | ecoder@mit.edu \ No newline at end of file | ||
diff --git a/baseline/source/audiobeam/audiobeam.c b/baseline/source/audiobeam/audiobeam.c new file mode 100644 index 0000000..ed5d656 --- /dev/null +++ b/baseline/source/audiobeam/audiobeam.c | |||
| @@ -0,0 +1,594 @@ | |||
| 1 | /* | ||
| 2 | |||
| 3 | This program is part of the TACLeBench benchmark suite. | ||
| 4 | Version V 2.0 | ||
| 5 | |||
| 6 | Name: audiobeam | ||
| 7 | |||
| 8 | Author: Eugene Weinstein | ||
| 9 | |||
| 10 | Function: Audio beam former | ||
| 11 | |||
| 12 | Source: StreamIt | ||
| 13 | http://groups.csail.mit.edu/cag/streamit/ | ||
| 14 | |||
| 15 | Changes: no functional changes | ||
| 16 | |||
| 17 | License: see license.txt | ||
| 18 | |||
| 19 | */ | ||
| 20 | |||
| 21 | |||
| 22 | /* | ||
| 23 | Include section | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include "../extra.h" | ||
| 27 | #include "audiobeamlibm.h" | ||
| 28 | #include "audiobeamlibmalloc.h" | ||
| 29 | #include "audiobeam.h" | ||
| 30 | |||
| 31 | /* | ||
| 32 | Forward declaration of functions | ||
| 33 | */ | ||
| 34 | |||
| 35 | void audiobeam_init(); | ||
| 36 | int audiobeam_return(); | ||
| 37 | void audiobeam_main( void ); | ||
| 38 | //int main( void ); | ||
| 39 | void audiobeam_preprocess_delays( struct audiobeam_PreprocessedDelays | ||
| 40 | prep_delays[], float *delays ); | ||
| 41 | float *audiobeam_parse_line( float *float_arr, int num_mic ); | ||
| 42 | long int audiobeam_find_max_in_arr( float *arr, int size ); | ||
| 43 | long int audiobeam_find_min_in_arr( float *arr, int size ); | ||
| 44 | int audiobeam_wrapped_inc_offset( int i, int offset, int max_i ); | ||
| 45 | int audiobeam_wrapped_dec_offset( int i, int offset, int max_i ); | ||
| 46 | int audiobeam_wrapped_inc( int i, int max_i ); | ||
| 47 | int audiobeam_wrapped_dec( int i, int max_i ); | ||
| 48 | struct audiobeam_DataQueue *audiobeam_init_data_queue( int max_delay, | ||
| 49 | int num_mic ); | ||
| 50 | struct audiobeam_Delays *audiobeam_init_delays ( int num_angles, int num_mic ); | ||
| 51 | void audiobeam_calc_distances( float *source_location, | ||
| 52 | float audiobeam_mic_locations[15][3], | ||
| 53 | float *distances, | ||
| 54 | int num_mic ); | ||
| 55 | void audiobeam_calc_delays( float *distances, float *delays, int sound_speed, | ||
| 56 | int sampling_rate, int num_mic ); | ||
| 57 | void audiobeam_adjust_delays( float *delays, int num_mic ); | ||
| 58 | float *audiobeam_calc_weights_lr ( int num_mic ); | ||
| 59 | float *audiobeam_calc_weights_left_only ( int num_mic ); | ||
| 60 | float audiobeam_calculate_energy( float *samples, int num_samples ); | ||
| 61 | float audiobeam_do_beamforming( struct audiobeam_PreprocessedDelays | ||
| 62 | preprocessed_delays[], | ||
| 63 | float **sample_queue, | ||
| 64 | int queue_head, | ||
| 65 | long int max_delay, | ||
| 66 | int num_mic, | ||
| 67 | float *weights ); | ||
| 68 | int audiobeam_process_signal( struct audiobeam_Delays *delays, int num_mic, | ||
| 69 | float sampling_rate, float **beamform_results, | ||
| 70 | struct audiobeam_DataQueue *queue, | ||
| 71 | int num_beams, int window, float *weights ); | ||
| 72 | int audiobeam_calc_beamforming_result( struct audiobeam_Delays *delays, | ||
| 73 | float **beamform_results, | ||
| 74 | float *energies, | ||
| 75 | struct audiobeam_DataQueue *queue, | ||
| 76 | int num_beams, int window, | ||
| 77 | int hamming ); | ||
| 78 | void audiobeam_calc_single_pos( float source_location[3], | ||
| 79 | float audiobeam_mic_locations[15][3], | ||
| 80 | int hamming ); | ||
| 81 | |||
| 82 | |||
| 83 | /* | ||
| 84 | Declaration of global variables | ||
| 85 | */ | ||
| 86 | |||
| 87 | extern float audiobeam_input[5760]; | ||
| 88 | extern float audiobeam_mic_locations[15][3]; | ||
| 89 | extern float audiobeam_ | ||
