http://www.jfugue.org/examples.html
ne of the best ways to learn something new is to see it in action. The following samples are complete programs that show how to use JFugue. More examples are available in the JFugue Music Exchange.
List of examples below:
- Example 1: Exploring the MusicString
- Example 2: Sample Transcription of Music to JFugue
- Example 3: Using Patterns to Build a Song
- Example 4: Using Patterns to Create a Round or Fugue
- Example 5: Create a Rhythm (This is cool!)
Example 1: Exploring the MusicString
The features of the JFugue MusicString are discussed in detail in Chapter 2 of The Complete Guide to JFugue. Chapter 2 is available for free on the Getting Started page.Player player = new Player(); | |
Play the notes of an octave | player.play("C D E F G A B"); |
Play notes and rests in different octaves (0-10), with different durations (w, h, q, etc) | player.play("C3w D6h E3q F#5i Rs Ab7q Bb2i"); |
Play notes using different instruments | player.play("I[Piano] C5q D5q I[Flute] G5q F5q"); |
Play notes in harmony using different voices | player.play("V0 A3q B3q C3q B3q V1 A2h C2h"); |
Play some chords, and chord inversions | player.play("Cmaj5q F#min2h Bbmin13^^^"); |
Example 2: Sample Transcription of Music to JFugue
Excerpt from Inventio 13 (J. S. Bach) | Player player = new Player(); |
player.play("E5s A5s C6s B5s E5s B5s D6s C6i E6i G#5i E6i | A5s E5s A5s C6s B5s E5s B5s D6s C6i A5i Ri"); |
Example 3: Using Patterns to Build a Song
Sheet music for "Frere Jacques" |
// "Frere Jacques" |
Example 4: Using Patterns to Create a Round or Fugue
Building on the "Frere Jacques" example above. Listen to the song this program generates: frerejacques.mid |
Pattern doubleMeasureRest = new Pattern("Rw Rw"); |
Example 5: Create a Rhythm
Listen to the beat this program generates: beat16.midThe Rhythm feature is explained in detail in The Complete Guide to JFugue.
Rhythm rhythm = new Rhythm(); | |
Bang out your drum beat | rhythm.setLayer(1, "O..oO...O..oOO.."); |
Associate percussion notes with your beat | rhythm.addSubstitution('O', "[BASS_DRUM]i"); |
Play the rhythm! | Pattern pattern = rhythm.getPattern(); |
No comments:
Post a Comment