/Users/lyon/j4p/src/sound/musica/Main.java

1    package sound.musica; 
2     
3    import gui.ExitFrame; 
4    import java.awt.Container; 
5    import javax.sound.midi.Synthesizer; 
6    import javax.swing.JLabel; 
7    import sound.Scales; 
8    import sound.StochasticControl; 
9    import sound.Utils; 
10    
11    
12   public class Main extends KeyProcessor { 
13       static class MouseFrame extends ExitFrame { 
14           MouseFrame() { 
15               Container c = getContentPane(); 
16    
17               MusicMouseListener mp 
18                       = new MusicMouseListener(); 
19               KeyProcessor kp 
20                       = new KeyProcessor(); 
21               c.addMouseMotionListener(mp); 
22               c.addMouseListener(mp); 
23               addKeyListener(kp); 
24               c.add(new JLabel("musica")); 
25               setSize(300, 300); 
26               setVisible(true); 
27           } 
28       } 
29    
30       public static void main(String args[]) { 
31           new MouseFrame(); 
32           StochasticControl.randomNotes(sound.Scales.getScale( 
33                   Scales.HARMONIC_MINOR, 32, 74), 
34                                         10); 
35       } 
36    
37    
38       public static void testNote() { 
39           int nNoteNumber = 64;   // MIDI key number 
40           int nVelocity = 127;   //0..127 
41           int nDuration = 500;   // ms 
42           Synthesizer synth = Utils.getSynthesizer(); 
43           Utils.play(synth, 
44                      nNoteNumber, 
45                      nVelocity, 
46                      nDuration); 
47       } 
48    
49   }