C:/Musimathics_local/Musimat/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 class implements a set of data types, conversions, and operations for musical pitches, scales, and tuning systems. 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:
p Pitch
Returns:
Accidental of a Pitch as an Integer

Definition at line 527 of file Pitch.h.

References Pitch::accidental(), and Return.

00528 {
00529         Return p.accidental();
00530 }

Real KeyToHertz ( Integer  i  )  [inline]

Return the frequency of a key index.

Parameters:
i Key index
Returns:
The frequency of the corresponding key index

Definition at line 575 of file Pitch.h.

References Pitch::HzReference(), Octave(), PitchClass(), and Return.

00576 {
00577         Real R = Pitch::HzReference();
00578         Integer k = PitchClass( i );
00579         Integer o = Octave( i );
00580         Return( R * pow(2, ( (o - 4) + k / 12) ) );
00581 }

Pitch Mod ( Pitch  p,
Integer  len 
) [inline]

Definition at line 590 of file Pitch.h.

References Return.

00591 {
00592         Return( p % len );
00593 }

Integer Octave ( Pitch  p  )  [inline]

Returns the octave of a Pitch.

Parameters:
p Pitch
Returns:
The octave of the corresponding Pitch

Definition at line 559 of file Pitch.h.

References Pitch::octave(), and Return.

00560 {
00561         Return( p.octave() ); 
00562 }

Integer Octave ( Integer  i  )  [inline]

Finds the corresponding octave of a key index.

Parameters:
i Key index
Returns:
The octave of the corresponding key index

Definition at line 551 of file Pitch.h.

References Return.

Referenced by KeyToHertz().

00552 {
00553         Return( (i - 3) / 12 + 1 ); 
00554 }

Integer PitchClass ( Pitch  p  )  [inline]

Finds the corresponding pitch class of a Pitch.

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

Definition at line 543 of file Pitch.h.

References Pitch::pitchClass(), and Return.

00544 {
00545         Return( p.pitchClass() ); 
00546 }

Integer PitchClass ( Integer  i  )  [inline]

Finds the corresponding pitch class of a key index.

Parameters:
i Key index
Returns:
The pitch class of the corresponding key index

Definition at line 535 of file Pitch.h.

References Mod(), and Return.

Referenced by KeyToHertz().

00536 {
00537         Return( Mod( (i - 3), 12 ) ); 
00538 }

Real PitchToHertz ( Pitch  p  )  [inline]

Return the frequency of a Pitch.

Parameters:
p Key index
Returns:
The frequency of the corresponding key index

Definition at line 567 of file Pitch.h.

References Pitch::hertz(), and Return.

00568 {
00569         Return( p.hertz() );
00570 }

Void SetDegrees ( Integer  ref  )  [inline]

Set the number of degrees used globally by Pitch.

Parameters:
ref # of degrees

Definition at line 585 of file Pitch.h.

References Pitch::SetDegrees().

00586 {
00587         Pitch::SetDegrees(ref); 
00588 }


Generated on Fri Sep 8 23:21:11 2006 for MusimatLib by  doxygen 1.4.7