Classes | Functions

/Users/garethloy/Musimathics/Musimat1.2/include/Pitch.h File Reference

The Pitch class. More...

#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)

Detailed Description

The Pitch class.

Definition in file Pitch.h.


Function Documentation

Integer Accidental ( Pitch  p ) [inline]

The accidental of a pitch.

Parameters:
pPitch
Returns:
Accidental of a Pitch as an Integer

Definition at line 548 of file Pitch.h.

References Pitch::accidental(), and Return.

{
        Return p.accidental();
}
Real KeyToHertz ( Integer  i ) [inline]

Return the frequency of a key index.

Parameters:
iKey index
Returns:
The frequency of the corresponding 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) ) );
}
Pitch Mod ( Pitch  p,
Integer  len 
) [inline]

Definition at line 611 of file Pitch.h.

References Return.

{
        Return( p % len );
}
Integer Octave ( Integer  i ) [inline]

Finds the corresponding octave of a key index.

Parameters:
iKey index
Returns:
The octave of the corresponding key index

Definition at line 572 of file Pitch.h.

References Return.

Referenced by KeyToHertz().

{
        Return( (i - 3) / 12 + 1 ); 
}
Integer Octave ( Pitch  p ) [inline]

Returns the octave of a Pitch.

Parameters:
pPitch
Returns:
The octave of the corresponding Pitch

Definition at line 580 of file Pitch.h.

References Pitch::octave(), and Return.

{
        Return( p.octave() ); 
}
Integer PitchClass ( Pitch  p ) [inline]

Finds the corresponding pitch class of a Pitch.

Parameters:
pPitch
Returns:
The pitch class of the corresponding Pitch

Definition at line 564 of file Pitch.h.

References Pitch::pitchClass(), and Return.

{
        Return( p.pitchClass() ); 
}
Integer PitchClass ( Integer  i ) [inline]

Finds the corresponding pitch class of a key index.

Parameters:
iKey index
Returns:
The pitch class of the corresponding key index

Definition at line 556 of file Pitch.h.

References Mod(), and Return.

Referenced by KeyToHertz().

{
        Return( Mod( (i - 3), 12 ) ); 
}
Real PitchToHertz ( Pitch  p ) [inline]

Return the frequency of a Pitch.

Parameters:
pKey index
Returns:
The frequency of the corresponding key index

Definition at line 588 of file Pitch.h.

References Pitch::hertz(), and Return.

{
        Return( p.hertz() );
}
Void SetDegrees ( Integer  ref ) [inline]

Set the number of degrees used globally by Pitch.

Parameters:
ref# of degrees

Definition at line 606 of file Pitch.h.

References Pitch::SetDegrees().