public static void main(String[] args) { Player player = new Player(); // This is one of the simplest Staccato strings that you can play. DemoPrint.start("A simple Staccato string."); player.play("C D E F G A B"); // This Staccato string is more typical of the kind of music you might // expect to see (and write). There are changes in voice (or channels) // and two different instruments in play. There is also a rest in V1. DemoPrint.step("A typical Staccato string with voices, instruments, and durations."); player.play("V0 I[Piano] Cq Cq Cq Dq Eq V1 I[Flute] Rq Eq Gq Fq Gq"); // This string is more complicated: Each C note has an octave provided, // and there are a variety of durations, from whole down to thirty-second, // followed by a quarter and a dotted quarter, followed by a combined // whole+half duration, then a numeric duration, then a large combined duration. DemoPrint.step("A more complicated Staccato string."); player.play("C0w C1h C2q C3i C4s C5t Rq C6q. C7wh C8/1.5 C9qqqqiiiss"); }
public static void main(String[] args) { // Specify the transformation rules for this Lindenmayer system Map<String, String> rules = new HashMap<String, String>() { { put("Cmajw", "Cmajw Fmajw"); put("Fmajw", "Rw Bbmajw"); put("Bbmajw", "Rw Fmajw"); put("C5q", "C5q G5q E6q C6q"); put("E6q", "G6q D6q F6i C6i D6q"); put("G6i+D6i", "Rq Rq G6i+D6i G6i+D6i Rq"); put( "axiom", "axiom V0 I[Flute] Rq C5q V1 I[Tubular_Bells] Rq Rq Rq G6i+D6i V2 I[Piano] Cmajw E6q V3 I[Warm] E6q G6i+D6i V4 I[Voice] C5q E6q"); } }; // Set up the ReplacementMapPreprocessor to iterate 3 times // and not require brackets around replacements ReplacementMapPreprocessor rmp = ReplacementMapPreprocessor.getInstance(); rmp.setReplacementMap(rules); rmp.setIterations(4); rmp.setRequireAngleBrackets(false); // Create a Pattern that contains the L-System axiom Pattern axiom = new Pattern( "T120 " + "V0 I[Flute] Rq C5q " + "V1 I[Tubular_Bells] Rq Rq Rq G6i+D6i " + "V2 I[Piano] Cmajw E6q " + "V3 I[Warm] E6q G6i+D6i " + "V4 I[Voice] C5q E6q"); // Pattern axiom = new Pattern("T120 axiom"); Player player = new Player(); System.out.println(rmp.preprocess(axiom.toString(), null)); player.play(axiom); }
public void setup() { parser = new MidiParser(); listener = new StaccatoParserListener(); player = new Player(); parser.addParserListener(listener); try { File midiFile = new File( dataPath( "/Users/fbonnamy/Documents/pro/WIW/MusicalLetter/prototypage/MidiReader/data/WIW_NOEL_test_midi.mid")); parser.parse(MidiSystem.getSequence(midiFile)); Pattern staccatoPattern = listener.getPattern(); System.out.println(staccatoPattern); player.play(staccatoPattern); } catch (Exception e) { } }
public static void main(String[] args) { Player player = new Player(); player.play("C5maj C5maj^ C5maj^^"); }