Class PitchGrid
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) is not maintained in this class, but has to be maintained by some outer software level, linking this instance to hardware etc.
"Base pitch" is not maintained in this class, but all pitch information is in indexes relative to a MIDI key number, maintained outside this class.
There are two ways of configuring:
- Initial configurations are created from scratch according to the above-listed parameters.
- Fixed mode derivations take the current state and alter it, according to one altered parameter, and aim at changing the MIDI key assignment as little as possible.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) PitchGrid.diatonicIntervals
Configuration parameter.(package private) Tabstaff.distance
(package private) boolean
Whether no fixed deriations have happend since the last initialization.(package private) boolean
(package private) final int[][]
Pitches are assigned to pads as numeric offsets to an arbitrary base pitch.(package private) final ScalaNumAbstrPOcts.Functio[][]
The roles of the pads are the roles of the assigned pitch (pitch offset) with respect to the current scale.(package private) ScalaNumAbstrPOcts
(package private) boolean
In chromatic mode, take five half-tone steps for a fourth, not considering the scale. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
void
deriveFixed_basePitch
(int diff) Change the base pitch in fixed mode.void
deriveFixed_distance
(Tabstaff.distance newDistance) In both modes all rows except the bottom row must be recalculated.void
deriveFixed_inKey
(boolean newInkey) When switching between diatonic and chromatic, all pads except at [1][1] must be recalculated.void
deriveFixed_scale
(ScalaNumAbstrPOcts newScale) Change the scale in fixed mode.int
getOffset
(int row, int column) getRole
(int row, int column) void
initPads
(boolean inKey, ScalaNumAbstrPOcts scale, Tabstaff.distance distance) Calculate the initial roles and pitch offsets of all squares.boolean
-
Field Details
-
inKey
boolean inKey -
scale
ScalaNumAbstrPOcts scale -
distance
Tabstaff.distance distance -
pitchOffsets
final int[][] pitchOffsetsPitches are assigned to pads as numeric offsets to an arbitrary base pitch. (This base pitch is maintained outside this instance.) The array is indexed by row and column, but zero based. (The "offical names" of rows and columns are one based!) -
roles
The roles of the pads are the roles of the assigned pitch (pitch offset) with respect to the current scale. The array is indexed by row and column. -
initial
boolean initialWhether no fixed deriations have happend since the last initialization. -
diatonicIntervalRule
PitchGrid.diatonicIntervals diatonicIntervalRuleConfiguration parameter. Can be overwritten on construction by "{{a=b;}}
". -
strictChromaticFourths
boolean strictChromaticFourthsIn chromatic mode, take five half-tone steps for a fourth, not considering the scale. Configuration parameter, can be overwritten on construction by "{{a=b;}}
".
-
-
Constructor Details
-
PitchGrid
public PitchGrid()
-
-
Method Details
-
getOffset
public int getOffset(int row, int column) -
getRole
-
isInitial
public boolean isInitial() -
initPads
Calculate the initial roles and pitch offsets of all squares. Parameters are inKey, scale, and (row) distance. Since in this class only relative indices are maintained, pitch is not a parameter, but the grid is initialized to start at offset = 0. The generated layout for distance=thirds and scale=major will be n chromatic mode / inKey = false:| |invalid input: '<'7> 8 invalid input: '<'9> 10 invalid input: '<'11>[12]13 (14) | |(4) (5) 6 invalid input: '<'7> 8 (9) 10 (11) | |[0] 1 (2) 3 (4) (5) 6 invalid input: '<'7> |_________________________________ with [w] = finalis,
and will be in iatonic mode / inKey = true := repercussa, (y) = inTonos, and z = extraTonos | |4 5 invalid input: '<'7> 9 11 [12] 14 16 | |[0] 2 4 5 invalid input: '<'7> 9 11 [12] |_________________________________ with [w] = finalis,
= repercussa, and y = inTonos. (Vertical mode and absolute pitch are maintained outside of this class.)
(The value of
invalid reference
#diatonicIntervals
- 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.
-
cacheRoles
void cacheRoles() -
deriveFixed_basePitch
public void deriveFixed_basePitch(int diff) Change the base pitch in fixed mode.In chromatic mode, all pads keep their pitch and only the highlighting / the scale roles must adopt.
In diatonic mode, additionally few or more pitches must be exchanged.
- Parameters:
diff
- the difference "oldBasePitch - newBasePitch". This will be added to all pads' values, so that "oldBasePitch + oldPadValue" gives the same MIDI key value as "newBasePitch + (oldPadValue + diff)".
-
deriveFixed_scale
Change the scale in fixed mode. All scales are always started at index=0.In chromatic mode, all pads keep their pitch and only the highlighting / the scale roles must adopt.
In diatonic mode, additionally few or more pitches must be exchanged.
- Parameters:
scale
- the new scale
-
deriveFixed_distance
In both modes all rows except the bottom row must be recalculated. (If the argument is already the current value, no change happens.) -
deriveFixed_inKey
public void deriveFixed_inKey(boolean newInkey) When switching between diatonic and chromatic, all pads except at [1][1] must be recalculated.
-