Class Keyboard

java.lang.Object
eu.bandm.music.entities.Keyboard

public class Keyboard extends Object
Models the mapping of Functional Pitches to a standard Keyboard structure. 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 Details

    • midiKeyOffset

      public static final int midiKeyOffset
      Numeric value of "small" octave, as defined in OctaveRegister is "0(zero").
      Numeric value i.e. @link{FunctionalPitchModOctave#get_halfTonesFromC()}, is "0(zero") for c.
      "c-one" has the midi-key value of decimal 60. This leads to the formula "HalftonesFromC + Octave * 12 + midiKeyOffset", with midiKeyOffset == 48 .

      Attention: Using the MIDI encoding for octaves this offset is 12, because MIDI "C1" = "contra-C" = key 24.

      See Also:
  • Constructor Details

    • Keyboard

      public Keyboard()
  • Method Details

    • keyNumber

      public static int keyNumber(PitchAndOctave<OctaveRegister,FunctionalPitchModOctave> po)
      Deliver an index into the keyboard for the given FunctionalPitch. Being in principle totally arbitrary, this implementation follows the Midi numbering scheme.
    • pitchByKey

      public static FunctionalPitch pitchByKey(int keyNumber, TwelveToneFunctionalRepresentation rep)
      Deliver a functional pitch which is represented by this key.
      Parameters:
      keyNumber - the number of this key
      rep - a mapping of the chromatic scale 0..11 of keys starting with "c" to pitch classes.