JythonMusic supports Live Coding performances via two features:
- special Run menu options, which allow only portions of code to run at a time in a program (as opposed to the traditional running of the whole program); and
- the Metronome class, which allows to synchronize running portions of code at particular metronome ticks.
That’s it. Let’s see things in more detail…
Run Menu Options
As seen below, there are four ways to run code:
- Run: This runs the complete program – (this is the traditional Python way of running programs).
- Run selection: This runs only the highlighted portion of code – (i.e., everything else is ignored).
- Run current line: This runs only the line where the cursor is currently on.
- Run current paragraph: This runs only the block of code (lines of code without empty lines), where the cursor is currently in.
Options 2, 3, and 4 clearly support live coding.
Metronome Objects
Metronome objects allow running functions (pieces of code) at prescribed moments in time. See the Metronome class for more information.
The following piece of code demonstrates the approach:
from music import *
Play with Metronome objects
The following Play functions accept a Metronome object, to delay (or synchronize) when they will actually run. See the Play class for more information.
- Play.midi()
- Play.audio()
- Play.code()
The following piece of code demonstrates the approach:
from music import *
That’s it! Enjoy.