Sunday, January 22, 2017

JFugue Jython Example 2. Playing multiple voices, multiple instruments, rests, chords, and durations

This is Example 2 from JFugue website (JFugue Examples) in Jython.



# JFugue 2. Playing multiple voices, multiple instruments,
# rests, chords, and durations

'''
This example uses the Staccato 'V' command for specifing voices,
'I' for specifying instruments (text within brackets is looked
up in a dictionary and maps to MIDI instrument numbers), '|' (pipe)
for indicating measures (optional), durations including 'q' for
quarter duration, 'qqq' for three quarter notes (multiple durations
can be listed together), and 'h' for half, 'w' for whole, and '.'
for a dotted duration; 'R' for rest, and the chords G-Major and
C-Major. Whitespace is not significant and can be used for visually
pleasing or helpful spacing.
'''

import sys
sys.path.append("C:/jfugue-5.0.7.jar")

from org.jfugue.player import Player

player = Player()
v = [None]*2
v[0] = "V0 I[Piano] Eq Ch. | Eq Ch. | Dq Eq Dq Cq"
v[1] = "V1 I[Flute] Rw | Rw | GmajQQQ CmajQ"
strPlay = " ".join(v)
player.play(strPlay)

No comments:

Post a Comment