4
$\begingroup$

There is a demostration project

http://demonstrations.wolfram.com/KeyboardAndComposer/

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!

$\endgroup$
2
$\begingroup$

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

 killsound:=EmitSound[SampledSoundList[{0.},8000],"Preemptive"];
{

 EventHandler[Style[Button[Framed["do"]]],{"MouseClicked"¦

    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}]]
   }],
 EventHandler[Style[Button[Framed["mi"]]],{"MouseClicked"¦
    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}]]

   }]


 }
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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