[jmsl] StartPlayables and Midi damper pedal

Java Music Specification Language jmsl at music.columbia.edu
Fri Dec 9 16:14:25 EST 2011


Here's a practical use for Playables in a JMSL hierarchy. This example 
fell out of a conversation I had with one of my students just now.

See jmslexamples.simple.MidiSong, which plays a verse and a chorus 
repeatedly.

Insert the following code excerpt and the verse will play with sustain 
pedal on and the chorus will play with it off.

Note that 64 is the Midi control change for damper pedal. Here I send 
value=70 to turn sustain on (anything GE 64 will do) , and 40 to turn it 
off (anything LE 63 will do)

*verse.addStartPlayable(new Playable() {

             public double play(double time, Composable parent) throws 
InterruptedException {
                 System.out.println("Sending control change to turn 
sustain pedal ON in the verse");
                 JMSL.midi.control(time, 1, 64, 70);
                 return time;
             }
         });
         chorus.addStartPlayable(new Playable() {

             public double play(double time, Composable parent) throws 
InterruptedException {
                 System.out.println("Sending control change to turn 
sustain pedal OFF in the chorus");
                 JMSL.midi.control(time, 1, 64, 40); *
*                return time;
             }
         });*


This little tidbit brought to you by...
Nick Didkovsky


More information about the jmsl mailing list