So here is my code:

   Manipulate[
whitekey[note_, oct_] := 
Mouseover[
Graphics[{{EdgeForm[], White, 
  Rectangle[{0, 0}, {1, 
    2}]}, {Line[{{0, 2}, {0, 0}, {1, 0}, {1, 2}}]}, 
 If[shownotes, 
  Text[Style[note <> ToString[oct], 10, "Label"], {0.5, 1}], {}]},
 ImageSize -> {22, 41}, PlotRange -> {{-0.01, 1.01}, {-0.05, 2}}, 
ImageMargins -> 0], 
EventHandler[
 Dynamic[Graphics[{{EdgeForm[], , 
    Rectangle[{0, If[dwn, 0.15, 0]}, {1, 2}]}, 
   Line[{{0, 2}, {0, If[dwn, 0.15, 0]}, {1, If[dwn, 0.15, 0]}, {1,
       2}}], If[shownotes, 
    Text[Style[note <> ToString[oct], If[dwn, 9, 10], 
      "Label"], {0.5, If[dwn, 1.1, 1]}], {}]}, 
  ImageSize -> {22, 41}, PlotRange -> {{-0.01, 1.01}, {-0.05, 2}},
   ImageMargins -> 0]], {"MouseDown" :> (dwn = True; 
   EmitSound[Sound[SoundNote[StringJoin[note, ToString[oct]]]]]), 
  "MouseUp" :> (dwn = False)}]];
space[wd_] := 
Graphics[{White, Rectangle[{0, 0}, {wd, 1}]}, 
ImageSize -> {wd, Automatic}, PlotRange -> {{0, 0}, {2.5, 5}}, 
ImageMargins -> 0];
vert := Graphics[Line[{{0, 0}, {0, 1}}], 
PlotRange -> {{-0.001, 0.001}, {0, 1}}, ImageSize -> {2, 60}, 
ImageMargins -> 0];
whiteset[oct_] := 
Grid[{Flatten[
 Map[(whitekey[#, oct]) &, {"C", "D", "E", "F", "G", "A", "B"}]]},
Spacings -> 0];
keyboardsplit[octlow_, octhigh_] := 
Column[Reverse@{Grid[{Flatten[Table[whiteset[i], {i, octlow, 4}]]}, 
  Spacings -> {"Columns" -> {{0}}, "Rows" -> {{-0.1}}}, 
  Alignment -> {"Columns" -> {{Left}}, "Rows" -> {{Top}}}], 
  Grid[{Flatten[Table[whiteset[i], {i, 5, octhigh}]]}, 
  Spacings -> {"Columns" -> {{0}}, "Rows" -> {{-0.1}}}, 
  Alignment -> {"Columns" -> {{Left}}, "Rows" -> {{Top}}}]}];
Deploy[keyboardsplit[2, 7]], {{shownotes, False, 
"show notes"}, {True, False}}, 
TrackedSymbols :> {begoct, endoct, shownotes}, 
Initialization :> {dwn = False}]

Now i am stuck, because i want to record each note i have pressed and i can not find any solution online or maybe there is a different method to get it work?

New contributor
Julies is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 3
    So what is this question about? – David G. Stork yesterday
  • 1
    Please include a plain English description of what you want to do, not just code. I expect most people would be unwilling to run and examine your code just to be able to understand what the question is. – Szabolcs yesterday

Your Answer

Julies is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.