public static void main(String[] args) {

		Random rnd = new Random();
		try {
			List<Riff> riffz = new ArrayList<Riff>();
			List<Rhythm> r = new ArrayList<Rhythm>();

			SongWriter s = new SongWriter();
			TrackHandle track1 = s.createNewTrack();
			TrackHandle track2 = s.createNewTrack();
			
			s.setInstrument(track1, Instrument.AcousticGrandPiano);		
			s.setInstrument(track2, Instrument.AcousticGrandPiano);			
			
			s.setPressure(track1, 100);
			s.setPressure(track2, 60);
			
			for(int i = 1 ; i <= 94; i++) {
				Field f = Riff.class.getDeclaredField("RIFF"+i);
				riffz.add( (Riff) f.get( null ));
			}
			
			for(int i = 1 ; i <= 14; i++) {
				Field f = Rhythm.class.getDeclaredField("RHYTHM"+i);
				r.add( (Rhythm) f.get( null ));
			}
			
			
			s.setBPM(track1, 200);
			s.setBPM(track2, 200);			
			
			while( riffz.size() > 0) {
				int i = rnd.nextInt(riffz.size());
				int j = rnd.nextInt(r.size());
				Pitch[] curRiff = riffz.get(i).getData();
				NoteValue[] curRhythm = r.get(j).getData();
				
				for( int a = 0; a < curRiff.length; a++ ) {
					s.addNote(track1, curRiff[a], curRhythm[a%curRhythm.length]);
					s.addInterval(track2, curRiff[a], curRhythm[a%curRhythm.length], Interval.PERFECT_FIFTH);
				}
				
				riffz.remove(i);				
			}			
			
			s.endTrack(track1);
			s.play();


			
		} catch (Exception e) {			
			e.printStackTrace();
		}
	}