diff options
| author | mzed <github@mikezed.com> | 2017-11-20 12:52:45 +0000 |
|---|---|---|
| committer | mzed <github@mikezed.com> | 2017-11-20 12:52:45 +0000 |
| commit | 81939e5e629fd124595c05a56208176c3309974f (patch) | |
| tree | 922c3aa5fb2a9a80df1151898855cc957dc5f08c /maximilian.cpp | |
| parent | fec9e22f85cb2e9a60d007319fbc06190ed71e55 (diff) | |
adding convert.ftom()
Diffstat (limited to 'maximilian.cpp')
| -rw-r--r-- | maximilian.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/maximilian.cpp b/maximilian.cpp index ee6d8de..74e4c61 100644 --- a/maximilian.cpp +++ b/maximilian.cpp @@ -1658,12 +1658,14 @@ void maxiDyn::setRatio(double ratioF) { ratio = ratioF; } - double convert::mtof(int midinote) { - return mtofarray[midinote]; } +int convert::ftom(double frequency) { + double baseFrequency = 440; + return round(12 * log2(frequency/baseFrequency)) + 69; +} template<> void maxiEnvelopeFollower::setAttack(double attackMS) { attack = pow( 0.01, 1.0 / ( attackMS * maxiSettings::sampleRate * 0.001 ) ); |
