Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 22,665 times

Contents

Related Categories

Midi Synthesis in Java - The Swing Window

Michael H

The Swing Window

In this section we construct a simple Swing JFrame with a single JButton on it. Simple stuff so far, eh?

Now, for the Swing window, I'm just going to give you the 8 line chunk of code that creates a JFrame and puts a JButton inside. This tutorial will NOT explain how to make JFC/Swing GUI applications, I'm only 15 and I know Swing fairly well, I'm sure you can too.

Here it is:

JFrame frame = new JFrame("Sound1");
JPanel pane = new JPanel();
JButton button1 = new JButton("Click me!");
frame.getContentPane().add(pane);
pane.add(button1);
frame.pack();
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.show();

That makes the window and shows it. That also is the end of this section.

Comments

  • Re: [2664] Midi Synthesis in Java

    Posted by spulka on 07 Apr 2006

    I am writing a simple program; the user will select instrument (from a drop-down menu), pitch and delay for the tone, and press the Play button. I understand playing sounds. ...

  • complete bare bones example

    Posted by KarlStroetmann on 18 Aug 2004

    Below is the complete code to play a scale.


    import java.util.*;
    import javax.sound.midi.*;

    class SoundTest
    {
       public static void main(String[] args) {
    try {
    Synthesiz...

  • How do I record

    Posted by Turtle on 28 Jan 2004

    Hi

    I have successfully synthesized note using midi/java. now I want to save a particular sequence as a midi file and also retrieve the sequence when needed... How do I do that????

    Thanking You
    ...

  • Writing

    Posted by leonjollans on 09 Sep 2002

    Thanks, I might just do that. ;) I found your article on a search for Java MIDI example code so I haven't been through the site yet. I do c# and ASP primarily but I really love Java (and I'm Sun Certi...

  • Posted by Michael H on 08 Sep 2002

    I may or may not try Sequencing, it depends if I find a tutorial on it.

    The reason I wrote this tutorial on Synthesizing is because I wanted to do it but was unable to find a tutorial. I figured ou...