FastLED 3.10.8
Loading...
Searching...
No Matches

◆ midiNoteToFrequency() [2/2]

float fl::audio::detector::Note::midiNoteToFrequency ( u8 note) const
private

Definition at line 178 of file note.cpp.hpp.

178 {
179 if (note == NO_NOTE) {
180 return 0.0f;
181 }
182
183 // f = 440 × 2^((n - 69) / 12)
184 float semitones = static_cast<float>(note) - A4_MIDI_NOTE;
185 return A4_FREQUENCY * fl::powf(2.0f, semitones / 12.0f);
186}
static constexpr u8 A4_MIDI_NOTE
Definition note.h:109
static constexpr float A4_FREQUENCY
Definition note.h:108
static constexpr u8 NO_NOTE
Definition note.h:110
float powf(float base, float exponent) FL_NO_EXCEPT
Definition math.h:444

References A4_FREQUENCY, A4_MIDI_NOTE, fl::FL_NO_EXCEPT, NO_NOTE, and fl::powf().

Referenced by calculatePitchBend(), and midiNoteToFrequency().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: