aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--maximilian.cpp8
-rwxr-xr-xmaximilian.h2
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);
};