Appendix F. Demonstration Command Scripts in Python

Table of Contents
F.1. MIDI-based Output
F.1.1. script01a.py: Configuring Rhythms
F.1.2. script01b.py: Configuring Time Range
F.1.3. script02a.py: Building a Basic Beat
F.1.4. script02b.py: Building a Basic Beat with a Complex Snare Part
F.1.5. script02c.py: Building a Basic Beat with Canonic Snare Imitation
F.1.6. script02d.py: Building an Extended Rhythmic Line with Canonic Imitation
F.1.7. script02e.py: Creating Mensural Canons
F.1.8. script02f.py: Building an Extended Rhythmic Line with Fixed Tempo Phasing
F.1.9. script02g.py: Building an Extended Rhythmic Line with Dynamic Tempo Phasing
F.1.10. script03a.py: Grouping Selection
F.1.11. script03b.py: Tendency Mask: Random Values between Breakpoint Functions
F.1.12. script03c.py: Tendency Mask: Random Values between Triangle Generators
F.1.13. script04a.py: Large Scale Amplitude Behavior with Operators
F.1.14. script04b.py: 1/f Noise in Melodic Generation: LineGroove
F.1.15. script04c.py: 1/f Noise in Melodic Generation: HarmonicAssembly
F.1.16. script05a.py: Self Similar Markovian Melody Generation and Transposition
F.1.17. script05b.py: Markov-Based Proportional Rhythm Generation
F.1.18. script05c.py: Markov-Based Value Generation
F.1.19. script06a.py: Deploying Pitch Sieves with HarmonicAssembly
F.1.20. script07a.py: The CA as a Generator of Melodies
F.1.21. script07b.py: The CA as a Generator of Rhythms
F.1.22. script08a.py: Evolving African Drum Patterns with a GA: Two Durations
F.1.23. script08b.py: Evolving African Drum Patterns with a GA: Combinations of Rests and Silences
F.1.24. script08c.py: Evolving African Drum Patterns with a GA: Multiple Rhythmic Values
F.1.25. script08d.py: Evolving African Drum Patterns with a GA: Multiple Rhythmic Values
F.1.26. script09a.py: Grammar States as Accent Patterns
F.1.27. script09b.py: Grammar States as Pitch Values
F.1.28. script09c.py: Grammar States as Pitch Transpositions
F.1.29. script09d.py: Grammar States as Path Index Values
F.1.30. script10a.py: Feedback System as Dynamic Contour
F.1.31. script10b.py: Feedback System as Path Index Values
F.2. Csound-based Output
F.2.1. script01a.py: Testing Csound
F.2.2. script01b.py: A Noise Instrument
F.2.3. script01c.py: A Sample Playback Instrument
F.2.4. script01d.py: A Sample Playback Instrument with Variable Playback Rate
F.2.5. script02a.py: Composing with Densities using TM TimeFill and a Noise Instrument
F.2.6. script02b.py: Composing with Densities using TM TimeFill and a Single Sample
F.2.7. script03a.py: Polyphonic Sine Grains LineGroove
F.2.8. script03b.py: Polyphonic Sine Grains: DroneArticulate
F.2.9. script03c.py: Polyphonic Sample Grains from a Single Audio File: LineGroove
F.2.10. script03d.py: Polyphonic Sample Grains from a Multiple Audio Files: LineGroove
F.2.11. script03e.py: Polyphonic Sample Grains from a Multiple Audio Files: LineGroove

The following scripts provide both brief examples of how to programmatically send commands to the athenaCL Interpreter and also demonstrate numerous fundamental concepts and techniques. All .py files shown here are included in the athenaCL demo directory. Pre-rendered MIDI and Csound files are also included.

F.1. MIDI-based Output

F.1.1. script01a.py: Configuring Rhythms

