SlideShare uma empresa Scribd logo
1 de 24
JFugue, Music, and the
Future of Java
David Koelle
@dmkoelle
Principal Software Engineer, Charles River Analytics
Side gig: Author of JFugue
play(“C”);
Sequencer sequencer = MidiSystem.getSequencer();
Sequence sequence = sequencer.getSequence();
Track track = sequence.createTrack();
ShortMessage onMessage = new ShortMessage();
onMessage.setMessage(ShortMessage.NOTE_ON, 0, 60, 128);
MidiEvent noteOnEvent = new MidiEvent(onMessage, 0);
track.add(noteOnEvent);
ShortMessage offMessage = new ShortMessage();
offMessage.setMessage(ShortMessage.NOTE_OFF, 0, 60, 128);
MidiEvent noteOffEvent = new MidiEvent(offMessage, 200);
track.add(noteOffEvent);
sequencer.start();
try {
Thread.sleep(track.ticks());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
“Hello, World!” without JFugue
import org.jfugue.player.Player;
public class HelloWorld {
public static void main(String[] args) {
Player player = new Player();
player.play(“C”);
}
}
“Hello, World!” in JFugue
public class TwelveBarBlues {
public static void main(String[] args) {
Pattern pattern = new ChordProgression(“I IV V”)
.distribute(“7%6”)
.allChordsAs(“$0 $0 $0 $0 $1 $1 $0 $0 $2 $1 $0 $0”)
.eachChordAs(“$0i $1i $2i $3i $4i $3i $2i $1i”)
.getPattern()
.setInstrument(“Acoustic Bass”)
.setTempo(120);
new Player().play(pattern);
}
}
Advanced JFugue… still fits on one slide
A Tour of the Magic of JFugue
Easy to Use
Based on Music Theory
Fun Things are Baked In
Consistent “System”
Event-Based Architecture
Five Bits of JFugue Magic
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
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
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
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
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
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”
MidiParser parser = new MidiParser();
LilyPondListener listener =
new LilyPondListener();
parser.addListener(listener);
parser.parse(midi sequence);
listener.displayEngravedSheetMusic();
Event-Based Architecture
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
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
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
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…
Real-World Examples
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
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
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
JFugue & The Future of Java
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

Mais conteúdo relacionado

Mais procurados

Build a compiler in 2hrs - NCrafts Paris 2015
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015Phillip Trelford
 
Ruby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missRuby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missTobias Pfeiffer
 
Go for the paranoid network programmer
Go for the paranoid network programmerGo for the paranoid network programmer
Go for the paranoid network programmerEleanor McHugh
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitTobias Pfeiffer
 
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)Tobias Pfeiffer
 
(Fun clojure)
(Fun clojure)(Fun clojure)
(Fun clojure)Timo Sulg
 
Debugging: A Senior's Skill
Debugging: A Senior's SkillDebugging: A Senior's Skill
Debugging: A Senior's SkillMilton Lenis
 
Finding a lost song with Node.js and async iterators - EnterJS 2021
Finding a lost song with Node.js and async iterators - EnterJS 2021Finding a lost song with Node.js and async iterators - EnterJS 2021
Finding a lost song with Node.js and async iterators - EnterJS 2021Luciano Mammino
 
Fewer cables
Fewer cablesFewer cables
Fewer cablesacme
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsagniklal
 
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015ThierryAbalea
 
Finding a lost song with Node.js and async iterators - NodeConf Remote 2021
Finding a lost song with Node.js and async iterators - NodeConf Remote 2021Finding a lost song with Node.js and async iterators - NodeConf Remote 2021
Finding a lost song with Node.js and async iterators - NodeConf Remote 2021Luciano Mammino
 
Finding a lost song with Node.js and async iterators
Finding a lost song with Node.js and async iteratorsFinding a lost song with Node.js and async iterators
Finding a lost song with Node.js and async iteratorsLuciano Mammino
 
Go for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionGo for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionEleanor McHugh
 
PyCon2009_AI_Alt
PyCon2009_AI_AltPyCon2009_AI_Alt
PyCon2009_AI_AltHiroshi Ono
 

