Class PitchKeyGrid
java.lang.Object
eu.bandm.music.applications.tabstaff.PitchKeyGrid
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
The roles of a pad in a particular interpretation of the grid, when this assigns MIDI note on/off events.(package private) class
(package private) class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) EnumMap
<ScalaNumAbstrPOcts.Functio, Color> (package private) PitchAndOctave
<OctaveRegister, FunctionalPitchModOctave> (package private) int
(package private) Tabstaff.distance
(package private) final DoubleEnvelope
Envelope curve for the function generator output.(package private) final DoubleSignalSource
(package private) double
static final float
Frequency factor of a halftone in equal distance tempered tuning.(package private) boolean
(package private) final int
Depends on the OPERATING SYSTEM !!(package private) final IntPost
(package private) final int[][]
Pitches are assigned to pads as numeric offsets to an arbitrary root pitch.(package private) final DoublePost
(package private) final EnumPost
<Tabstaff.distance> (package private) final BooleanPost
(package private) final BooleanPost
(package private) final Post
<OctaveRegister> (package private) final Post
<FunctionalPitchModOctave> (package private) final Post
<ScalaNumAbstrPOcts> (package private) final DoublePost
(package private) final ConstantRealtimeContext
Evident.(package private) final ScalaNumAbstrPOcts.Functio[][]
The roles of the pads will be represented by the color of their representation.(package private) static final double
Evident.(package private) ScalaNumAbstrPOcts
(package private) @Opt PitchKeyGrid.SwingPads
(package private) static final int
Wavetable size for the function generator.(package private) final JTextField
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
void
changeFixed_chromatic_distance
(Tabstaff.distance newDistance) void
changeFixed_chromatic_root
(int newRoot) Change only the root and keep the scale = highlighting.void
Change only the interpretation of the chromatic scale.void
changeFixed_diatonic_distance
(Tabstaff.distance newDistance) Cannot do any better than to calculate the layout anew, keeping only the lowest row.void
changeFixed_diatonic_scaleAndRoot
(ScalaNumAbstrPOcts newScale, int newRoot) void
changeFixed_inKey
(boolean inKey) Change the "InKey" mode.void
Keep all start values of all rows and let them run chromatically.void
Compactify all rows to contain only diatonic keys.(package private) void
int
getMidi
(int row, int col) (package private) PitchAndOctave
<OctaveRegister, FunctionalPitchModOctave> getPitch()
(package private) void
initPads
(boolean inKey, ScalaNumAbstrPOcts scale, Tabstaff.distance distance, int startIndex) Calculate the initial roles and pitch offsets of all squares.static void
(package private) void
reInit()
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
".(package private) void
setFrequencyToMidi
(int i) (package private) void
setMidiReceiver
(Receiver rec) (package private) void
setSoundChannels
(Transmitter midiIn, SourceDataLine sdl) (package private) void
(package private) DoubleBufferedProducer
sound()
Sound generating network.(package private) void
Make visible representations (Swing graphics and hardware) up-to-date after the configuration has been modified.(package private) void
(package private) void
(package private) void
(package private) static void
-
Field Details
-
inKey
boolean inKey -
scale
ScalaNumAbstrPOcts scale -
distance
Tabstaff.distance distance -
basePitch_midiOffset
int basePitch_midiOffset -
swingPads
-
midiReceiver
-
postLanguage
-
postInKey
-
postScale
-
textScale
-
postDistance
-
postOctave
-
postPc
-
pitchBase
-
postFixed
-
postVolume
-
postBrightness
-
pitchOffsets
final int[][] pitchOffsetsPitches are assigned to pads as numeric offsets to an arbitrary root pitch. That is given as MIDI key number = a special role of a natural number, but added afterwards and not resepected in the values of this array. 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 will be represented by the color of their representation. The array is indexed by row and column. -
basePitch
PitchAndOctave<OctaveRegister,FunctionalPitchModOctave> basePitch -
backgroundColors
EnumMap<ScalaNumAbstrPOcts.Functio,Color> backgroundColors -
SAMPLINGRATE
static final double SAMPLINGRATEEvident.- See Also:
-
realtimeContext
Evident. -
TABLE_SIZE
static final int TABLE_SIZEWavetable size for the function generator.- See Also:
-
envPizzicato
Envelope curve for the function generator output. -
frq
double frq -
frequency
-
HALFTONE
public static final float HALFTONEFrequency factor of a halftone in equal distance tempered tuning. -
maxBufferSize
final int maxBufferSizeDepends on the OPERATING SYSTEM !!- See Also:
-
-
Constructor Details
-
PitchKeyGrid
public PitchKeyGrid()
-
-
Method Details
-
updateTextScale
void updateTextScale() -
getPitch
PitchAndOctave<OctaveRegister,FunctionalPitchModOctave> 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
-
setSwingPads
-
initPads
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
Change only the interpretation of the chromatic scale. Change only the highlighting = role, not the pitch values. -
changeFixed_chromatic_distance
-
changeFixed_diatonic_scaleAndRoot
-
changeFixed_diatonic_distance
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
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
DoubleBufferedProducer sound()Sound generating network. -
setFrequencyToMidi
void setFrequencyToMidi(int i) - Parameters:
i
- = coordinate of the pad.
-
triggerEnv
void triggerEnv() -
setSoundChannels
-
main
-
writeln
-