Simple dur scale
Different start time
Minor random
  Different start time

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


import jmetude.*;

Etude e;
float notes[][] = {{e.E4,  e.SQ},
                   {e.FS4, e.SQ},
                   {e.B4,  e.SQ}, 
                   {e.CS5, e.SQ}, 
                   {e.D5,  e.SQ}, 
                   {e.FS4, e.SQ}, 
                   {e.E4,  e.SQ}, 
                   {e.CS5, e.SQ}, 
                   {e.B4,  e.SQ}, 
                   {e.FS4, e.SQ}, 
                   {e.D5,  e.SQ}, 
                   {e.CS5, e.SQ}};

void setup() {
    noLoop();
    size(200,100);
    
    e = new Etude(this);
    e.createScore("score");
    e.createPart("part1");
    
    e.createPhrase("phrase1", notes);
    e.createPhrase("phrase2", notes);
    e.createPhrase("phrase3", notes);
    
    e.transpose("phrase2",-12);
    e.transpose("phrase3",24);
    
    e.setPhraseStartTime("phrase2",6);
    e.setPhraseStartTime("phrase3",12);
    
    e.repeatPhrase("phrase1",12);
    e.repeatPhrase("phrase2",10);
    e.repeatPhrase("phrase3",8);
    
    e.addPartPhrase("part1", "phrase1");
    e.addPartPhrase("part1", "phrase2");
    e.addPartPhrase("part1", "phrase3");
  
    e.addScorePart("score","part1");
}

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

void mousePressed() {
  e.stopMIDI();
  int inst = (int)random(0,127);
  e.setPartInstrument("part1",inst);
  e.playMIDI("score");
}