Mais procurados (20)

Build a compiler in 2hrs - NCrafts Paris 2015
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015
 
Ruby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might missRuby to Elixir - what's great and what you might miss
Ruby to Elixir - what's great and what you might miss
 
Go for the paranoid network programmer
Go for the paranoid network programmerGo for the paranoid network programmer
Go for the paranoid network programmer
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicit
 
Music as data
Music as dataMusic as data
Music as data
 
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
 
(Fun clojure)
(Fun clojure)(Fun clojure)
(Fun clojure)
 
League of Graphs
League of GraphsLeague of Graphs
League of Graphs
 
Clojure入門
Clojure入門Clojure入門
Clojure入門
 
Debugging: A Senior's Skill
Debugging: A Senior's SkillDebugging: A Senior's Skill
Debugging: A Senior's Skill
 
Strings
StringsStrings
Strings
 
Finding a lost song with Node.js and async iterators - EnterJS 2021
Finding a lost song with Node.js and async iterators - EnterJS 2021Finding a lost song with Node.js and async iterators - EnterJS 2021
Finding a lost song with Node.js and async iterators - EnterJS 2021
 
Fewer cables
Fewer cablesFewer cables
Fewer cables
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
 
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
 
Finding a lost song with Node.js and async iterators - NodeConf Remote 2021
Finding a lost song with Node.js and async iterators - NodeConf Remote 2021Finding a lost song with Node.js and async iterators - NodeConf Remote 2021
Finding a lost song with Node.js and async iterators - NodeConf Remote 2021
 
Finding a lost song with Node.js and async iterators
Finding a lost song with Node.js and async iteratorsFinding a lost song with Node.js and async iterators
Finding a lost song with Node.js and async iterators
 
Hello Go
Hello GoHello Go
Hello Go
 
Go for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionGo for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd edition
 
PyCon2009_AI_Alt
PyCon2009_AI_AltPyCon2009_AI_Alt
PyCon2009_AI_Alt
 

Semelhante a JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]

Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."sjabs
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQAFest
 
The Ring programming language version 1.6 book - Part 72 of 189
The Ring programming language version 1.6 book - Part 72 of 189The Ring programming language version 1.6 book - Part 72 of 189
The Ring programming language version 1.6 book - Part 72 of 189Mahmoud Samir Fayed
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsashukiller7
 
Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)fefe7270
 
Transaction is a monad
Transaction is a  monadTransaction is a  monad
Transaction is a monadJarek Ratajski
 
Functional Thinking for Java Developers (presented in Javafest Bengaluru)
Functional Thinking for Java Developers (presented in Javafest Bengaluru)Functional Thinking for Java Developers (presented in Javafest Bengaluru)
Functional Thinking for Java Developers (presented in Javafest Bengaluru)KonfHubTechConferenc
 
Sequencing Audio Using React and the Web Audio API
Sequencing Audio Using React and the Web Audio APISequencing Audio Using React and the Web Audio API
Sequencing Audio Using React and the Web Audio APIVincent Riemer
 
Drools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL SyntaxDrools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL SyntaxMauricio (Salaboy) Salatino
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?Adam Dudczak
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212Mahmoud Samir Fayed
 
Network security
Network securityNetwork security
Network securitybabyangle
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซีkramsri
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Baruch Sadogursky
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Stephen Chin
 
The Test File- The code- #include -iostream- #include -vector- #includ.docx
The Test File- The code- #include -iostream- #include -vector- #includ.docxThe Test File- The code- #include -iostream- #include -vector- #includ.docx
The Test File- The code- #include -iostream- #include -vector- #includ.docxAustinIKkNorthy
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]Baruch Sadogursky
 
The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)GroovyPuzzlers
 
ng-conf 2017: Angular Mischief Maker Slides
ng-conf 2017: Angular Mischief Maker Slidesng-conf 2017: Angular Mischief Maker Slides
ng-conf 2017: Angular Mischief Maker SlidesLukas Ruebbelke
 