# Configuring Rhythms
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',   
'tin a 45', 
'tie a rb,.3,.3,.4,.8', 
'tie r pt,(c,4),(bg,oc,(3,3,2)),(c,1)', 
'tin b 65', 
'tie a re,15,.3,1', 
'tie r pt,(bg,rp,(2,1,1,1)),(c,1),(c,1)', 
'tin c 67', 
'tie a rb,.1,.1,.4,.6', 
'tie r cs,(rb,.2,.2,.01,1.5)', 
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.2. script01b.py: Configuring Time Range

# Configuring Time Range
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [
'emo mp',
'tin a 45', 
'tie t 0,20', 
'tie a rb,.3,.3,.4,.8', 
'tie r pt,(c,4),(bg,oc,(3,3,2)),(c,1)', 
'tin b 65', 
'tie t 10,20', 
'tie a re,15,.3,1', 
'tie r pt,(bg,rp,(2,1,1,1)),(c,1),(c,1)', 
'tin c 67', 
'tie t 15,25', 
'tie a rb,.1,.1,.4,.6', 
'tie r cs,(rb,.2,.2,.01,1.5)', 
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.3. script02a.py: Building a Basic Beat

# Building a Basic Beat
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 36',
'tie r pt,(c,2),(bg,oc,(7,5,2,1,1)),(c,1)',
'tin b 37',
'tie r pt,(c,2),(bg,oc,(3,5)),(bg,oc,(0,1)) ',
'tin c 42',
'tie r pt,(c,2),(c,1),(bg,oc,(0,1))',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.4. script02b.py: Building a Basic Beat with a Complex Snare Part

# Building a Basic Beat with a Complex Snare Part
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 36',
'tie r pt,(c,2),(bg,oc,(7,5,2,1,1)),(c,1)',
'tin b 37',
'tie r pt,(c,4),(bg,rp,(3,3,5,4,1)),(bg,oc,(0,1,1))',
'tin c 42',
'tie r pt,(c,2),(c,1),(bg,oc,(0,1))',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.5. script02c.py: Building a Basic Beat with Canonic Snare Imitation

# Building a Basic Beat with Canonic Snare Imitation
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 36',
'tie r pt,(c,2),(bg,oc,(7,5,2,1,1)),(c,1)',
'tin b 37',
'tie r pt,(c,4),(bg,rp,(3,3,5,4,1)),(bg,oc,(0,1,1))',
'tin c 42',
'tie r pt,(c,2),(c,1),(bg,oc,(0,1))',
'tio b',
'ticp b b1',
'tie t .25, 20.25',
'tie i 76',
'ticp b b2',
'tie t .5, 20.5',
'tie i 77',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.6. script02d.py: Building an Extended Rhythmic Line with Canonic Imitation

# Building an Extended Rhythmic Line with Canonic Imitation
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 77', 
'tie r pt,(c,1),(c,1),(c,1)', 
'tin b 67', 
'tie r pt,(bg,oc,(2,4,1)),(bg,oc,(3,5,1,7,1,3)),(c,1) ', 
'ticp b b1', 
'tie t 0.125,20.125', 
'tie i 60', 
'ticp b b2', 
'tie t 0.25,20.25', 
'tie i 68', 
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.7. script02e.py: Creating Mensural Canons

# Creating Mensural Canons
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 77', 
'tie r pt,(c,1),(c,1),(c,1)', 
'tin b 67', 
'tie r pt,(bg,oc,(2,4,1)),(bg,oc,(3,5,1,7,1,3)),(c,1) ', 
'ticp b b1', 
'tie t 0.125,20.125', 
'tie i 60', 
'ticp b b2', 
'tie t 0.25,20.25', 
'tie i 68', 
'tio b1', 
'tie b c,90',
'tio b2', 
'tie b c,180',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.8. script02f.py: Building an Extended Rhythmic Line with Fixed Tempo Phasing

# Building an Extended Rhythmic Line with Fixed Tempo Phasing
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 70',
'tie r pt,(bg,oc,(2,4,4)),(bg,oc,(4,1,1,2,1)),(c,1) ',
'tie t 0,60',
'ticp a a1',
'tie b c,124',
'ticp a a2',
'tie b c,128',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.9. script02g.py: Building an Extended Rhythmic Line with Dynamic Tempo Phasing

# Building an Extended Rhythmic Line with Dynamic Tempo Phasing
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 64',
'tie r pt,(bg,oc,(2,4,4)),(bg,oc,(4,1,1,2,1)),(c,1) ',
'tie t 0,60',
'ticp a a1',
'tie i 60',
'tie b ws,t,20,0,115,125',
'ticp a a2',
'tie i 69',
'tie b ws,t,30,0,100,140',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.10. script03a.py: Grouping Selection

# Grouping Selection
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [
'emo m',
'tin a 6', 
'tie r cs,(rb,.2,.2,.02,.25)', 
'tie f ig,(bg,rc,(2,4,7,9,11)),(bg,rp,(2,3,5,8,13))', 
'tie o ig,(bg,oc,(-2,-1,0,1)),(ru,20,30)', 
'ticp a b c d', 
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.11. script03b.py: Tendency Mask: Random Values between Breakpoint Functions

# Tendency Mask: Random Values between Breakpoint Functions
from athenaCL.libATH import athenaObj
cmd = [
'emo m',
'tin a 15',
'tie r cs,(ig,(ru,.01,.25),(ru,4,12))',
'tie a ru,.2,(cg,u,.3,.9,.005)',
'tie f rb,.2,.2,(bpl,t,l,((0,-12),(30,12))),(ws,t,29,0,0,24)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.12. script03c.py: Tendency Mask: Random Values between Triangle Generators

# Tendency Mask: Random Values between Triangle Generators
from athenaCL.libATH import athenaObj
cmd = [
'emo m',
'pin a d,e,g,a,b',
'tin a 107  ',
'tie r pt,(c,16),(ig,(bg,rc,(1,2,3,5,7)),(bg,rc,(3,6,9,12))),(c,1)',
'tie o ru,(wt,t,25,0,-2,4),(wt,t,20,0,-3,1)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.13. script04a.py: Large Scale Amplitude Behavior with Operators

# Large Scale Amplitude Behavior with Operators
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [
'emo mp',
'tin a 64',
'tie r pt,(bg,rp,(16,16,8)),(bg,rp,(2,2,1,4)),(c,1)',
'tie a om,(ls,e,9,(ru,.2,1),(ru,.2,1)),(wp,e,23,0,0,1)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.14. script04b.py: 1/f Noise in Melodic Generation: LineGroove

# 1/f Noise in Melodic Generation: LineGroove
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [
'emo m',
'tmo lg',
'tin a 108',
'tie r cs,(ls,e,10,(ru,.01,.2),(ru,.01,.2))',
'tie f bs,(2,4,7,9,11,14,16,19,21,23),(n,100,1,0,1)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.15. script04c.py: 1/f Noise in Melodic Generation: HarmonicAssembly

# 1/f Noise in Melodic Generation: HarmonicAssembly
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [
'emo m',
'pin a d3,e3,g3,a3,b3,d4,e4,g4,a4,b4,d5,e5,g5,a5,b5',
'tmo ha',
'tin a 27',
'tie r pt,(c,16),(ig,(bg,rc,(1,2,3,5,7)),(bg,rc,(3,6,9,12))),(c,1)',
'tie a om,(ls,e,9,(ru,.2,1),(ru,.2,1)),(wp,e,23,0,0,1)',
'tie d0 c,0',
'tie d1 n,100,2,0,14',
'tie d2 c,1',
#'tie d3 c,1',
'tie d3 ru,1,4',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.16. script05a.py: Self Similar Markovian Melody Generation and Transposition

# Self Similar Markovian Melody Generation and Transposition
from athenaCL.libATH import athenaObj
cmd = [
'emo m',
'tin a 24',
'tie r cs,(n,100,1.5,.100,.180)',
'tie r cs,(om,(n,100,1.5,.100,.180),(ws,t,8,0,.5,1))',
# Markov weighted pitch transposition
'tie f mv,a{2}b{4}c{7}d{9}e{11}:{a=1|b=6|c=1|d=9|e=1}',
# self-similar pitch transposition combing a grouped version of the same Markov generator with OperatorAdd
'tie f oa,(mv,a{2}b{4}c{7}d{9}e{11}:{a=1|b=3|c=1|d=3|e=1}), (ig,(mv,a{2}b{4}c{7}d{9}e{11}:{a=1|b=3|c=1|d=3|e=1}),(ru,10,20))',
# Markov based octave shifting
'tie o mv,a{-2}b{0}c{-2}d{0}e{-1}:{a=1|b=3|c=1|d=3|e=1}',
# A widening beta distribution
'tie a rb,.2,.5,(ls,e,(ru,3,20),.5,1)',
# Modulated with a pulse wave (and random frequency modulation on the PulseWave)
'tie a om,(rb,.2,.5,(ls,e,(ru,3,20),.5,1)),(wp,e,(ru,25,30),0,0,1)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.17. script05b.py: Markov-Based Proportional Rhythm Generation

# Markov-Based Proportional Rhythm Generation
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 64',
# simple zero-order selection
'tie r mp,a{4,1}b{4,3}c{4,5}d{4,7}:{a=4|b=3|c=2|d=1}',
# first order generation that encourages movement toward the shortest duration
'tie r mp,a{8,1}b{4,3}c{4,7}d{4,13}a:{a=9|d=1}b:{a=5|c=1}c:{b=1}d:{c=1},(c,1)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.18. script05c.py: Markov-Based Value Generation

# Markov-Based Value Generation
from athenaCL.libATH import athenaObj
cmd = [
'emo m',
'tin a 26',
# rhythm generated with absolute values via ConvertSecond and a dynamic WaveHalfPeriodSine generator
'tie r cs,(whps,e,(bg,rp,(5,10,15,20)),0,.200,.050)',
# first-order selection
#'tie f mv,a{2}b{4}c{7}d{9}e{11}:{a=1|b=3|c=1|d=3|e=1}a:{a=9|e=1}b:{a=3|c=1}c:{b=3|d=1}d:{c=3|e=1}e:{d=1},(c,1)',
# dynamic first and zero order selection
'tie f mv,a{2}b{4}c{7}d{9}e{11}:{a=1|b=3|c=1|d=3|e=1}a:{a=9|e=1}b:{a=3|c=1}c:{b=3|d=1}d:{c=3|e=1}e:{d=1},(wp,e,100,0,1,0)',
# zero-order Markov amplitude values
#'tie a mv,a{.4}b{.6}c{.8}d{1}:{a=6|b=4|c=3|d=1}',
# amplitude values scaled by a dynamic WaveHalfPeriodPulse
'tie a om,(mv,a{.4}b{.6}c{.8}d{1}:{a=6|b=4|c=3|d=1}),(whpp,e,(bg,rp,(5,15,10)))',
# octave values are provided by a first-order Markov chain
'tie o mv,a{0}b{-1}c{-2}d{-3}a:{a=9|d=1}b:{a=3|b=1}c:{b=3|c=1}d:{c=1},(c,1)',
'tie t 0,60',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.19. script06a.py: Deploying Pitch Sieves with HarmonicAssembly

# Deploying Pitch Sieves with HarmonicAssembly
from athenaCL.libATH import athenaObj
cmd = [
'emo m',
'pin a 11@1|13@2|23@5|25@6,c1,c7',
'tmo ha',
'tin a 0',
'tie t 0,30',
'tie a rb,.2,.2,.6,1',
'tie b c,120',
#zero-order Markov chains building pulse triples
'tie r pt,(c,4),(mv,a{1}b{3}:{a=12|b=1}),(mv,a{1}b{0}:{a=9|b=1}),(c,.8)',
#index position of multiset: there is only one at zero
'tie d0 c,0',
#selecting pitches from the multiset (indices 0-15) with a tendency mask
'tie d1 ru,(bpl,t,l,[(0,0),(30,12)]),(bpl,t,l,[(0,3),(30,15)])', 
#repetitions of each chord
'tie d2 c,1',
#chord size
'tie d3 bg,rc,(2,3)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.20. script07a.py: The CA as a Generator of Melodies

# The CA as a Generator of Melodies
from athenaCL.libATH import athenaObj
cmd = [
'emo m',
# create a single, large Multiset using a sieve
'pin a 5@0|7@2,c2,c7',
'tmo ha',
'tin a 27',
'tie r pt,(c,8),(ig,(bg,rc,(2,3)),(bg,rc,(3,6,9))),(c,1)',
'tie a ls,e,9,(ru,.2,1),(ru,.2,1)',
# select only Multiset 0
'tie d0 c,0',
# select pitches from Multiset using CaList
'tie d1 cl,f{s}x{20},90,0,fria,oc',
# create only 1 simultaneity from each multiset
'tie d2 c,1',
# create only 1-element simultaneities
'tie d3 c,1',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.21. script07b.py: The CA as a Generator of Rhythms

# The CA as a Generator of Rhythms
from athenaCL.libATH import athenaObj
cmd = [
'emo mp',
'tin a 47',
# set the multiplier to the integer output of CaList
'tie r pt,(c,4),(cl,f{s}k{2}r{1}x{81}y{120}w{6}c{0}s{0},109,.05,sumRowActive,oc),(c,1)',
# set the amplitude to the floating point output of CaValue
'tie a cv,f{s}k{2}r{1}x{81}y{120}w{6}c{8}s{0},109,.05,sumRowActive,.2,1',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.22. script08a.py: Evolving African Drum Patterns with a GA: Two Durations

# Evolving African Drum Patterns with a GA: Two Durations
from athenaCL.libATH import athenaObj
cmd = [        
'emo mp',
'tmo lg',
'tin a 61',
# bell line, set to loop
'tie r l,[(4,4,1),(4,4,1),(4,2,1),(4,4,1),(4,4,1),(4,4,1),(4,2,1)]',
# accent the first of each articulation
'tie a bg,oc,(1,.5,.5,.5,.5,.5,.5)',
'tin b 68',
# create genetic variations using a high mutation rate
'tie r gr,[(4,4,1),(4,4,1),(4,2,1),(4,4,1),(4,4,1),(4,4,1),(4,2,1)],.7,.25,0',
'tie a bg,oc,(1,.5,.5,.5,.5,.5,.5)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.23. script08b.py: Evolving African Drum Patterns with a GA: Combinations of Rests and Silences

# Evolving African Drum Patterns with a GA: Combinations of Rests and Silences
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [        
'emo mp',
'tmo lg',
'tin a 61',
# kagan line, set to loop
'tie r l,[(4,2,0),(4,2,1),(4,2,1),(4,2,0),(4,2,1),(4,2,1),(4,2,0), (4,2,1),(4,2,1),(4,2,0),(4,2,1),(4,2,1)]',
# accent the first of each articulation
'tie a bg,oc,(.5,1,.5, .5,.5,.5, .5,.5,.5, .5,.5,.5)',
# turning on silence mode will use parameters even for rests
'timode s on',
'tin b 68',
# create genetic variations using a high crossover, no mutation
'tie r gr,[(4,2,0),(4,2,1),(4,2,1),(4,2,0),(4,2,1),(4,2,1),(4,2,0), (4,2,1),(4,2,1),(4,2,0),(4,2,1),(4,2,1)],1,0,0',
'tie a bg,oc,(.5,1,.5, .5,.5,.5, .5,.5,.5, .5,.5,.5)',
# turning on silence mode will use parameters even for rests
'timode s on',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.24. script08c.py: Evolving African Drum Patterns with a GA: Multiple Rhythmic Values

# Evolving African Drum Patterns with a GA: Multiple Rhythmic Values
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [        
'emo mp',
'tmo lg',
'tin a 61',
# kroboto line, set to loop
'tie r l,[(4,3,1),(4,1,1),(4,2,1),(4,2,1),(4,1,1),(4,1,1),(4,2,1), (4,3,1),(4,1,1),(4,2,1),(4,2,1),(4,1,1),(4,1,1),(4,2,1)]',
# accent the first of each articulation
'tie a bg,oc,(1,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5)',
'tin b 68',
# create genetic variations using a high crossover and mutation rate and some elitism
'tie r gr,[(4,3,1),(4,1,1),(4,2,1),(4,2,1),(4,1,1),(4,1,1),(4,2,1), (4,3,1),(4,1,1),(4,2,1),(4,2,1),(4,1,1),(4,1,1),(4,2,1)],.9,.25,0.1',
'tie a bg,oc,(1,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.25. script08d.py: Evolving African Drum Patterns with a GA: Multiple Rhythmic Values

# Evolving African Drum Patterns with a GA: Multiple Rhythmic Values
from athenaCL.libATH import athenaObj
cmd = [        
'emo mp',
'tmo lg',
'tin a 45',
'tie r gr,[(4,4,1),(4,4,1),(4,2,1),(4,4,1),(4,4,1),(4,4,1),(4,2,1)],.7,.15,0',
'tie a bg,oc,(1,.5,.5,.5,.5,.5,.5)',
'tin b 60',
# create genetic variations using a high crossover, no mutation
'tie r gr,[(4,2,0),(4,2,1),(4,2,1),(4,2,0),(4,2,1),(4,2,1),(4,2,0), (4,2,1),(4,2,1),(4,2,0),(4,2,1),(4,2,1)],1,0,0',
'tie a bg,oc,(.5,1,.5, .5,.5,.5, .5,.5,.5, .5,.5,.5)',
# turning on silence mode will use parameters even for rests
'timode s on',
'tin c 68',  
# create genetic variations using a high crossover and mutation rate and some elitism
'tie r gr,[(4,3,1),(4,1,1),(4,2,1),(4,2,1),(4,1,1),(4,1,1),(4,2,1), (4,3,1),(4,1,1),(4,2,1),(4,2,1),(4,1,1),(4,1,1),(4,2,1)],.9,.25,0.1',
'tie a bg,oc,(1,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5)',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.26. script09a.py: Grammar States as Accent Patterns

# Grammar States as Accent Patterns
from athenaCL.libATH import athenaObj
cmd = [        
'emo mp',
'tmo lg',
'tin a 60',
# non deterministic binary algae generator applied to accent
'tie r pt,(c,8),(c,1),(gt,a{0}b{1}@a{ab}b{a|aaa}@b,10,oc)',
'tie a c,1',
# four state deterministic applied to pulse multiplier
'tie r pt,(c,8), (gt,a{1}b{2}c{4}d{8}@a{ab}b{cd}c{aadd}d{bc}@ac,10,oc),(c,1)',
# four state deterministic applied to amplitude with different start string
'tie a gt,a{.25}b{.5}c{.75}d{1}@a{ab}b{cd}c{aadd}d{bc}@bbc,6,oc',
# four state deterministic applied to transposition with different start string
'tie f gt,a{0}b{1}c{2}d{3}@a{ab}b{cd}c{aadd}d{bc}@dc,6,oc',
# four state non-deterministic applied to transposition with different start string
'tie f gt,a{0}b{1}c{2}d{3}@a{ab}b{cd|aa}c{aadd|cb}d{bc|a}@dc,6,oc',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.27. script09b.py: Grammar States as Pitch Values

# Grammar States as Pitch Values
from athenaCL.libATH import athenaObj
cmd = [        
'emo m',
'tmo lg',
'tin a 32',
# four state deterministic applied to pulse multiplier
'tie r pt,(c,8), (gt,a{1}b{2}c{4}d{8}@a{ab}b{cd}c{aadd}d{bc}@ac,8,oc),(c,1)',
'tie o c,-2',
# four state deterministic applied to transposition with different start string
'tie f gt,a{0}b{7}c{8}d{2}@a{ab}b{cd}c{aadd}d{bc}@ad,6,oc',
# four state deterministic applied to amplitude with different start string
'tie a gt,a{.25}b{.5}c{.75}d{1}@a{ab}b{cd}c{aadd}d{bc}@bbc,6,oc',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.28. script09c.py: Grammar States as Pitch Transpositions

# Grammar States as Pitch Transpositions
from athenaCL.libATH import athenaObj
cmd = [        
'emo m',
'tmo lg',
'tin a 15',
#four state deterministic applied to pulse multiplier
'tie r pt,(c,8), (gt,a{1}b{2}c{4}d{8}@a{ab}b{cd}c{aadd}d{bc}@ac,8,oc),(c,1)',
#four state deterministic applied to accumulated transposition with different start string
'tie f a,0,(gt,a{1}b{-1}c{7}d{-7}@a{ab}b{cd}c{ad}d{bc}@ac,10,oc)',
# four state deterministic applied to amplitude with different start string
'tie a gt,a{.25}b{.5}c{.75}d{1}@a{ab}b{cd}c{aadd}d{bc}@bbc,6,oc',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.29. script09d.py: Grammar States as Path Index Values

# Grammar States as Path Index Values
from athenaCL.libATH import athenaObj
cmd = [        
'emo m',
# create a single, large Multiset using a sieve
'pin a 5@0|7@2,c2,c7',
'tmo ha',
'tin a 6',
# constant rhythm
'tie r pt,(c,4),(c,1),(c,1)',
# select only Multiset 0
'tie d0 c,0',
# select pitches from Multiset using accumulated deterministic grammar starting at 12
'tie d1 a,12,(gt,a{1}b{-1}c{2}d{-2}@a{ab}b{cd}c{ad}d{bc}@ac,10,oc)',
# create only 1 simultaneity from each multiset; create only 1-element simultaneities
'tie d2 c,1',
'tie d3 c,1',
# four state deterministic applied to amplitude with different start string
'tie a gt,a{.25}b{.5}c{.75}d{1}@a{ab}b{cd}c{aadd}d{bc}@bbc,6,oc',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.30. script10a.py: Feedback System as Dynamic Contour

# Feedback System as Dynamic Contour
from athenaCL.libATH import athenaObj
ath = athenaObj.Interpreter()
cmd = [        
'emo mp',
'tmo lg',
'tin a 66',
# constant pulse
'tie r pt,(c,8),(c,1),(c,1)',
# amplitude controlled by Thermostat feedback
'tie a fml,t,(bg,rc,(1,1.5,2))',
# using convert second to set durations
'tie r cs,(fml,t,(c,1),(c,.7),.001,.400)',
# amplitude controlled by Climate Control feedback
'tie a fml,cc,(bg,rc,(.5,1,1.5)),(c,.7),0,1',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)

F.1.31. script10b.py: Feedback System as Path Index Values

# Feedback System as Path Index Values
from athenaCL.libATH import athenaObj
cmd = [        
'emo m',
# create a single, large Multiset using a sieve
'pin a 5@1|7@4,c2,c7',
'tmo ha',
'tin a 107',
# constant rhythm
'tie r pt,(c,4),(c,1),(c,1)',
# select only Multiset 0
'tie d0 c,0',
# create only 1 simultaneity from each multiset; create only 1-element simultaneities
'tie d2 c,1',
'tie d3 c,1',
# select pitches from Multiset using Thermostat
'tie d1 fml,t,(bg,rc,(1,1.5,2)),(c,.7),0,18',
# select pitches from Multiset using Climate Control
'tie d1 fml,cc,(bg,rc,(.5,1,1.5)),(c,.7),0,18',
]
def main(cmdList=[], fp=None, hear=True):
    ath = athenaObj.Interpreter()
    for line in cmdList:
        ath.cmd(line)
    if fp == None:
        ath.cmd('eln') 
    else:
        ath.cmd('eln %s' % fp)
    if hear:
        ath.cmd('elh') 
if __name__ == '__main__':
    main(cmd)