class MusMath {
private:
float _bpmFreq;
float _midiFreq;
float _midiPow;
public:
MusMath() {}
float bpmToFreq(float bpm) {
_bpmFreq = bpm/60;
return _bpmFreq;
} // bpm to freq
float midiToFreq(float midiNumber) {
_midiPow = ((midiNumber - 69) / 12);
_midiFreq = 440 * (pow(2, _midiPow));
return _midiFreq;
} // midi to freq
}; // MusMath
MusMath myMath;
void setup() {
Serial.begin(115200);
float bpmy = 118;
float freqy = myMath.bpmToFreq(bpmy);
Serial.println(freqy);
float midiNumbery = 60;
freqy = myMath.midiToFreq(midiNumbery);
Serial.println(freqy);
} // setup
void loop() {
// put your main code here, to run repeatedly:
} // loop