7. Easy to Use
Based on Music Theory
Fun Things are Baked In
Consistent “System”
Event-Based Architecture
Five Bits of JFugue Magic
8. Play music with two lines of code:
Player player = new Player();
player.play(“V0 I[Flute] C3MAJw V1 I[Piano] C5q E5q G5h”);
Easy to Use
9. Music is easy to specify
and intentionally human-readable
C Middle-C
C#6h C# note, 6th octave, half duration
EbMAJ^w E-flat major chord, first inversion,
whole duration
Easy to Use
10. Music is easy to specify
and intentionally human-readable
I[Flute] Change instrument to Flute
T[Allegro] Change tempo to Allegro (120bpm)
m560.8q Play a 560.8 Hz tone at ¼-duration
Rq Rest (takes duration just like a note)
Easy to Use
11. Define a Scale in terms of Intervals
Define a Chord in terms of Intervals
Create a “I IV V” Chord Progression
Set the Root of a Chord Progression
Get the Chords from a Chord Progression
Get the Notes from a Chord
…
Based on Music Theory
12. Rhythm rhythm = new Rhythm()
.addLayer("O..oO...O..oOO..")
.addLayer("..S...S...S...S.")
.addLayer("````````````````")
.addLayer("...............+");
new Player()
.play(rhythm.getPattern().repeat(2));
Fun Things are Baked In
13. Pattern cp = ChordProgression
.fromChords("C#4min E4maj B3maj A3maj")
.eachChordAs("$_i $_i Ri $_i")
.getPattern()
.setInstrument("GUITAR")
.setVoice(0);
Rhythm rhythm = new Rhythm()
.addLayer("..X...X...X...XO");
new Player()
.play(new Pattern(cp, rhythm).repeat(2));
Consistent “System”
14. MidiParser parser = new MidiParser();
LilyPondListener listener =
new LilyPondListener();
parser.addListener(listener);
parser.parse(midi sequence);
listener.displayEngravedSheetMusic();
Event-Based Architecture
15. StaccatoParser parser = new StaccatoParser();
LilyPondListener listener =
new LilyPondListener();
parser.addListener(listener);
parser.parse(“C D E F G A B”);
listener.displayEngravedSheetMusic();
Event-Based Architecture
16. StaccatoParser parser = new StaccatoParser();
MusicXmlListener listener =
new MusicXmlListener();
parser.addListener(listener);
parser.parse(“C D E F G A B”);
listener.save(new File(“my_song.xml”));
Event-Based Architecture
17. MidiParser parser = new MidiParser();
MyParserListener listener = new MyParserListener();
parser.addParserListener(listener);
parser.parse(MidiSystem.getSequence(new File(“some midi file")));
System.out.println("There are "+listener.counter+" 'C' notes in this music.");
class MyParserListener extends ParserListenerAdapter {
public int counter;
@Override
public void onNoteParsed(Note note) {
if (note.getPositionInOctave() == 7) { // F# is the 7th note in an octave
counter++;
}
}
}
Event-Based Architecture
18. Sending to / Receiving from MIDI Devices
Creating New Patterns in Real-Time
Sending Musical Events “Before” They Occur
Extending the Staccato Parser
Using Replacement Maps to Play Solfege
Writing Functions for Musical Effects (e.g., Trill)
Scratching the Surface…
20. Log4JFugue: Listen to your log files!
log filesserver
video stream is created
video stream is destroyed
video stream has failed
[BASS_DRUM]s
[ACOUSTIC_SNARE]s
[CRASH_CYMBAL_1]s
audio
Winner,
2010 Duke’s
Choice Award
By Brian Tarbox http://www.Log4JFugue.org
21. amount of emotion
low emotion counts
high emotion counts
spikes in emotion
active:passive emotions
positive:negative emotion
amt of emotion per section
total emotions in chapter
prevalent emotions in novel
TransProse: Create Music from Literature
stability of note from root note
more consonant notes
more dissonant notes
interesting melodic movement
tempo
major/minor key and octave
note duration
main melody
additional melodies
EmoLex
By Hannah Davis http://www.MusicFromText.com
22. Counterpoint Composer
What is
counterpoint?
"The relationship
between voices that
are interdependent
harmonically yet
independent in
rhythm and contour"
By James Weaver http://counterpointservice.cfapps.io
24. Streams: Easier to generate procedural music in realtime?
Web API: Easier to build collaborative music making
experiences?
Better garbage collection: No more unexpected pauses in
generating music?
Kulla / REPL / jshell: Support LiveCoding?
Modularity: Good or bad for MIDI support?
JFugue & The Future of Java
Notas do Editor
My name is David Koelle.
I am the author of JFugue, which is a music programming library for Java.
I’d like to introduce you to JFugue, show you how it makes music programming fun and easy and magical, give you a few examples of what people are doing with JFugue, and talk about where JFugue is going in the future as Java evolves.
I created JFugue because I wanted to bring what you see on the screen into the world. I wanted it to be extremely easy for people to write musical programs.
My initial inspiration came in the mid-80’s. I was twelve. I had a Commodore-128 computer. And with that computer, I created music with a command in the BASIC language called “play”.
This enthralled me! It helped cement my interest in programming. And made programming fun and joyful. Back then, my only perception about programming was that it was fun and joyful.
And then, times changed. Computers and languages got more advanced. And the thing that I once found as a simple pleasure was insanely difficult to do. In the world of modern technology, I couldn’t play music anymore.
Now clearly, musical technology advanced. We have amazing digital audio workstations, distribution of MP3s became commonplace, and music recommender systems point us to new music that we might like.
But these are either digital instruments for making an audio recording, or involve listening to audio recordings that other people have already created.
The ability for an everyday person to easily and simply create a musical program – a program that can make music in response to changing conditions in the world, a program that can be more than a recording of one’s instrument but could be based on that artistic hand to craft generative music – that ability was gone.
So this was my quest: to introduce the beauty of what you see on the screen to the world.
Well, I achieved that. And once the basics are this simple, it’s possible to build some really cool stuff on top of it.
All of these other bits of magic have sprung up to create a joyful and musically sound playground in which to explore and easily create new musical ideas.
Really, the essence of JFugue isn’t that you can “play c”, but that you can do a bunch of things that build on this and let you talk about music at a high level.
This is the essence JFugue. On the surface, JFugue is a music programming library. it’s a jar file. Its default output is MIDI music. But it contains so much more, some of which you’ll see in the next few minutes.
Second, people all around the world are using JFugue to do phenomenally interesting things. I’ll show you a sample of those today.
So, this is JFugue’s way of playing Middle-C. But let’s see what this would look like without JFugue.
This is the code you would need to play Middle-C without JFugue, using the Java MIDI classes directly.
The Java MIDI classes are useful for parsing musical data that’s stored in MIDI files, but they were not developed to be a user-facing music API.
Musically, you would want to talk about notes like “C” and durations like “quarter note,” but in this code we’re dealing with notes like 60 and durations like 200 milliseconds.
And by the way, this code plays ONE NOTE! Most of the music I enjoy listening to has many more notes than that.
This is a simple “Hello, World” program in JFugue
And here’s a slightly longer program – still two lines of code, maybe? – that creates twelve bars of blues music, using a I-IV-V chord progression with each chord arpeggiated. “dum-dum-dum-dum, dum-dum-dum-dum”
Distribute(“7%6”) turns each of the MAJ chord in the chord progression into a Major 7th chord with a 6th note.
(This code plays a total of 96 notes)
This human-readable music specification is called Staccato.
“Now I know there are other music representations out there!” MusicXML, ABC notation
Why create yet another music specification?
In MIDI, “Flute” is Instrument 73
Allegro is 120 bpm
JFugue doesn’t just play notes, there is a solid foundation of music theory
Play “Rock Rhythm”
Play “Good Feeling.mid”
Staccato-to-MIDI happens to be the default, but you can do stuff like this
This code finds all of the F#’s in a piece of music.
[PART 2]
What these examples really show is the importance of *programming* music (creating music that changes based on conditions in the world, or based on user input) rather than specifying it before hand (as in a DAW)