diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h index 3a52b96a19d06c085cb70e66d7e7686b04155101..f095bd1180a4e1c2e745ae3b5c483e92ef37d0b1 100644 --- a/daemon/src/audio/audiolayer.h +++ b/daemon/src/audio/audiolayer.h @@ -109,7 +109,21 @@ class AudioLayer { * Apply gain to audio frame */ static void applyGain(SFLDataFormat *src , int samples, int gain); - + + /** + * Convert audio amplitude value from linear value to dB + */ + static double amplitudeLinearToDB(double value) { + return 20.0 * log10(value); + } + + /** + * Convert audio amplitude from dB to Linear value + */ + static double ampluitudeDBToLinear(double value) { + return pow(10.0, value / 20.0); + } + /** * Set capture stream gain (microphone) */