Class:            SymbolicPitch

Environment:      Siren
Superclass:         Siren.NominalMagnitude
Category:         Music-Models-Implementation
Instance variables:   fracPitch

Instances of SymbolicPitch represent well-tempered note names relative to a4=440Hz.
The range is c0 to g#9 and the values are symbols.
Note the confusion between the sharp sign (always placed after the note name) and Smalltalk's symbol key #.
One often writes ('c#3' asSymbol) to be safe.

Instance Variables:
   fracPitch the remainder for microtonal tunings

The class instance variable NameMap is used for the name <--> MIDI key number mapping array.

printing

printOn0: aStream
   Print the receiver as a symbolic pitch.

units
   Answer the units string of the receiver.

arithmetic

+ aValue
   Answer the sum of the receiver and the argument-handle adding Integers as a special case.

- aValue
   Answer the sum of the receiver and the argument-handle adding Integers as a special case.

transposeBy: aValue
   transpose a SymbolicPitch by aValue in fractional halfsteps

private

species
   Answer Pitch.

converting

asFracMIDI
   Assuming value is a symbolic note name, answer a key number.

asHertz
   assuming value is a symbolic note name, return a frequency

asHz
   assuming value is a symbolic note name, return a frequency

asMIDI
   Assuming value is a symbolic note name, answer a key number.

asSymbol
   Answer a SymbolicPitch.

mostGeneral
   Answer the most numerically meaningful version of the receiver.

accessing

accidental
   Answer the receiver's accidental, if any.

fracPitch
   return microtonal offset as fractions of a halfstep

fracPitch: aValue
   set microtonal offset as fractions of a halfstep

MetaClass:         SymbolicPitch class

class initialization

initialize
   Set up the class name mapping array.

instance creation

fromFracMIDI: aValue
   Assuming value is a key number, answer a symbolic pitch name

fromMIDI: aValue
   Assuming value is a key number, answer a symbolic pitch name

coercion

ddMsgName
   Answer the selector to be used in coercing double-dispatching messages.