|
FastLED 3.10.8
|
Note - Musical note detection with MIDI output.
Converts continuous pitch (from Pitch) to discrete musical notes using 12-tone equal temperament (12-TET). Provides note-on/note-off events with velocity information based on attack strength.
Key Features:
Performance:
#include <note.h>
Inheritance diagram for fl::audio::detector::Note:
Collaboration diagram for fl::audio::detector::Note:Public Types | |
| using | NoteStartCallback = void(*)(u8 note, u8 velocity) |
| using | NoteVelocityCallback = void(*)(u8 note) |
Public Attributes | |
| function_list< void(u8 note, u8 velocity)> | onNoteChange |
| NoteStartCallback | onNoteChange = nullptr |
| function_list< void(u8 note)> | onNoteOff |
| NoteVelocityCallback | onNoteOff = nullptr |
| function_list< void(u8 note, u8 velocity)> | onNoteOn |
| NoteStartCallback | onNoteOn = nullptr |
Private Member Functions | |
| float | calculatePitchBend (float hz, u8 note) const |
| float | calculatePitchBend (float hz, u8 note) const FL_NO_EXCEPT |
| u8 | calculateVelocity (float energy, float confidence) const |
| u8 | calculateVelocity (float energy, float confidence) const FL_NO_EXCEPT |
| u8 | frequencyToMidiNote (float hz) const FL_NO_EXCEPT |
| float | midiNoteToFrequency (u8 note) const FL_NO_EXCEPT |
| bool | shouldTriggerNoteChange (u8 newNote, u8 currentNote) const |
| bool | shouldTriggerNoteChange (u8 newNote, u8 currentNote) const FL_NO_EXCEPT |
| bool | shouldTriggerNoteOff (float confidence, bool voiced) const |
| bool | shouldTriggerNoteOff (float confidence, bool voiced) const FL_NO_EXCEPT |
| bool | shouldTriggerNoteOn (float confidence, float pitch) const |
| bool | shouldTriggerNoteOn (float confidence, float pitch) const FL_NO_EXCEPT |
Private Attributes | |
| u8 | mCurrentNote |
| float | mCurrentPitch |
| bool | mFireNoteChange = false |
| bool | mFireNoteOff = false |
| bool | mFireNoteOn = false |
| u32 | mLastUpdateTime |
| u8 | mLastVelocity |
| u32 | mMinNoteDuration |
| bool | mNoteActive |
| u8 | mNoteChangeThreshold |
| int | mNoteChangeThreshold |
| float | mNoteOffThreshold |
| float | mNoteOnEnergy |
| float | mNoteOnThreshold |
| u32 | mNoteOnTime |
| bool | mOwnsPitchDetector |
| u8 | mPendingOffNote = 0 |
| u8 | mPendingOnNote = 0 |
| u8 | mPendingOnVelocity = 0 |
| float | mPitchBend |
| shared_ptr< Pitch > | mPitchDetector |
| float | mVelocitySensitivity |
Static Private Attributes | |
| static constexpr float | A4_FREQUENCY = 440.0f |
| static constexpr u8 | A4_MIDI_NOTE = 69 |
| static constexpr u8 | NO_NOTE = 255 |