All pastes #214902 Raw Edit

Stuff

public text v1 · immutable
#214902 ·published 2006-10-22 08:26 UTC
rendered paste body
import javax.sound.midi.*;

class SoundTest
{
   public static void main(String[] args) {
       try {
           Synthesizer synth = MidiSystem.getSynthesizer();
           synth.open();
       
           final MidiChannel[] mc    = synth.getChannels();
           Instrument[]        instr = synth.getDefaultSoundbank().getInstruments();
           synth.loadInstrument(instr[76]);  // Bottle Blow
           for (int i = 0; i < 120; ++i) {
               try {
                   Thread.sleep(100);
               } catch (InterruptedException e) {}
               mc[4].noteOn(i,200);
           }
       } catch (MidiUnavailableException e) {}
   }
}