arduino-audio-tools
Public Types | Public Member Functions | Protected Attributes | List of all members
MusicalNotes Class Reference

Determination of the frequency of a music note. More...

#include <MusicalNotes.h>

Public Types

enum  MusicalNotesEnum {
  C , CS , D , DS ,
  E , F , FS , G ,
  GS , A , AS , B
}
 Notes.
 

Public Member Functions

float frequency (MusicalNotesEnum note, uint8_t octave) const
 Determines the frequency of the indicate note and octave (0-8)
 
float frequency (uint16_t idx) const
 Determines the frequency of the indicate note index from 0 to 107.
 
int frequencyCount () const
 
int frequencyToMidiNote (float freq) const
 Provide MIDI note for frequency.
 
bool isAudible (float frequency) const
 Returns true if the frequency is audible (in the range of 20 Hz to 20 kHz)
 
float mainFrequency (uint64_t idx) const
 Determines the frequency of the indicate main note index from 0 to 62.
 
float mainFrequency (uint8_t mainNoteIdx, uint8_t octave) const
 Determines the frequency of the indicate main note index (0-6) and octave (0-8)
 
float midiNoteToFrequency (int x) const
 Determine frequency of MIDI note.
 
const char * note (float frequency) const
 Determines the closes note for a frequency.
 
const char * note (float frequency, float &diff) const
 Determines the closes note for a frequency. We also return the frequency difference.
 
const char * noteAt (int idx)
 Provides the note name for an index position.
 
float stkNoteToFrequency (int noteNumber) const
 

Protected Attributes

float notes [9][12]
 
const char * notes_str [9 *12]
 

Detailed Description

Determination of the frequency of a music note.

Author
Phil Schatzmann

Member Data Documentation

◆ notes

float notes[9][12]
protected
Initial value:
= {
{ 16.35f , 17.32f , 18.35f , 19.45f , 20.60f , 21.83f , 23.12f , 24.50f , 25.96f , 27.50f , 29.14f , 30.87f },
{ 32.70f , 34.65f , 36.71f , 38.89f , 41.20f , 43.65f , 46.25f , 49.00f , 51.91f , 55.00f , 58.27f , 61.74f },
{ 65.41f , 69.30f , 73.42f , 77.78f , 82.41f , 87.31f , 92.50f , 98.00f , 103.83f , 110.00f , 116.54f , 123.47f },
{ 130.81f , 138.59f , 146.83f , 155.56f , 164.81f , 174.61f , 185.00f , 196.00f , 207.65f , 220.00f , 233.08f , 246.94f },
{ 261.63f , 277.18f , 293.66f , 311.13f , 329.63f , 349.23f , 369.99f , 392.00f , 415.30f , 440.00f , 466.16f , 493.88f },
{ 523.25f , 554.37f , 587.33f , 622.25f , 659.25f , 698.46f , 739.99f , 783.99f , 830.61f , 880.00f , 932.33f , 987.77f },
{ 1046.5f , 1108.73f , 1174.66f , 1244.51f , 1318.51f , 1396.91f , 1479.89f , 1567.89f , 1661.22f , 1760.00f , 1864.66f , 1975.53f },
{ 2093.00f , 2217.46f , 2349.32f , 2489.02f , 2637.02f , 2793.83f , 2959.96f , 3135.96f , 3322.44f , 3520.00f , 3729.31f , 3951.07f },
{ 4186.01f , 4434.92f , 4698.63f , 4978.03f , 5274.04f , 5587.65f , 5919.91f , 6271.93f , 6644.88f , 7040.00f , 7458.62f , 7902.13f }
}

◆ notes_str

const char* notes_str[9 *12]
protected
Initial value:
= {
"C0","CS0","D0","DS0","E0","F0","FS0","G0","GS0","A0","AS0","B0",
"C1","CS1","D1","DS1","E1","F1","FS1","G1","GS1","A1","AS1","B1",
"C2","CS2","D2","DS2","E2","F2","FS2","G2","GS2","A2","AS2","B2",
"C3","CS3","D3","DS3","E3","F3","FS3","G3","GS3","A3","AS3","B3",
"C4","CS4","D4","DS4","E4","F4","FS4","G4","GS4","A4","AS4","B4",
"C5","CS5","D5","DS5","E5","F5","FS5","G5","GS5","A5","AS5","B5",
"C6","CS6","D6","DS6","E6","F6","FS6","G6","GS6","A6","AS6","B6",
"C7","CS7","D7","DS7","E7","F7","FS7","G7","GS7","A7","AS7","B7",
"C8","CS8","D8","DS8","E8","F8","FS8","G8","GS8","A8","AS8","B8"
}

The documentation for this class was generated from the following file: