Class PitchKeyGrid

java.lang.Object
eu.bandm.music.applications.tabstaff.PitchKeyGrid

public class PitchKeyGrid extends Object
Represents the assigment of the 8x8 "Ableton Push"-style grid of keys to pitch codes and diatonic roles. The pitches (encoded as MIDI key numbers) are used when some hardware device is used for input; the roles are used for coloring the hardware pads.

Initial configuration parameters are:

  • Diatonic or Chromatic mode ("InKey" mode)
  • Scale = distance of diatonic pitches.
  • Distance from row to next row (diatonic third, diatonic fourth, or sequential)
  • Orientation (horizontal vs vertical)
  • Root pitch (from enharmonic pitches)

When the meta-parameter "fixed" is true, then changes of the parameters can lead to pitch distributions which differ from the initial configurations, esp. w.r.t. the role and pitch of pad (1,1).

Vertical orientation is currently not supported.

  • Field Details

  • Constructor Details

    • PitchKeyGrid

      public PitchKeyGrid()
  • Method Details

    • updateTextScale

      void updateTextScale()
    • getPitch

    • changePitch

      void changePitch()
    • updateLanguage

      void updateLanguage()
    • reInit

      void reInit()
    • syncVisuals

      void syncVisuals()
      Make visible representations (Swing graphics and hardware) up-to-date after the configuration has been modified.
    • setMidiReceiver

      void setMidiReceiver(Receiver rec)
    • setSwingPads

      void setSwingPads(PitchKeyGrid.SwingPads p)
    • initPads

      void initPads(boolean inKey, ScalaNumAbstrPOcts scale, Tabstaff.distance distance, int startIndex)
      Calculate the initial roles and pitch offsets of all squares. This method only constructs horizontal layout; vertical layout can be constructed easily by post-processing = mirroring. The root pitch is not contained in the configuration but added externally.
      Parameters:
      scale - classifies relative indices modulo 12.
      distance - how the leftmost pad in each row is related to the leftmost pad one row higher/lower.
      startIndex - for initial layouts always == 0, but in "Fixed" mode it can differ.
    • cacheRoles

      void cacheRoles()
    • changeFixed_chromatic_root

      public void changeFixed_chromatic_root(int newRoot)
      Change only the root and keep the scale = highlighting. Since the root changes but the MIDI pitches per pad shall stay, the stored indexes must be adjusted.
    • changeFixed_chromatic_scale

      public void changeFixed_chromatic_scale(ScalaNumAbstrPOcts newScale)
      Change only the interpretation of the chromatic scale. Change only the highlighting = role, not the pitch values.
    • changeFixed_chromatic_distance

      public void changeFixed_chromatic_distance(Tabstaff.distance newDistance)
    • changeFixed_diatonic_scaleAndRoot

      public void changeFixed_diatonic_scaleAndRoot(ScalaNumAbstrPOcts newScale, int newRoot)
    • changeFixed_diatonic_distance

      public void changeFixed_diatonic_distance(Tabstaff.distance newDistance)
      Cannot do any better than to calculate the layout anew, keeping only the lowest row.
    • changeFixed_inKey

      public void changeFixed_inKey(boolean inKey)
      Change the "InKey" mode.
    • changeFixed_to_diatonic

      public void changeFixed_to_diatonic()
      Compactify all rows to contain only diatonic keys. Attention: The distance may change erratically.
    • changeFixed_to_chromatic

      public void changeFixed_to_chromatic()
      Keep all start values of all rows and let them run chromatically.
    • getMidi

      public int getMidi(int row, int col)
    • setMidiBase

    • sendToMidiDevice

      public void sendToMidiDevice(Receiver rec)
      Novation Launchpad Mini - Programmers Reference Manual.pdf "The Channel [on wire 0x0] specifies the lighting mode (static), the Note number the pad to light, [..], the Velocity the colour."
      -- or ---
      "F0h 00h 20h 29h 02h 0Dh 03h <colourspec>+ F7h"
      colourspec = 3 N R G B
      Before do:
      "F0h 00h 20h 29h 02h 0Dh 10h <mode> F7h".
      "mode" means DAW mode false/true.
      Before do:
      "F0h 00h 20h 29h 02h 0Dh 00h 7Fh F7h" = switch to programmers mode.
    • sound

      Sound generating network.
    • setFrequencyToMidi

      void setFrequencyToMidi(int i)
      Parameters:
      i - = coordinate of the pad.
    • triggerEnv

      void triggerEnv()
    • setSoundChannels

      void setSoundChannels(Transmitter midiIn, SourceDataLine sdl)
    • main

      public static void main(String[] args)
    • writeln

      static void writeln(String s)