org.jfugue.examples
Class LSysMusic

java.lang.Object
  |
  +--org.jfugue.examples.LSysMusic

public class LSysMusic
extends java.lang.Object

This class generates a string of music based on a Lindenmayer System, which is a system of grammar re-write rules. Basically, you start with an initial string, or "axiom", like "G". Then you go through the string, changing the string if you come across particular characters. For example, we might say, "Convert all G's to AB". Now the string would be "AB". If we do this again, and we have defitions for A and B ("Convert all A's to GA", "Convert all B's to BB"), we'll get "GABB". Do it again, and we get "ABGABBBB".

Graphical representations of Lindenmayer Systems have been used to create realistic plant forms. This is really fascinating stuff, and I recommend you search on Google for Lindenmayer Systems or L-Systems.

In this class's L-Sys transformations, we use letters in angle brackets to represent different rules. The parser will ignore tokens with angle brackets, because it does not recognize them as one of the commands it can parse.

To compile: javac -classpath directory-and-filename-of-jfugue.jar LSysMusic.java
To execute: java -classpath directory-and-filename-of-jfugue.jar org.jfugue.examples.LSysMusic
(note: Depending on your version of Java, you may have to use "-cp" instead of "-classpath" when executing)

Version:
2.0
Author:
David Koelle

Constructor Summary
LSysMusic()
           
 
Method Summary
 void addTransform(java.lang.String transformFrom, java.lang.String transformTo)
           
 java.lang.String generate(int iterations)
           
static void main(java.lang.String[] args)
           
 void setAxiom(java.lang.String axiom)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LSysMusic

public LSysMusic()
Method Detail

setAxiom

public void setAxiom(java.lang.String axiom)

addTransform

public void addTransform(java.lang.String transformFrom,
                         java.lang.String transformTo)

generate

public java.lang.String generate(int iterations)

main

public static void main(java.lang.String[] args)