Digital Sound & Music: Concepts, Applications, & Science, Chapter 3, last updated 6/25/2013
51
23 scale = minor7th;
24 else if (command == "domin7th")
25 scale = domin7th;
26 else if (command == "dimin7th")
27 scale = dimin7th;
28 else if (command == "majorTri")
29 scale = majorTri;
30 else if (command == "minorTri")
31 scale = minorTri;
32 else if (command == "augmeTri")
33 scale = augmeTri;
34 else
35 scale = diminTri;
36
37 float startnote = 220*(2^((2+3)/12));
38
39 for(int i=0;iscale.length;i++){
40 scale[i] = scale[i]/12;
41 scale[i] = (float)Math.pow(2,scale[i]);
42 scale[i] = startnote * scale[i];
43 }
44
45 //once we know which Chord to play, we call the Chord function
46 Chord chord = new Chord(scale);
47 chord.play();
48 }
49
50 public ChordApp() {
51 super(new BorderLayout());
52
53 try {
54 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
55 SwingUtilities.updateComponentTreeUI(this);
56 } catch (Exception e) {
57 System.err.println(e);
58 }
59
60 JRadioButton maj7thButton = new JRadioButton("Major Seventh");
61 maj7thButton.setActionCommand("major7th");
62
63 JRadioButton min7thButton = new JRadioButton("Minor Seventh");
64 min7thButton.setActionCommand("minor7th");
65
66 JRadioButton dom7thButton = new JRadioButton("Dominant Seventh");
67 dom7thButton.setActionCommand("domin7th");
68
69 JRadioButton dim7thButton = new JRadioButton("Diminished
Seventh");
70 dim7thButton.setActionCommand("dimin7th");
71
72 JRadioButton majTriButton = new JRadioButton("Major Triad");
73 majTriButton.setActionCommand("majorTri");
74
75 JRadioButton minTriButton = new JRadioButton("Minor Triad");
76 minTriButton.setActionCommand("minorTri");
77
78 JRadioButton augTriButton = new JRadioButton("Augmented Triad");
Previous Page Next Page