Giter Site home page Giter Site logo

beamforming_simulator's Introduction

Beamforming Array Simulator

Beamforming microphone arrays can spatially filter sound to remove background noise and isolate sound coming from a focus point. This Mathematica code is my attempt to simulate the rejection pattern of an arbitrary beamforming microphone array in three-dimensional space. I developed this while working for Shell TechWorks during the summer of 2018.

There are three files here to facilitate development and understanding, but only beamformingSimulator.nb runs the full 3D simulation.

How it Works:
  • Calculate the distances between the intended focus point and each of the microphones and convert these distances to time delays
  • Generate a sine wave at the test frequency at each point in space
  • For each point, vary the test signal phase to maximize the sum of the amplitudes measured at each mic
    • This can be most easily visualized and understood by running manipulateMax.nb, which simulates an arbitrary 1D array with the source placed axially
    • For points near the focus, this amplitude will be high. For points outside of the focus, this amplitude will be low for highly selective arrays (the goal)
    • Basically, high frequencies and large arrays work better than low frequencies and small arrays
  • The frequency response of an arbitrary 1D array with the source placed axially can be visualized with freqResponse.nb

Because the simulation relies heavily on Maximize, it runs very slowly. Be warned.

Example 3D gain pattern output:

3D gain pattern for an array

How to run:
  • Open beamformingSimulator.nb
  • Input your focus point and array coordinates (in cm) as desired. You can enter each point, enter half the array and mirror it, or enter a radius, number of elements, and array angle, just uncomment what you need. Make sure the range values (array r) will show your full array and the area you're interested in.
  • Run pre-evaluation cell and sanity check output
  • Enter desired test frequency
  • Run heavy evaluation cell. It will beep when finished evaluating the 2D model, which should be pretty quick, so you can stop it at that point and see vaguely what it looks like in 2D by running the plotting cell. It will beep again in a few minutes when it's finished the 3D evaluation.
  • Run the plotting cell. The array appears as blue dots and the focus point appears as a green dot. In the 2D model, the green bar at the bottom shows the test frequency wavelength compared to the array size. In the 3D model, the Manipulate allows you to slice the view to see inside. I'm sure there's a better way to do this, but the default OpacityFunction seemed misleading. I'd like to have the ClipPlanes ignore mics3D and focusPoint3D, but I couldn't figure out how to do that. You can play with the plotting cell without reevaluating the whole thing.
Disclaimers:

I'm by no means an expert on either beamforming or Mathematica, so if I've made any grave errors in either respect, please let me know. I currently have no way to validate the simulation. Note that all gain scales are linear (not in decibels).

beamforming_simulator's People

Contributors

rowansharman avatar

Stargazers

 avatar  avatar  avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.