#include <stdio.h>#include <stdlib.h>#include <iostream>#include <math.h>Go to the source code of this file.
Classes | |
| class | Pitch |
| Pitch implements representation and manipulation of musical pitches. More... | |
Functions | |
| Integer | Accidental (Pitch p) |
| The accidental of a pitch. | |
| Integer | PitchClass (Integer i) |
| Finds the corresponding pitch class of a key index. | |
| Integer | PitchClass (Pitch p) |
| Finds the corresponding pitch class of a Pitch. | |
| Integer | Octave (Integer i) |
| Finds the corresponding octave of a key index. | |
| Integer | Octave (Pitch p) |
| Returns the octave of a Pitch. | |
| Real | PitchToHertz (Pitch p) |
| Return the frequency of a Pitch. | |
| Real | KeyToHertz (Integer i) |
| Return the frequency of a key index. | |
| Void | SetDegrees (Integer ref) |
| Set the number of degrees used globally by Pitch. | |
| Pitch | Mod (Pitch p, Integer len) |
The Pitch class.
Definition in file Pitch.h.
The accidental of a pitch.
| p | Pitch |
Definition at line 548 of file Pitch.h.
References Pitch::accidental(), and Return.
{
Return p.accidental();
}
Return the frequency of a key index.
| i | Key index |
Definition at line 596 of file Pitch.h.
References Pitch::HzReference(), Octave(), PitchClass(), and Return.
{
Real R = Pitch::HzReference();
Integer k = PitchClass( i );
Integer o = Octave( i );
Return( R * pow(2.0, ( (o - 4) + k / 12) ) );
}
Finds the corresponding octave of a key index.
| i | Key index |
Definition at line 572 of file Pitch.h.
References Return.
Referenced by KeyToHertz().
{
Return( (i - 3) / 12 + 1 );
}
Finds the corresponding pitch class of a Pitch.
| p | Pitch |
Definition at line 564 of file Pitch.h.
References Pitch::pitchClass(), and Return.
{
Return( p.pitchClass() );
}
| Void SetDegrees | ( | Integer | ref ) | [inline] |
Set the number of degrees used globally by Pitch.
| ref | # of degrees |
Definition at line 606 of file Pitch.h.
References Pitch::SetDegrees().
{
Pitch::SetDegrees(ref);
}
1.7.2