User Tools

Site Tools


cs276:handlemidi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cs276:handlemidi [2007/12/11 14:43]
scarl
cs276:handlemidi [2008/11/15 13:50] (current)
scarl removed comment
Line 6: Line 6:
  ​* ​ handle creating a musical phrase using the MIDI data and playing the notes.  ​* ​ handle creating a musical phrase using the MIDI data and playing the notes.
  */  */
 + 
 import jmetude.*; import jmetude.*;
 + 
 Etude e; Etude e;
 float notes[][] = {{60,​1.0}, ​ float notes[][] = {{60,​1.0}, ​
Line 18: Line 18:
                    ​{71,​1.0}, ​                    ​{71,​1.0}, ​
                    ​{72,​4.0}};​                    ​{72,​4.0}};​
 + 
 void setup() { void setup() {
     noLoop();     noLoop();
Line 25: Line 25:
     e.createPhrase("​phrase"​);​     e.createPhrase("​phrase"​);​
     e.addPhraseNoteList("​phrase",​ notes);     e.addPhraseNoteList("​phrase",​ notes);
- 
-    // uncomment this next line to play an existing midi file instead 
-    // e.createScore("​score",​ "​gfhblast.mid"​);​ 
 } }
 + 
 void draw() { void draw() {
   background(50);​   background(50);​
-  PImage splash = loadImage("​loading.gif"​);​+  PImage splash = loadImage("​splash.gif"​);​
   image(splash,​ 0, 0);   image(splash,​ 0, 0);
 } }
 + 
 void mousePressed() { void mousePressed() {
   e.stopMIDI();​   e.stopMIDI();​
   int inst = (int) random(0,​127);​   int inst = (int) random(0,​127);​
-  e.setPhraseInstrument("​score", inst); +  e.setPhraseInstrument("​phrase", inst); 
-  e.playMIDI("​score");+  e.playMIDI("​phrase");
 } }
 </​code>​ </​code>​
cs276/handlemidi.1197405819.txt.gz · Last modified: 2007/12/11 14:43 by scarl