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 | |
| parent | 81939e5e629fd124595c05a56208176c3309974f (diff) | |
atodb and dbtoa conversions
| -rw-r--r-- | maximilian.cpp | 8 | ||||
| -rwxr-xr-x | maximilian.h | 2 |
2 files changed, 10 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 ) ); } diff --git a/maximilian.h b/maximilian.h index 8dc0d48..98f855b 100755 --- a/maximilian.h +++ b/maximilian.h @@ -468,6 +468,8 @@ class convert { public: static double mtof(int midinote); static int ftom(double frequency); + static double atodb(double amplitude); + static double dbtoa(double amplitude); }; |
