Package eu.bandm.music.entities
Class Keyboard
java.lang.Object
eu.bandm.music.entities.Keyboard
Models the mapping of Functional Pitches to a standard keyboard layout.
In that, one single key stands for multiple pitches. One key is represented
by some integer numeric value. This model is totally arbitrary,
but follows here the MIDI definition for convenience.
(The range limits of the MIDI definition are not respected,
only the positioning.)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Distance to add to a calculated index ot get the MIDI key number. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
Deliver an index into the keyboard for the given FunctionalPitch.static FunctionalPitch
pitchByKey
(int keyNumber, TwelveToneFunctionalRepresentation rep) Deliver a functional pitch which is represented by this key.
-
Field Details
-
midiKeyOffset
public static final int midiKeyOffsetDistance to add to a calculated index ot get the MIDI key number.Numeric value of "small" octave, as defined in
OctaveRegister
is zero. Numeric value i.e. @link{FunctionalPitchModOctave#get_halfTonesFromC()}, is zero for c."c-one" (= MIDI "C4") has the midi-key value of decimal 60. This leads to the formula "HalftonesFromC + Octave * 12 +
midiKeyOffset
", with midiKeyOffset == 48 .(Using the MIDI encoding for octave numbers, the offset would only be 12, because MIDI "C1" = "kontra-C" = key 24 and not = 12.)
- See Also:
-
-
Constructor Details
-
Keyboard
public Keyboard()
-
-
Method Details
-
keyNumber
Deliver an index into the keyboard for the given FunctionalPitch. Being in principle totally arbitrary, this implementation follows the Midi numbering scheme. -
pitchByKey
Deliver a functional pitch which is represented by this key.- Parameters:
keyNumber
- the number of this keyrep
- a mapping of the chromatic scale 0..11 of keys starting with "c" to pitch classes.
-