MCPcopy Create free account
hub / github.com/FastLED/FastLED / midiNoteToFrequency

Method midiNoteToFrequency

src/fl/audio/detector/note.cpp.hpp:178–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178float Note::midiNoteToFrequency(u8 note) const {
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}
187
188float Note::calculatePitchBend(float hz, u8 note) const {
189 if (note == NO_NOTE || hz <= 0.0f) {

Callers

nothing calls this directly

Calls 1

powfFunction · 0.85

Tested by

no test coverage detected