Simple dur scale
Different start time
Minor random
  Minor random

To view this content, you need to install Java from java.com


import jmetude.*;

Etude e;
float[][] notes = new float[100][2];

void setup() {
  noLoop();
  size(200,100);
  e = new Etude(this);
  e.createScore("score");
  e.createPart("part");
  e.createPhrase("phrase");
  e.addPartPhrase("part", "phrase");
  e.addScorePart("score", "part");
}

void generateNotes() {
    for(int i=0; i<100; i++) {
      int octave = (int) random(4,6) * 12;
      int noteFromScale = (int) random(0, e.MINOR_SCALE.length);           
      notes[i][0] = (float) octave + noteFromScale;    
      notes[i][1] = e.Q;
  }     
}

void draw() {
  background(50);
  PImage splash = loadImage("splash.gif");
  image(splash, 0, 0);
  
}

void mousePressed() {
  e.stopMIDI();
  generateNotes();
  int inst = (int)random(0, 127);
  e.clear("phrase");
  e.addPhraseNoteList("phrase",notes);
  e.setPhraseInstrument("phrase", inst);
  e.playMIDI("score");
}