Semelhante a JFugue, Music, and the Future of Java [JavaOne 2016, CON1851] (20)

Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
 
The Ring programming language version 1.6 book - Part 72 of 189
The Ring programming language version 1.6 book - Part 72 of 189The Ring programming language version 1.6 book - Part 72 of 189
The Ring programming language version 1.6 book - Part 72 of 189
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
 
Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)Android audio system(audio_hardwareinterace)
Android audio system(audio_hardwareinterace)
 
Pdr ppt
Pdr pptPdr ppt
Pdr ppt
 
Transaction is a monad
Transaction is a  monadTransaction is a  monad
Transaction is a monad
 
Functional Thinking for Java Developers (presented in Javafest Bengaluru)
Functional Thinking for Java Developers (presented in Javafest Bengaluru)Functional Thinking for Java Developers (presented in Javafest Bengaluru)
Functional Thinking for Java Developers (presented in Javafest Bengaluru)
 
Sequencing Audio Using React and the Web Audio API
Sequencing Audio Using React and the Web Audio APISequencing Audio Using React and the Web Audio API
Sequencing Audio Using React and the Web Audio API
 
Drools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL SyntaxDrools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL Syntax
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212
 
Network security
Network securityNetwork security
Network security
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)
 
The Test File- The code- #include -iostream- #include -vector- #includ.docx
The Test File- The code- #include -iostream- #include -vector- #includ.docxThe Test File- The code- #include -iostream- #include -vector- #includ.docx
The Test File- The code- #include -iostream- #include -vector- #includ.docx
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)
 
ng-conf 2017: Angular Mischief Maker Slides
ng-conf 2017: Angular Mischief Maker Slidesng-conf 2017: Angular Mischief Maker Slides
ng-conf 2017: Angular Mischief Maker Slides
 

Último

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 

Último (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 

JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]

  • 1. JFugue, Music, and the Future of Java David Koelle @dmkoelle Principal Software Engineer, Charles River Analytics Side gig: Author of JFugue
  • 3. Sequencer sequencer = MidiSystem.getSequencer(); Sequence sequence = sequencer.getSequence(); Track track = sequence.createTrack(); ShortMessage onMessage = new ShortMessage(); onMessage.setMessage(ShortMessage.NOTE_ON, 0, 60, 128); MidiEvent noteOnEvent = new MidiEvent(onMessage, 0); track.add(noteOnEvent); ShortMessage offMessage = new ShortMessage(); offMessage.setMessage(ShortMessage.NOTE_OFF, 0, 60, 128); MidiEvent noteOffEvent = new MidiEvent(offMessage, 200); track.add(noteOffEvent); sequencer.start(); try { Thread.sleep(track.ticks()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } “Hello, World!” without JFugue
  • 4. import org.jfugue.player.Player; public class HelloWorld { public static void main(String[] args) { Player player = new Player(); player.play(“C”); } } “Hello, World!” in JFugue
  • 5. public class TwelveBarBlues { public static void main(String[] args) { Pattern pattern = new ChordProgression(“I IV V”) .distribute(“7%6”) .allChordsAs(“$0 $0 $0 $0 $1 $1 $0 $0 $2 $1 $0 $0”) .eachChordAs(“$0i $1i $2i $3i $4i $3i $2i $1i”) .getPattern() .setInstrument(“Acoustic Bass”) .setTempo(120); new Player().play(pattern); } } Advanced JFugue… still fits on one slide
  • 6. A Tour of the Magic of JFugue
  • 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
  • 23. JFugue & The Future of Java
  • 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

  1. 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.
  2. 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.
  3. 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.
  4. This is a simple “Hello, World” program in JFugue
  5. 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)
  6. 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?
  7. In MIDI, “Flute” is Instrument 73 Allegro is 120 bpm
  8. JFugue doesn’t just play notes, there is a solid foundation of music theory
  9. Play “Rock Rhythm”
  10. Play “Good Feeling.mid”
  11. Staccato-to-MIDI happens to be the default, but you can do stuff like this
  12. This code finds all of the F#’s in a piece of music.
  13. [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)