diff options
| author | mzed <github@mikezed.com> | 2017-11-20 13:29:56 +0000 |
|---|---|---|
| committer | mzed <github@mikezed.com> | 2017-11-20 13:29:56 +0000 |
| commit | 22c4e36d58eb7f2aecf03fb8da7a07211b76432f (patch) | |
| tree | 51ef72bb077ff552747cb2df06bb88c7704c1583 /maximilian.cpp | |
| parent | 81939e5e629fd124595c05a56208176c3309974f (diff) | |
atodb and dbtoa conversions
Diffstat (limited to 'maximilian.cpp')
| -rw-r--r-- | maximilian.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/maximilian.cpp b/maximilian.cpp index 74e4c61..18d3051 100644 --- a/maximilian.cpp +++ b/maximilian.cpp @@ -1667,6 +1667,14 @@ int convert::ftom(double frequency) { return round(12 * log2(frequency/baseFrequency)) + 69; } +double convert::atodb(double amplitude) { + return 20 * log10(amplitude); +} + +double convert::dbtoa(double decibels) { + return pow(10, (decibels * 0.5)); +} + template<> void maxiEnvelopeFollower::setAttack(double attackMS) { attack = pow( 0.01, 1.0 / ( attackMS * maxiSettings::sampleRate * 0.001 ) ); } |
