P.40 (How about Notes?)


private String[] whiteKeys
   = { "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "\\" };

private String[] whiteNotes
   = { "3c", "3d", "3e", "3f", "3g", "3a", "3b", "4c", "4d", "4e", "4f", "4g" };	

public Piano() {
  super(800, 340, 1);
  for(int i=0; i<12; i++)
    addObject( new Key(whiteKeys[i], whiteNotes[i] + ".wav"), 22 + 32 + i*63, 140 );
}
Last modified on
Engineering DIY Workshop 2018