There is a demostration project


where you can compose Western music using a 97 keys simulated midi keyboard. I study eastern and ancient music and harmony. So I can not use SoundNote for this kind of music (where each note is represented as a fraction. Using middle Do as a base (i.e., base = 260.741 Hz), the next notes are represented by re = 9/8 base, mi = 5/4 base, fa = 4/3 base, sol = 3/2 base, la = 3/2 9/8, si=3/2 5/4)

So my problem is to change the above keyboard so that

  1. the keys have pitches defined using some fractions like the ones mentioned above

  2. The user could simultaneously use his/her computer keyboard with the midi keyboard for music synthesis and polyphony.

For example:

While simultaneously pressing R on computer keyboard and midi button fa on the Mathematica Midi Keyboard the user could hear re + fa continuously (or at least as long as the R key and fa button are pressed.). But when R is released (and midi button fa is still pressed) only fa will be heard.

Some help, please!


1 Answer 1


This is my partial solution. (I do not know how to handle computer keyboard key pressings...)



    EmitSound[killsound]&&EmitSound[Play[Sin[ base 2Pi x],{x,0,3}]]
 EventHandler[Style[Button[Framed["re"]]],{"MouseClicked"¦EmitSound[killsound]&&EmitSound[Play[Sin[re  2Pi x],{x,0,3}]]
    EmitSound[killsound]&&EmitSound[Play[Sin[mi  2Pi x],{x,0,3}]]

 EventHandler[Style[Button[Framed["fa"]]],{"MouseClicked"¦EmitSound[killsound]&&EmitSound[Play[Sin[fa  2Pi x],{x,0,3}]]
 EventHandler[Style[Button[Framed["sol"]]],{"MouseClicked"¦EmitSound[killsound]&&EmitSound[Play[Sin[sol 2Pi x],{x,0,3}]]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.