Class: PitchClass

Environment: Siren
Superclass: Object
Category: Music-PitchClasses
Class variables: A AllNatural AllNotes B C D E English F G

Instances of (subclasses of) this class represent pitch-classes.
A pitch class is an octave-independent note.
There are 35 (sub) instances of this class.
Octave-dependent notes are represented by instances of class
OctaveDependentNote.
Ideally PitchClass should be a metaclass, so that its instances
be classes, and octave-dependent notes could then be instances
of pitchClasses !!
Unfortunately this is not possible straightforwadly in Smaltalk, so we
use aggregation instead to represent octave-dependent notes

private intervals

descendingNumberOfSemiTonesBetween: aNote
Important method in the theory. It is a 3-stage computation of the interval between 2 notes

descendingSemiTonesToNatural

intervalBetween: aNote
returns the interval between the two notes

intervalTypeBetween: aNote
returns the interval between the two notes

nthFollowing: i
returns the i th natural note following self

nthPreceding: i
returns the i th natural note preceding self

numberOfSemiTonesBetween: aNote
Important method in the theory. It is a 3-stage computation of the interval between 2 notes

semiToneCount

smallestIntervalBetween: aNote
returns the descending interval between the two notes

public intervals

alterate: note toReach: i

alterateBelow: note toReach: i

augmentedEleventh

augmentedFifth

augmentedFourth

augmentedNinth

augmentedSecond

augmentedUnison

diminishedFifth

diminishedNinth

diminishedSecond

diminishedSeventh

diminishedThirteenth

eleventh

fifth

flatFifth

flatNinth

flatThirteenth

fourth

majorNinth

majorSecond

majorSeventh

majorSixth

majorThird

majorThirteenth

minorNinth

minorSecond

minorSeventh

minorSixth

minorThird

minorThirteenth

ninth

octave

perfectEleventh

perfectFifth

perfectFourth

second

seventh

sixth

thirteenth

unison

testing

isDoubleFlat

isDoubleSharp

isFlat

isNatural

isSharp

pitchEqual: aNote

chord creation

chordFromTokens: st

majorTriad

minorTriad

mutations

@ o

chordFromString: st

inTessitura: qualTessitura
N C pitchInTessitura: QTessitura high

octave: o

scales

chromaticScale

harmonicMinorScale

majorScale

melodicMinorScale

minorScale

pseudoMinorScale

making octave-dep notes

downAndUpOctaves: odNote
returns two octave dependent notes of self who are repectively
lower and higher than the given odNote

pitchBetween: n1 and: n2
return, if it exists, a pitch (octave dependent note) between the two given notes

the: nb octavesBeginningFrom: initialOctave
N D the: 3 octavesBeginningFrom: 0

access

doubleFlat

doubleSharp

natural

pitchClass

saving

representBinaryOn: s
to ensure uniqueness, pitch classes save themselves as messages sent
to the appropriate class, so that no duplicate are created

printing

printOn: s

storeOn: s
N C storeString

transpose

transposeOf: anInterval
three cases: integer (+/-), method name (= ascending interval), or interval
object

constraining

intervalTypeModuloOctaveBetween: n

Paleo

copy

nameInScale: aScale

MetaClass: PitchClass class

initialization

englishOrFrench

initialize
There are 35 pitch classes. That's too much for Squeak, so the method was split into two methods

initializeAllNaturalNotes

initializeClass
There are 35 pitch classes. That's too much for Squeak, so the method was split into two methods

initializeDoubleFlat

initializeFrenchNames

initializeGlobals

global access

A

allNotesButDoubles

allPlausibleRootNotes

allPlausibleRootsForMajorScales
self allPlausibleRootsForMajorScales

allPlausibleRootsForMinorScales
self allPlausibleRootsForMinorScales

B

C

D

do

E

F

fa

flatNotes

fromSemiTones: n
arbitrary method, used for transposing pitch classes (a strange notion...)

G

la

mi

naturalNotes

noteNamed: c
takes the case of flat into account. Sharps are naturally parsed out
from the note name by the smalltalk parser.
Since the algorithm proceeds from the left, it accepts any number of sharps and flats (using the common algebra) :
N noteNamed: 'C#b#b#b#' -> C#

re

sharpNotes

si

sol

vocal ranges

altoRange
retourne la collection des notes de l'alto

altoRangeInScale: aScale
PitchClass sopranoRangeInScale: (N do sharp minorScale)

baseRange
retourne la collection des notes de la basse

baseRangeInScale: aScale
PitchClass sopranoRangeInScale: (N do sharp minorScale)

sopranoRange
retourne la collection des notes du soprano

sopranoRangeInScale: aScale
PitchClass sopranoRangeInScale: (N do sharp minorScale)

tenorRange
retourne la collection des notes du tenor

tenorRangeInScale: aScale
PitchClass sopranoRangeInScale: (N do sharp minorScale)

ordering

flatOrdering

nFirstFlats: n
PitchClass nFirstFlats: 3

nFirstSharps: n
PitchClass nFirstSharps: 3

sharpOrdering

examples

chordExamples
N C sharp chordFromString: '' -> [C# ]

(N C sharp chordFromString: 'min 7 dim5') notes -> OrderedCollection (C# E G B )

closestEnharmonic
N D sharp closestEnharmonic Eb
N E flat closestEnharmonic D#

N B sharp closestEnharmonic C
N C flat closestEnharmonic D#

N D sharp sharp closestEnharmonic E
N E flat flat closestEnharmonic D
------
(N D sharp @ 2) closestEnharmonic Eb2
(N E flat @ 2) closestEnharmonic D#2

(N B sharp @ 2) closestEnharmonic C3
(N C flat @ 3) closestEnharmonic B2

majorScaleExample
PitchClass B majorScale notes- > #(B C# D# E F# G# A# )

melodicMinorScaleExample

minorScaleExample

pitchInTessituraExamples
N C pitchInTessitura: QTessitura high -> C5
N A pitchInTessitura: QTessitura high -> A4
N G pitchInTessitura: QTessitura high -> G4
N F pitchInTessitura: QTessitura high -> F5

N A pitchInTessitura: QTessitura low -> A2

sharpflatAlgebraExample
sharp and flat's algebra
N C sharp ->Do#
N C sharp sharp ->Do##
N C sharp sharp sharp ->error
N C flat sharp -> Do
N re sharp sharp natural -> re

Intervals computation :
N C diminishedFifth -> Solb
N C augmentedFourth -> Fa#
N C diminishedThirteenth -> Lab
N C flat minorSeventh -> Sibb
N C majorThird majorThird -> Sol#
Notes equivalence : pitchEgal methode
N C sharp pitchEqual: N re flat -> true
N C augmentedFourth pitchEqual: N C diminishedFifth -> true
N C diminishedFifth pitchEqual: N F minorSecond -> true