Two options:
You can access the 2D array directly. But then you need to compensate for the “starts indexing at 0” thing.
Or you use a helper function and pass in what positions you want, and the helper function compensates for the indexing.
byte[][] chordBank2 = new byte[8][6];
void setup() {
chordBank2[0] = new byte[] {40, 45, 50, 55, 59, 64}; // open strings
chordBank2[1] = new byte[] {40, 47, 52, 56, 59, 64}; // E major
chordBank2[2] = new byte[] {41, 48, 53, 57, 60, 65}; // F major
chordBank2[3] = new byte[] {43, 47, 50, 55, 59, 67}; // G major
chordBank2[4] = new byte[] {33, 45, 52, 57, 61, 64}; // A major
chordBank2[5] = new byte[] {35, 47, 54, 59, 63, 66}; // B major
chordBank2[6] = new byte[] {36, 48, 52, 55, 60, 64}; // C major
chordBank2[7] = new byte[] {38, 50, 57, 62, 66, 69}; // D major
}
void draw() {
// access 2D array directly, need to think in indexes
int aSingleNote = chordBank2[6][3]; // from the 7th chord (6th index), get the 4th note (3rd index)
println("Direct note get: "+ aSingleNote);
// via a function
int anotherSingleNote = getNote(7,4); // from the 7th chord, get the 4th note
println("Function note get: "+anotherSingleNote);
stop();
}
int getNote(int chordNum, int noteNum) {
return chordBank2[chordNum-1][noteNum-1];
}