Package piano

Source Code of piano.Main

package piano;

import javax.sound.midi.Instrument;
import javax.sound.midi.MidiChannel;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Synthesizer;


public class Main {

  public static void main(String[] args) throws MidiUnavailableException, InterruptedException {

    Synthesizer synth = MidiSystem.getSynthesizer();
    synth.open();

    MidiChannel[] channels = synth.getChannels();
    MidiChannel channel = channels[0];

    Instrument[] instr = synth.getDefaultSoundbank().getInstruments();
    synth.loadInstrument(instr[0]);

    Piano piano = new Piano(3, -1, channel);

    PianoFrame frame = new PianoFrame(piano);
    frame.setVisible(true);
  }

}
TOP

Related Classes of piano.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.