Skip to main content
1 of 8
DavidC
  • 25.4k
  • 2
  • 52
  • 105

#Mathematica 319

{x_, y_}~t~{c_, d_, e_} := c < x < d && e < y;
z@n_ := EmitSound@Sound[SoundNote[n, .3, 1]]; r = Rectangle; b = Black;
Dynamic@ClickPane[Graphics[Flatten@{White, EdgeForm@b, r[{0, 0}, {6, 9}], b, 
  Line[{{#, 0}, {#, 9}}] & /@ {2, 4, 6}, r[{.5 + #, 3}, {1.5 + #, 9}] & /@ {1, 3}}],
  z@Which[#~t~{1.5, 2.5, 3}, "C#", #~t~{3.5, 4.5, 3}, "D#", #~t~{0, 2, 0}, "C", 
  #~t~{2, 4, 0}, "D", True, "E"] &]

keyboard

DavidC
  • 25.4k
  • 2
  • 52
  • 105