Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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!

share|improve this question
What have you tried? –  Verbeia Feb 16 '13 at 13:24
Have you seen this?: –  Mr.Wizard Feb 18 '13 at 5:49

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}]]


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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