Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Acoustic Localization

  1. #1

    Acoustic Localization

    Hi all,

    I am starting a project with a Teensy 3.1. I want to use acoustic signals to provide the approximate position to a vehicle, i.e. the opposite of sound localization. I have a Teensy 3.1, analog microphone with amplifier board, and a Teensy audio adapter board coming within the next few days.

    The algorithm is currently as such:
    1. Initialize
    2. Sample at 44.1 kHz for 0.2 seconds (lets say every 10 seconds)
    3. Perform cross correlation of known signal and recorded signal
    4. Find peak of absolute value of cross correlation
    5. Repeat 2-5

    Right now I am having trouble with 2. I have been unable to get a fixed sampling rate using the ADC library (by pedvide). I think the audio adapter board may help with this.

    Any suggestions and advice is much appreciated

    Thanks,
    Michael

  2. #2
    Senior Member onehorse's Avatar
    Join Date
    Apr 2014
    Location
    Danville, California
    Posts
    921
    Could these perhaps help?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,500
    Try the File > Examples > Audio > Recorder example.

    It writes the audio to SD card. You can probably edit the code to just put the data into a big array, instead of writing to SD.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,500
    The Recorder example is written to use the I2S data from the audio board. But you can pretty easily change it to use AudioInputAnalog instead.

  5. #5
    Thank you for the suggestions.

    Onehorse: That would be a better choice that the analog mic I have now. But it would not arrive in time to Germany.

    Paul: The example has an I2S input, which as I understand samples at 44.1 kHz from a timer. I have been unsuccessful in controlling the Analog sampling rates, do you have a suggestion for that? I may sample faster and write a simple linear interpolation if I cannot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •