AKAmplitudeTracker - Amplitude in dB?

825 views
Skip to first unread message

Charlie Jay

unread,
Jul 5, 2017, 8:53:58 PM7/5/17
to AudioKit Users Group
The docs do not seem to specify this, but is the detected amplitude of the AKAmplitudeTracker the amplitude in dB?

If not, is there a means by which I could track the amplitude of a signal from a microphone in dB (relatively accurately)?

Aurelius Prochazka Ph.D.

unread,
Jul 6, 2017, 12:21:27 AM7/6/17
to AudioKit Users Group
Mostly we deal with raw values 0-1 for amplitudes, not decibels which are more of a loudness indicator.  We sometimes use dB for gain.

Aure

Charlie Jay

unread,
Jul 6, 2017, 2:59:41 AM7/6/17
to AudioKit Users Group
Thanks for your response. I noticed the 0-1 range after playing around with it a bit.

What units does the amplitude tracker output (the raw value you mentioned)? 

Aurelius Prochazka Ph.D.

unread,
Jul 6, 2017, 3:36:40 PM7/6/17
to AudioKit Users Group
It doesn't really have a dimension.  It has to do with vibration of a speaker right, so I suppose you could call it a fraction of the maximum displacement.

Aure

Charlie Jay

unread,
Jul 6, 2017, 6:32:34 PM7/6/17
to AudioKit Users Group
That makes sense.

Excuse my lack of expertise, but do you have any advice for how I could convert the amplitude of you AKAmplitudeTracker into dB? 

In other words, to mimic the functionality of a decibel-o-meter? 

Aurelius Prochazka Ph.D.

unread,
Jul 6, 2017, 8:16:12 PM7/6/17
to AudioKit Users Group
Do the conversion, from AudioKit's source code

    /// Amplification Factor in db
    open dynamic var dB: Double {
        set {
            gain = pow(10.0, Double(newValue / 20))
        }
        get {
            return 20.0 * log10(gain)
        }
    }
Reply all
Reply to author
Forward
0 new messages