Measure (frequency-weighted) sound levels with AudioKit
Asked Answered
C

0

6

I am trying to implement an SLM app for iOS using AudioKit. Therefore I need to determine different loudness values to a) display the current loudness (averaged over a second) and b) do further calculations (e.g. to calculate the "Equivalent Continuous Sound Level" over a longer time span). The app should be able to track frequency-weighted decibel values like dB(A) and dB(C).

I do understand that some of the issues im facing are related to my general lack of understanding in the field of signal and audio processing. My question is how one would approach this task with AudioKit. I will describe my current process and would like to get some input:

  1. Create an instance of AKMicrophone and a AKFrequencyTracker on this microphone
  2. Create a Timer instance with some interval (currently 1/48_000.0)
  3. Inside the timer: retrieve the amplitude and frequency. Calculate a decibel value from the amplitude with 20 * log10(amplitude) + calibrationOffset (calibration offset will be determined per device model with the help of a professional SLM). Calculate offsets for the retrieved frequency according to frequency-weighting (A and C) and apply these to the initial dB value. Store dB, dB(A) and dB(C) values in an array.
  4. Calculate the average for arrays over the give timeframe (1 second).

I read somewhere else that using a Timer this is not the best approach. What else is there that I could use for the "sampling"? What exactly is the frequency of AKFrequencyTracker? Will this frequency be sufficient to determine dB(A) and dB(C) values or will I need an AKFFTTap for this? How are values retrieved from the AKFrequencyTracker averaged, i.e. what time frame is used for the RMS?

Possibly related questions: Get dB(a) level from AudioKit in swift, AudioKit FFT conversion to dB?

Candidate answered 23/8, 2018 at 9:54 Comment(1)
did you get db(a)?Saransarangi

© 2022 - 2024 — McMap. All rights reserved.