Take the 2-minute tour ×
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

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!

share
4  
What have you tried? –  Verbeia Feb 16 '13 at 13:24
    
Have you seen this?: library.wolfram.com/infocenter/MathSource/798 –  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...)

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

   }]


 }
share

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .