extensions [ sound ] ;--------------------------------------------------------------------------- ;Joseph Wanka ;(847) 800-4022 ;j-wanka@northwestern.edu ;josephwanka@yahoo.com globals [ ensemble-file ensemble-name offset-base-no precision-no from-moment this-moment waitm wait1 wait2 wait3 wait4 wait5 wait6 wait7 wait8 wait9 wait10 wait11 playm-next play1-next play2-next play3-next play4-next play5-next play6-next play7-next play8-next play9-next play10-next play11-next phrase-list metronome-list playingm? playing1? playing2? playing3? playing4? playing5? playing6? playing7? playing8? playing9? playing10? playing11? foremost hindmost middle minimum-vol maximum-vol median-vol average-vol turtlem-timer turtle1-timer turtle2-timer turtle3-timer turtle4-timer turtle5-timer turtle6-timer turtle7-timer turtle8-timer turtle9-timer turtle10-timer turtle11-timer turtlem-elapsed turtle1-elapsed turtle2-elapsed turtle3-elapsed turtle4-elapsed turtle5-elapsed turtle6-elapsed turtle7-elapsed turtle8-elapsed turtle9-elapsed turtle10-elapsed turtle11-elapsed playerm-start player1-start player2-start player3-start player4-start player5-start player6-start player7-start player8-start player9-start player10-start player11-start playerm-synced player1-synced player2-synced player3-synced player4-synced player5-synced player6-synced player7-synced player8-synced player9-synced player10-synced player11-synced random-move1 random-move2 random-move3 random-move4 random-move5 random-move6 random-move7 random-move8 random-move9 random-move10 random-move11 player1-transformed-pitchlist player2-transformed-pitchlist player3-transformed-pitchlist player4-transformed-pitchlist player5-transformed-pitchlist player6-transformed-pitchlist player7-transformed-pitchlist player8-transformed-pitchlist player9-transformed-pitchlist player10-transformed-pitchlist player11-transformed-pitchlist ] ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup-players crt 12 carefully [ ask turtle 0 [die] ] [] ask turtles [ set color gray set shape "person" set size 3.0 ] ask turtle 1 [ set label "1" setxy 0 14 ] ask turtle 2 [ set label "2" setxy 0 11 ] ask turtle 3 [ set label "3" setxy 0 8 ] ask turtle 4 [ set label "4" setxy 0 5 ] ask turtle 5 [ set label "5" setxy 0 2 ] ask turtle 6 [ set label "6" setxy 0 -1 ] ask turtle 7 [ set label "7" setxy 0 -4 ] ask turtle 8 [ set label "8" setxy 0 -7 ] ask turtle 9 [ set label "9" setxy 0 -10 ] ask turtle 10 [ set label "10" setxy 0 -13 ] ask turtle 11 [ set label "11" setxy 0 -16 ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to kill-players ct ;;ask turtles [die] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to reset set waitm 0 set playm-next 0 set playingm? false set play.m true set volume.m 64 ;set octave.m 0 ;set phrase.m "A" set wait1 0 set play1-next 0 set playing1? false set canon.1 false set play.1 false set volume.1 64 ;set octave.1 0 set offset.1 "none" set sync1-to "m" set phrase.1 0 set transform.1 "none" set wait2 0 set play2-next 0 set playing2? false set canon.2 false set play.2 false set volume.2 64 ;set octave.2 0 set offset.2 "none" set sync2-to "m" set phrase.2 0 set transform.2 "none" set wait3 0 set play3-next 0 set playing3? false set canon.3 false set play.3 false set volume.3 64 ;set octave.3 0 set offset.3 "none" set sync3-to "m" set phrase.3 0 set transform.3 "none" set wait4 0 set play4-next 0 set playing4? false set canon.4 false set play.4 false set volume.4 64 ;set octave.4 0 set offset.4 "none" set sync4-to "m" set phrase.4 0 set transform.4 "none" set wait5 0 set play5-next 0 set playing5? false set canon.5 false set play.5 false set volume.5 64 ;set octave.5 0 set offset.5 "none" set sync5-to "m" set phrase.5 0 set transform.5 "none" set wait6 0 set play6-next 0 set playing6? false set canon.6 false set play.6 false set volume.6 64 ;set octave.6 0 set offset.6 "none" set sync6-to "m" set phrase.6 0 set transform.6 "none" set wait7 0 set play7-next 0 set playing7? false set canon.7 false set play.7 false set volume.7 64 ;set octave.7 0 set offset.7 "none" set sync7-to "m" set phrase.7 0 set transform.7 "none" set wait8 0 set play8-next 0 set playing8? false set canon.8 false set play.8 false set volume.8 64 ;set octave.8 0 set offset.8 "none" set sync8-to "m" set phrase.8 0 set transform.8 "none" set wait9 0 set play9-next 0 set playing9? false set canon.9 false set play.9 false set volume.9 64 ;set octave.9 0 set offset.9 "none" set sync9-to "m" set phrase.9 0 set transform.9 "none" set wait10 0 set play10-next 0 set playing10? false set canon.10 false set play.10 false set volume.10 64 ;set octave.10 0 set offset.10 "none" set sync10-to "m" set phrase.10 0 set transform.10 "none" set wait11 0 set play11-next 0 set playing11? false set canon.11 false set play.11 false set volume.11 64 ;set octave.11 0 set offset.11 "none" set sync11-to "m" set phrase.11 0 set transform.11 "none" set foremost 0 set hindmost 0 set turtle1-elapsed 0 set turtle2-elapsed 0 set turtle3-elapsed 0 set turtle4-elapsed 0 set turtle5-elapsed 0 set turtle6-elapsed 0 set turtle7-elapsed 0 set turtle8-elapsed 0 set turtle9-elapsed 0 set turtle10-elapsed 0 set turtle11-elapsed 0 set turtle1-timer 0 set turtle2-timer 0 set turtle3-timer 0 set turtle4-timer 0 set turtle5-timer 0 set turtle6-timer 0 set turtle7-timer 0 set turtle8-timer 0 set turtle9-timer 0 set turtle10-timer 0 set turtle11-timer 0 ;reset auto functions set phrase false set canon false set octave false set play false set volume false set offset false set transform false set min-play 5 set max-play 9 set last-agent-play true set duration 90 set probability 500 set jump-to 0 set reset-syncing "all" ;set ensemble-file "" if ensemble-name = 0.0 [set ensemble-name ""] set from-moment "" ;transformation parameters set direction "none" set transpose-by "none" set max-transforming 0 set augmentation false set inversion false set reiteration false set retrograde false set subtraction false set transposition false set augment-by "none" ;offsetting set max-offsetting 0 set finest-offset "eighth" set minimum-vol 0 set maximum-vol 0 set average-vol 0 set min-vol 34 set max-vol 94 set player1-synced false set player2-synced false set player3-synced false set player4-synced false set player5-synced false set player6-synced false set player7-synced false set player8-synced false set player9-synced false set player10-synced false set player11-synced false set playerm-start 0 set player1-start 0 set player2-start 0 set player3-start 0 set player4-start 0 set player5-start 0 set player6-start 0 set player7-start 0 set player8-start 0 set player9-start 0 set player10-start 0 set player11-start 0 set player1-transformed-pitchlist [""] set player2-transformed-pitchlist [""] set player3-transformed-pitchlist [""] set player4-transformed-pitchlist [""] set player5-transformed-pitchlist [""] set player6-transformed-pitchlist [""] set player7-transformed-pitchlist [""] set player8-transformed-pitchlist [""] set player9-transformed-pitchlist [""] set player10-transformed-pitchlist [""] set player11-transformed-pitchlist [""] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup if name = "none" [set phrase-list [""] ] if name = "Timing Tester" [setup-timing-tester ] if name = "In C" [setup-composition-in-c ] if name = "Texture" [setup-composition-texture ] setup-metronome-patterns kill-players setup-players reset set precision-no 3 end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup-metronome-patterns set metronome-list [ "A" [ 72 "eighth" "rest" "eighth" 60 "eighth" "rest" "eighth" 60 "eighth" "rest" "eighth" 60 "eighth" "rest" "eighth" ] "B" [ 60 "eighth" "rest" "eighth" 60 "eighth" "rest" "eighth" 60 "eighth" "rest" "eighth" 60 "eighth" "rest" "eighth" ] "C" [ 72 "eighth" 60 "eighth" 60 "eighth" 60 "eighth" 60 "eighth" 60 "eighth" 60 "eighth" 60 "eighth" ] "D" [ 72 "eighth" 67 "eighth" 60 "eighth" 67 "eighth" 60 "eighth" 67 "eighth" 60 "eighth" 67 "eighth" ] "E" [ 84 "sixteenth" 60 "sixteenth" 67 "sixteenth" 60 "sixteenth" 72 "sixteenth" 60 "sixteenth" 67 "sixteenth" 60 "sixteenth" 72 "sixteenth" 60 "sixteenth" 67 "sixteenth" 60 "sixteenth" 72 "sixteenth" 60 "sixteenth" 67 "sixteenth" 60 "sixteenth" ] ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup-timing-tester set phrase-list [ 0 [ "rest" "whole" ] 1 [ 60 "whole" ] 2 [ 60 "half" 62 "half" ] 3 [ 60 "quarter" 62 "quarter" 64 "quarter" 66 "quarter" ] 4 [ 62 "eighth" 64 "eighth" 66 "eighth" 68 "eighth" 70 "eighth" 72 "eighth" 74 "eighth" 76 "eighth" ] 5 [ 60 "sixteenth" 62 "sixteenth" 64 "sixteenth" 66 "sixteenth" 68 "sixteenth" 70 "sixteenth" 72 "sixteenth" 74 "sixteenth" 60 "sixteenth" 62 "sixteenth" 64 "sixteenth" 66 "sixteenth" 68 "sixteenth" 70 "sixteenth" 72 "sixteenth" 74 "sixteenth" ] 6 [ 60 "thirtysecond" 62 "thirtysecond" 64 "thirtysecond" 66 "thirtysecond" 68 "thirtysecond" 70 "thirtysecond" 72 "thirtysecond" 74 "thirtysecond" 60 "thirtysecond" 62 "thirtysecond" 64 "thirtysecond" 66 "thirtysecond" 68 "thirtysecond" 70 "thirtysecond" 72 "thirtysecond" 74 "thirtysecond" 60 "thirtysecond" 62 "thirtysecond" 64 "thirtysecond" 66 "thirtysecond" 68 "thirtysecond" 70 "thirtysecond" 72 "thirtysecond" 74 "thirtysecond" 60 "thirtysecond" 62 "thirtysecond" 64 "thirtysecond" 66 "thirtysecond" 68 "thirtysecond" 70 "thirtysecond" 72 "thirtysecond" 74 "thirtysecond" ] 7 [ 60 "sixteenth" 62 "sixteenth" 64 "sixteenth" 66 "sixteenth" 68 "sixteenth" 70 "sixteenth" 72 "sixteenth" 74 "sixteenth" 60 "sixteenth" 62 "sixteenth" 64 "sixteenth" 66 "sixteenth" 68 "sixteenth" 70 "sixteenth" 72 "sixteenth" 74 "sixteenth" ] 8 [ 60 "eighth" 62 "eighth" 64 "eighth" 66 "eighth" 68 "eighth" 70 "eighth" 72 "eighth" 74 "eighth" ] 9 [ 60 "quarter" 62 "quarter" 64 "quarter" 66 "quarter" ] 10 [ 60 "half" 62 "half" ] 11 [ 60 "whole" ] 12 [ "rest" "whole" ] ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup-composition-in-c set phrase-list [ 0 [ "rest" "whole" "rest" "whole" ] 1 [ 64 "dotted eighth" "rest" "sixteenth" 64 "dotted eighth" "rest" "sixteenth" 64 "dotted eighth" "rest" "sixteenth" ] 2 [ 64 "eighth" 65 "eighth" 64 "eighth";* "rest" "eighth" ] 3 [ "rest" "eighth" 64 "eighth" 65 "eighth" 64 "eighth" ] 4 [ "rest" "eighth" 64 "eighth" 65 "eighth" 67 "eighth" ] 5 [ 64 "eighth" 65 "eighth" 67 "eighth" "rest" "eighth" ] 6 [ 72 "dotted half";* "rest" "quarter" 72 "dotted half";* "rest" "quarter" ] 7 [ "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" "rest" "eighth" 60 "thirtysecond";* "rest" "thirtysecond" 60 "thirtysecond";* "rest" "thirtysecond" 60 "eighth" "rest" "eighth" "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" ] 8 [ 67 "dotted whole" 65 "dotted half" "rest" "quarter";* 65 "whole" ] 9 [ 71 "sixteenth" 67 "sixteenth" "rest" "eighth" "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" ] 10 [ 71 "sixteenth" 67 "sixteenth" ] 11 [ 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" ] 12 [ 65 "eighth" 67 "eighth" 71 "whole" 72 "quarter" ] 13 [ 71 "sixteenth" 67 "eighth";* "rest" "sixteenth" 67 "sixteenth" 65 "sixteenth" 67 "sixteenth" "rest" "dotted eighth" 65 "sixteenth and dotted quarter";tied ] 14 [ 72 "whole" 71 "whole" 67 "whole" 66 "whole" ] 15 [ 67 "sixteenth" "rest" "dotted eighth" "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" ] 16 [ 67 "sixteenth" 71 "sixteenth" 72 "sixteenth" 71 "sixteenth" ] 17 [ 71 "sixteenth" 72 "sixteenth" 71 "sixteenth" 72 "sixteenth" 71 "sixteenth" "rest" "sixteenth";??? ] 18 [ 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 64 "eighth";* "rest" "sixteenth" 64 "thirtysecond";* "rest" "thirtysecond" ] 19 [ "rest" "dotted sixteenth" ;??? 79 "dotted quarter" ] 20 [ 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 55 "dotted eighth" 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 64 "thirtysecond";* "rest" "thirtysecond" ] 21 [ 66 "half";* ;F# "rest" "quarter" ] 22 [ 64 "quarter";* ;E "rest" "eighth" 64 "quarter";* ;E "rest" "eighth" 64 "quarter";* ;E "rest" "eighth" 64 "quarter";* ;E "rest" "eighth" 64 "quarter";* ;E "rest" "eighth" 66 "dotted quarter" ;F# 67 "dotted quarter" ;G 69 "dotted quarter" ;A 71 "eighth" ;B ] 23 [ 64 "eighth" ;E 66 "quarter";* ;F# "rest" "eighth" 66 "quarter";* ;F# "rest" "eighth" 66 "quarter";* ;F# "rest" "eighth" 66 "quarter";* ;F# "rest" "eighth" 66 "dotted quarter" ;F# 67 "dotted quarter" ;G 69 "dotted quarter" ;A 71 "quarter" ;B ] 24 [ 64 "eighth" 66 "eighth" 67 "quarter";* "rest" "eighth" 67 "quarter";* "rest" "eighth" 67 "quarter";* "rest" "eighth" 67 "quarter";* "rest" "eighth" 67 "dotted quarter" 69 "dotted quarter" 71 "eighth" ] 25 [ 64 "eighth" 66 "eighth" 67 "eighth" 69 "quarter";* "rest" "eighth" 69 "quarter";* "rest" "eighth" 69 "quarter";* "rest" "eighth" 69 "quarter";* "rest" "eighth" 69 "dotted quarter" 71 "dotted quarter" ] 26 [ 64 "eighth" 66 "eighth" 67 "eighth" 69 "eighth" 71 "quarter";* "rest" "eighth" 71 "quarter";* "rest" "eighth" 71 "quarter";* "rest" "eighth" 71 "quarter";* "rest" "eighth" 71 "dotted quarter" ] 27 [ 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 67 "eighth" 64 "sixteenth" 67 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 64 "thirtysecond";* "rest" "thirtysecond" ] 28 [ 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 64 "quarter";* "rest" "eighth" 64 "thirtysecond";* "rest" "thirtysecond" ] 29 [ 64 "dotted half" 67 "dotted half" 72 "dotted half" ] 30 [ 72 "dotted whole" "rest" "eighth" ;temporary ] 31 [ 67 "sixteenth" 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" 71 "sixteenth" ] 32 [ 65 "sixteenth" 67 "sixteenth" 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" 65 "sixteenth and dotted half";tied 67 "dotted quarter" ] 33 [ 67 "sixteenth" 65 "sixteenth" "rest" "eighth" ] 34 [ 67 "sixteenth" 65 "sixteenth" ] 35 [ 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" "rest" "eighth" "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" 70 "quarter" 79 "dotted half" 81 "eighth" 79 "eighth and eighth";tied 83 "eighth" 81 "dotted quarter" 79 "eighth" 76 "dotted half" 79 "eighth" 78 "eighth and dotted half";tied "rest" "sixteenth" "rest" "sixteenth" "rest" "eighth" 76 "eighth and half";tied 77 "dotted whole" ] 36 [ 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" 71 "sixteenth" 67 "sixteenth" ] 37 [ 65 "sixteenth" 67 "sixteenth" ] 38 [ 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" ] 39 [ 71 "sixteenth" 67 "sixteenth" 65 "sixteenth" 67 "sixteenth" 71 "sixteenth" 72 "sixteenth" ] 40 [ 71 "sixteenth" 65 "sixteenth" ] 41 [ 71 "sixteenth" 67 "sixteenth" ] 42 [ 72 "whole" 71 "whole" 69 "whole" 72 "dotted half";* "rest" "quarter" ] 43 [ 77 "sixteenth" 76 "sixteenth" 77 "sixteenth" 76 "thirtysecond";* "rest" "thirtysecond" 76 "sixteenth";* "rest" "sixteenth" 76 "sixteenth";* "rest" "sixteenth" 76 "eighth" 77 "sixteenth" 76 "sixteenth" ] 44 [ 77 "eighth" 76 "eighth and eighth";tied 76 "eighth" 72 "quarter" ] 45 [ 74 "eighth";* "rest" "eighth" 74 "quarter" 67 "quarter" ] 46 [ 67 "sixteenth" 74 "sixteenth" 76 "sixteenth" 74 "sixteenth" "rest" "eighth" 67 "eighth" "rest" "eighth" 67 "eighth" "rest" "eighth" 67 "sixteenth";* "rest" "sixteenth" 67 "sixteenth" 74 "sixteenth" 76 "sixteenth" 74 "sixteenth" ] 47 [ 74 "sixteenth" 76 "sixteenth" 74 "sixteenth";* "rest" "sixteenth" ] 48 [ 67 "whole";* "rest" "half" 67 "whole" 65 "dotted half" "rest" "quarter";* 65 "quarter" ] 49 [ 65 "sixteenth" 67 "sixteenth" 70 "sixteenth" 67 "sixteenth" 70 "sixteenth" 67 "sixteenth" ] 50 [ 65 "sixteenth" 67 "sixteenth" ] 51 [ 65 "sixteenth" 67 "sixteenth" 70 "sixteenth" ] 52 [ 67 "sixteenth" 70 "sixteenth" ] 53 [ 70 "sixteenth" 67 "sixteenth" ] 54 [ "rest" "whole" "rest" "whole" ] 55 [ "rest" "whole" "rest" "whole" ] 56 [ "rest" "whole" "rest" "whole" ] ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup-generic-composition set phrase-list [ 0 [ "rest" "whole" ] 1 [ ;phrase 1 ] 2 [ ;phrase 2 ] 3 [ ;phrase ] 4 [ ;phrase 4 ] 5 [ ;phrase ] 6 [ ;phrase 6 ] 7 [ ;phrase 7 ] 8 [ ;phrase 8 ] 9 [ ;phrase 9 ] 10 [ ;phrase 10 ] 11 [ "rest" "whole" ] ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to setup-composition-texture set phrase-list [ 0 [ "rest" "whole" ] 1 [ 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 60 "sixteenth" "rest" "sixteenth" 64 "sixteenth" 66 "sixteenth" 64 "sixteenth" 66 "sixteenth" 68 "sixteenth" "rest" "sixteenth" ] 2 [ 58 "sixteenth" "rest" "sixteenth" 58 "sixteenth" "rest" "sixteenth" 60 "sixteenth" "rest" "sixteenth" "rest" "sixteenth" "rest" "sixteenth" 60 "sixteenth" "rest" "sixteenth" 66 "sixteenth" "rest" "sixteenth" ] 3 [ "rest" "whole" ] ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to go if timer > playm-next and play.m = true [play-m] if timer > play1-next and play.1 = true [play-1] if timer > play2-next and play.2 = true [play-2] if timer > play3-next and play.3 = true [play-3] if timer > play4-next and play.4 = true [play-4] if timer > play5-next and play.5 = true [play-5] if timer > play6-next and play.6 = true [play-6] if timer > play7-next and play.7 = true [play-7] if timer > play8-next and play.8 = true [play-8] if timer > play9-next and play.9 = true [play-9] if timer > play10-next and play.10 = true [play-10] if timer > play11-next and play.11 = true [play-11] if play.1 = false [ set playing1? false set player1-synced false set turtle1-elapsed 0 ] if play.2 = false [ set playing2? false set player2-synced false set turtle2-elapsed 0 ] if play.3 = false [ set playing3? false set player3-synced false set turtle3-elapsed 0 ] if play.4 = false [ set playing4? false set player4-synced false set turtle4-elapsed 0 ] if play.5 = false [ set playing5? false set player5-synced false set turtle5-elapsed 0 ] if play.6 = false [ set playing6? false set player6-synced false set turtle6-elapsed 0 ] if play.7 = false [ set playing7? false set player7-synced false set turtle7-elapsed 0 ] if play.8 = false [ set playing8? false set player8-synced false set turtle8-elapsed 0 ] if play.9 = false [ set playing9? false set player9-synced false set turtle9-elapsed 0 ] if play.10 = false [ set playing10? false set player10-synced false set turtle10-elapsed 0 ] if play.11 = false [ set playing11? false set player11-synced false set turtle11-elapsed 0 ] sync-timers update-world calc-average-volume calc-middle-measure turtle-time2 set offset-base-no 0 ;if finest-offset is set to "none" ifelse finest-offset = "none" [set offset-base-no 0] [ ifelse finest-offset = "quarter" [set offset-base-no 2] [ ifelse finest-offset = "eighth" [set offset-base-no 3] [set offset-base-no 4] ;only other option is "sixteenth" ] ] set minimum-vol get-softest set maximum-vol get-loudest set hindmost get-hindmost set foremost get-foremost end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to update-world ask turtles with [member? (word hindmost) label][ set xcor -4] if hindmost + 1 = foremost - 1 [ ask turtles with [member? (word (foremost - 1)) label][ set xcor 4] ] ask turtles with [member? (word foremost) label][ set xcor 12] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-m let i 0 set waitm 0 let number-of-notes (length get-phrase "metronome" phrase.m) / 2 let loop-duration get-duration get-phrase "metronome" phrase.m let local-list (get-phrase "metronome" phrase.m) ifelse playingm? = false [ ;set playm-next precision (timer + loop-duration * loops-m) 3 set playm-next precision (timer + loop-duration) 3 set playingm? true ] [ ;set playm-next precision (playm-next + loop-duration * loops-m) 3 set playm-next precision (playm-next + loop-duration) 3 ] ;while [i < loops-m][ let q 0 let note-dur 0 while [q < length local-list][ if is-number? item q local-list [ note waitm + note-dur instrument.m ((item q local-list) + (12 * octave.m)) volume.m get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] set waitm waitm + loop-duration set i i + 1 ;] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-1 let i 0 set wait1 0 let number-of-notes (length get-phrase "phrase" phrase.1) / 2 let loop-duration get-duration get-phrase "phrase" phrase.1 let local-list (get-phrase "phrase" phrase.1) ;select the transformation... ;....................................................................... ifelse transform.1 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.1 = "inversion" [set local-list evaluate-transformation local-list 1 "inversion"] [ ifelse transform.1 = "subtraction" [set local-list subtract local-list] [ ifelse transform.1 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.1 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.1 = "transposition" [set local-list evaluate-transformation local-list 1 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing1? = false [ let initial-offset-1 0 if offset.1 != "none" [ ifelse offset.1 = "quarter" [set initial-offset-1 quarter] [ ifelse offset.1 = "eighth" [set initial-offset-1 eighth] [set initial-offset-1 sixteenth] ] ] ifelse sync1-to = 2 and play.2 = true [set play1-next play2-next + initial-offset-1] [ifelse sync1-to = 3 and play.3 = true [set play1-next play3-next + initial-offset-1] [ifelse sync1-to = 4 and play.4 = true [set play1-next play4-next + initial-offset-1] [ifelse sync1-to = 5 and play.5 = true[set play1-next play5-next + initial-offset-1] [ifelse sync1-to = 6 and play.6 = true[set play1-next play6-next + initial-offset-1] [ifelse sync1-to = 7 and play.7 = true[set play1-next play7-next + initial-offset-1] [ifelse sync1-to = 8 and play.9 = true[set play1-next play8-next + initial-offset-1] [ifelse sync1-to = 9 and play.9 = true[set play1-next play9-next + initial-offset-1] [ifelse sync1-to = 10 and play.10 = true[set play1-next play10-next + initial-offset-1] [ifelse sync1-to = 11 and play.11 = true[set play1-next play11-next + initial-offset-1] [ifelse sync1-to = "m" [set play1-next playm-next + initial-offset-1][set play1-next playm-next + initial-offset-1]]]]]]]]]]] ] [ set play1-next precision (play1-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing1? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait1 + note-dur instrument.1 ((item q local-list) + (12 * octave.1)) volume.1 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing1? true ] set wait1 wait1 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-2 let i 0 set wait2 0 let number-of-notes (length get-phrase "phrase" phrase.2) / 2 let loop-duration get-duration get-phrase "phrase" phrase.2 let local-list (get-phrase "phrase" phrase.2) ;select the transformation... ;....................................................................... ifelse transform.2 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.2 = "inversion" [set local-list evaluate-transformation local-list 2 "inversion"] [ ifelse transform.2 = "subtraction" [set local-list subtract local-list] [ ifelse transform.2 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.2 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.2 = "transposition" [set local-list evaluate-transformation local-list 2 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing2? = false [ let initial-offset-2 0 if offset.2 != "none" [ ifelse offset.2 = "quarter" [set initial-offset-2 quarter] [ ifelse offset.2 = "eighth" [set initial-offset-2 eighth] [set initial-offset-2 sixteenth] ] ] ifelse sync2-to = 1 and play.1 = true [set play2-next play1-next + initial-offset-2] [ifelse sync2-to = 3 and play.3 = true [set play2-next play3-next + initial-offset-2] [ifelse sync2-to = 4 and play.4 = true [set play2-next play4-next + initial-offset-2] [ifelse sync2-to = 5 and play.5 = true [set play2-next play5-next + initial-offset-2] [ifelse sync2-to = 6 and play.6 = true [set play2-next play6-next + initial-offset-2] [ifelse sync2-to = 7 and play.7 = true [set play2-next play7-next + initial-offset-2] [ifelse sync2-to = 8 and play.8 = true [set play2-next play8-next + initial-offset-2] [ifelse sync2-to = 9 and play.9 = true [set play2-next play9-next + initial-offset-2] [ifelse sync2-to = 10 and play.10 = true [set play2-next play10-next + initial-offset-2] [ifelse sync2-to = 11 and play.11 = true [set play2-next play11-next + initial-offset-2] [ifelse sync2-to = "m" [set play2-next playm-next + initial-offset-2][set play2-next playm-next + initial-offset-2]]]]]]]]]]] ] [ set play2-next precision (play2-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing2? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait2 + note-dur instrument.2 ((item q local-list) + (12 * octave.2)) volume.2 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing2? true ] set wait2 wait2 + loop-duration set i i + 1 end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-3 let i 0 set wait3 0 let number-of-notes (length get-phrase "phrase" phrase.3) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.3) 3 let local-list (get-phrase "phrase" phrase.3) ;select the transformation... ;....................................................................... ifelse transform.3 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.3 = "inversion" [set local-list evaluate-transformation local-list 3 "inversion"] [ ifelse transform.3 = "subtraction" [set local-list subtract local-list] [ ifelse transform.3 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.3 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.3 = "transposition" [set local-list evaluate-transformation local-list 3 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing3? = false [ let initial-offset-3 0 if offset.3 != "none" [ ifelse offset.3 = "quarter" [set initial-offset-3 quarter] [ ifelse offset.3 = "eighth" [set initial-offset-3 eighth] [set initial-offset-3 sixteenth] ] ] ifelse sync3-to = 1 and play.1 = true [set play3-next play1-next + initial-offset-3] [ifelse sync3-to = 2 and play.2 = true [set play3-next play2-next + initial-offset-3] [ifelse sync3-to = 4 and play.4 = true [set play3-next play4-next + initial-offset-3] [ifelse sync3-to = 5 and play.5 = true [set play3-next play5-next + initial-offset-3] [ifelse sync3-to = 6 and play.6 = true [set play3-next play6-next + initial-offset-3] [ifelse sync3-to = 7 and play.7 = true [set play3-next play7-next + initial-offset-3] [ifelse sync3-to = 8 and play.8 = true [set play3-next play8-next + initial-offset-3] [ifelse sync3-to = 9 and play.9 = true [set play3-next play9-next + initial-offset-3] [ifelse sync3-to = 10 and play.10 = true [set play3-next play10-next + initial-offset-3] [ifelse sync3-to = 11 and play.11 = true [set play3-next play11-next + initial-offset-3] [ifelse sync3-to = "m" [set play3-next playm-next + initial-offset-3][set play3-next playm-next + initial-offset-3]]]]]]]]]]] ] [ set play3-next precision (play3-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing3? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait3 + note-dur instrument.3 ((item q local-list) + (12 * octave.3)) volume.3 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing3? true ] set wait3 wait3 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-4 let i 0 set wait4 0 let number-of-notes (length get-phrase "phrase" phrase.4) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.4) 3 let local-list (get-phrase "phrase" phrase.4) ;select the transformation... ;....................................................................... ifelse transform.4 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.4 = "inversion" [set local-list evaluate-transformation local-list 4 "inversion"] [ ifelse transform.4 = "subtraction" [set local-list subtract local-list] [ ifelse transform.4 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.4 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.4 = "transposition" [set local-list evaluate-transformation local-list 4 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing4? = false [ let initial-offset-4 0 if offset.4 != "none" [ ifelse offset.4 = "quarter" [set initial-offset-4 quarter] [ ifelse offset.4 = "eighth" [set initial-offset-4 eighth] [set initial-offset-4 sixteenth] ] ] ifelse sync4-to = 1 and play.1 = true [set play4-next play1-next + initial-offset-4] [ifelse sync4-to = 2 and play.2 = true [set play4-next play2-next + initial-offset-4] [ifelse sync4-to = 3 and play.3 = true [set play4-next play3-next + initial-offset-4] [ifelse sync4-to = 5 and play.5 = true [set play4-next play5-next + initial-offset-4] [ifelse sync4-to = 6 and play.6 = true [set play4-next play6-next + initial-offset-4] [ifelse sync4-to = 7 and play.7 = true [set play4-next play7-next + initial-offset-4] [ifelse sync4-to = 8 and play.8 = true [set play4-next play8-next + initial-offset-4] [ifelse sync4-to = 9 and play.9 = true [set play4-next play9-next + initial-offset-4] [ifelse sync4-to = 10 and play.10 = true [set play4-next play10-next + initial-offset-4] [ifelse sync4-to = 11 and play.11 = true [set play4-next play11-next + initial-offset-4] [ifelse sync4-to = "m" [set play4-next playm-next + initial-offset-4][set play4-next playm-next + initial-offset-4]]]]]]]]]]] ] [ set play4-next precision (play4-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing4? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait4 + note-dur instrument.4 ((item q local-list) + (12 * octave.4)) volume.4 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing4? true ] set wait4 wait4 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-5 let i 0 set wait5 0 let number-of-notes (length get-phrase "phrase" phrase.5) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.5) 3 let local-list (get-phrase "phrase" phrase.5) ;select the transformation... ;....................................................................... ifelse transform.5 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.5 = "inversion" [set local-list evaluate-transformation local-list 5 "inversion"] [ ifelse transform.5 = "subtraction" [set local-list subtract local-list] [ ifelse transform.5 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.5 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.5 = "transposition" [set local-list evaluate-transformation local-list 5 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing5? = false [ let initial-offset-5 0 if offset.5 != "none" [ ifelse offset.5 = "quarter" [set initial-offset-5 quarter] [ ifelse offset.5 = "eighth" [set initial-offset-5 eighth] [set initial-offset-5 sixteenth] ] ] ifelse sync5-to = 1 and play.1 = true [set play5-next play1-next + initial-offset-5] [ifelse sync5-to = 2 and play.2 = true [set play5-next play2-next + initial-offset-5] [ifelse sync5-to = 3 and play.3 = true [set play5-next play3-next + initial-offset-5] [ifelse sync5-to = 4 and play.4 = true [set play5-next play4-next + initial-offset-5] [ifelse sync5-to = 6 and play.6 = true [set play5-next play6-next + initial-offset-5] [ifelse sync5-to = 7 and play.7 = true [set play5-next play7-next + initial-offset-5] [ifelse sync5-to = 8 and play.8 = true [set play5-next play8-next + initial-offset-5] [ifelse sync5-to = 9 and play.9 = true [set play5-next play9-next + initial-offset-5] [ifelse sync5-to = 10 and play.10 = true [set play5-next play10-next + initial-offset-5] [ifelse sync5-to = 11 and play.11 = true [set play5-next play11-next + initial-offset-5] [ifelse sync5-to = "m" [set play5-next playm-next + initial-offset-5][set play5-next playm-next + initial-offset-5]]]]]]]]]]] ] [ set play5-next precision (play5-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing5? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait5 + note-dur instrument.5 ((item q local-list) + (12 * octave.5)) volume.5 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing5? true ] set wait5 wait5 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-6 let i 0 set wait6 0 let number-of-notes (length get-phrase "phrase" phrase.6) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.6) 3 let local-list (get-phrase "phrase" phrase.6) ;select the transformation... ;....................................................................... ifelse transform.6 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.6 = "inversion" [set local-list evaluate-transformation local-list 6 "inversion"] [ ifelse transform.6 = "subtraction" [set local-list subtract local-list] [ ifelse transform.6 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.6 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.6 = "transposition" [set local-list evaluate-transformation local-list 6 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing6? = false [ let initial-offset-6 0 if offset.6 != "none" [ ifelse offset.6 = "quarter" [set initial-offset-6 quarter] [ ifelse offset.6 = "eighth" [set initial-offset-6 eighth] [set initial-offset-6 sixteenth] ] ] ifelse sync6-to = 1 and play.1 = true [set play6-next play1-next + initial-offset-6] [ifelse sync6-to = 2 and play.2 = true [set play6-next play2-next + initial-offset-6] [ifelse sync6-to = 3 and play.3 = true [set play6-next play3-next + initial-offset-6] [ifelse sync6-to = 4 and play.4 = true [set play6-next play4-next + initial-offset-6] [ifelse sync6-to = 5 and play.5 = true [set play6-next play5-next + initial-offset-6] [ifelse sync6-to = 7 and play.7 = true [set play6-next play7-next + initial-offset-6] [ifelse sync6-to = 8 and play.8 = true [set play6-next play8-next + initial-offset-6] [ifelse sync6-to = 9 and play.9 = true [set play6-next play9-next + initial-offset-6] [ifelse sync6-to = 10 and play.10 = true [set play6-next play10-next + initial-offset-6] [ifelse sync6-to = 11 and play.11 = true [set play6-next play11-next + initial-offset-6] [ifelse sync6-to = "m" [set play6-next playm-next + initial-offset-6][set play6-next playm-next + initial-offset-6]]]]]]]]]]] ] [ set play6-next precision (play6-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing6? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait6 + note-dur instrument.6 ((item q local-list) + (12 * octave.6)) volume.6 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing6? true ] set wait6 wait6 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-7 let i 0 set wait7 0 let number-of-notes (length get-phrase "phrase" phrase.7) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.7) 3 let local-list (get-phrase "phrase" phrase.7) ;select the transformation... ;....................................................................... ifelse transform.7 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.7 = "inversion" [set local-list evaluate-transformation local-list 7 "inversion"] [ ifelse transform.7 = "subtraction" [set local-list subtract local-list] [ ifelse transform.7 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.7 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.7 = "transposition" [set local-list evaluate-transformation local-list 7 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing7? = false [ let initial-offset-7 0 if offset.7 != "none" [ ifelse offset.7 = "quarter" [set initial-offset-7 quarter] [ ifelse offset.7 = "eighth" [set initial-offset-7 eighth] [set initial-offset-7 sixteenth] ] ] ifelse sync7-to = 1 and play.1 = true [set play7-next play1-next + initial-offset-7] [ifelse sync7-to = 2 and play.2 = true [set play7-next play2-next + initial-offset-7] [ifelse sync7-to = 3 and play.3 = true [set play7-next play3-next + initial-offset-7] [ifelse sync7-to = 4 and play.4 = true [set play7-next play4-next + initial-offset-7] [ifelse sync7-to = 5 and play.5 = true [set play7-next play5-next + initial-offset-7] [ifelse sync7-to = 6 and play.6 = true [set play7-next play6-next + initial-offset-7] [ifelse sync7-to = 8 and play.8 = true [set play7-next play8-next + initial-offset-7] [ifelse sync7-to = 9 and play.9 = true [set play7-next play9-next + initial-offset-7] [ifelse sync7-to = 10 and play.10 = true [set play7-next play10-next + initial-offset-7] [ifelse sync7-to = 11 and play.11 = true [set play7-next play11-next + initial-offset-7] [ifelse sync7-to = "m" [set play7-next playm-next + initial-offset-7][set play7-next playm-next + initial-offset-7]]]]]]]]]]] ] [ set play7-next precision (play7-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing7? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait7 + note-dur instrument.7 ((item q local-list) + (12 * octave.7)) volume.7 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing7? true ] set wait7 wait7 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-8 let i 0 set wait8 0 let number-of-notes (length get-phrase "phrase" phrase.8) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.8) 3 let local-list (get-phrase "phrase" phrase.8) ;select the transformation... ;....................................................................... ifelse transform.8 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.8 = "inversion" [set local-list evaluate-transformation local-list 8 "inversion"] [ ifelse transform.8 = "subtraction" [set local-list subtract local-list] [ ifelse transform.8 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.8 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.8 = "transposition" [set local-list evaluate-transformation local-list 8 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing8? = false [ let initial-offset-8 0 if offset.8 != "none" [ ifelse offset.8 = "eighth" [set initial-offset-8 eighth] [set initial-offset-8 sixteenth] ] ifelse sync8-to = 1 and play.1 = true [set play8-next play1-next + initial-offset-8] [ifelse sync8-to = 2 and play.2 = true [set play8-next play2-next + initial-offset-8] [ifelse sync8-to = 3 and play.3 = true [set play8-next play3-next + initial-offset-8] [ifelse sync8-to = 4 and play.4 = true [set play8-next play4-next + initial-offset-8] [ifelse sync8-to = 5 and play.5 = true [set play8-next play5-next + initial-offset-8] [ifelse sync8-to = 6 and play.6 = true [set play8-next play6-next + initial-offset-8] [ifelse sync8-to = 7 and play.7 = true [set play8-next play7-next + initial-offset-8] [ifelse sync8-to = 9 and play.9 = true [set play8-next play9-next + initial-offset-8] [ifelse sync8-to = 10 and play.10 = true [set play8-next play10-next + initial-offset-8] [ifelse sync8-to = 11 and play.11 = true [set play8-next play11-next + initial-offset-8] [ifelse sync8-to = "m" [set play8-next playm-next + initial-offset-8][set play8-next playm-next + initial-offset-8]]]]]]]]]]] ] [ set play8-next precision (play8-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing8? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait8 + note-dur instrument.8 ((item q local-list) + (12 * octave.8)) volume.8 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing8? true ] set wait8 wait8 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-9 let i 0 set wait9 0 let number-of-notes (length get-phrase "phrase" phrase.9) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.9) 3 let local-list (get-phrase "phrase" phrase.9) ;select the transformation... ;....................................................................... ifelse transform.9 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.9 = "inversion" [set local-list evaluate-transformation local-list 9 "inversion"] [ ifelse transform.9 = "subtraction" [set local-list subtract local-list] [ ifelse transform.9 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.9 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.9 = "transposition" [set local-list evaluate-transformation local-list 9 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing9? = false [ let initial-offset-9 0 if offset.9 != "none" [ ifelse offset.9 = "quarter" [set initial-offset-9 quarter] [ ifelse offset.9 = "eighth" [set initial-offset-9 eighth] [set initial-offset-9 sixteenth] ] ] ifelse sync9-to = 1 and play.1 = true [set play9-next play1-next + initial-offset-9] [ifelse sync9-to = 2 and play.2 = true [set play9-next play2-next + initial-offset-9] [ifelse sync9-to = 3 and play.3 = true [set play9-next play3-next + initial-offset-9] [ifelse sync9-to = 4 and play.4 = true [set play9-next play4-next + initial-offset-9] [ifelse sync9-to = 5 and play.5 = true [set play9-next play5-next + initial-offset-9] [ifelse sync9-to = 6 and play.6 = true [set play9-next play6-next + initial-offset-9] [ifelse sync9-to = 7 and play.7 = true [set play9-next play7-next + initial-offset-9] [ifelse sync9-to = 8 and play.8 = true [set play9-next play8-next + initial-offset-9] [ifelse sync9-to = 10 and play.10 = true [set play9-next play10-next + initial-offset-9] [ifelse sync9-to = 11 and play.11 = true [set play9-next play11-next + initial-offset-9] [ifelse sync9-to = "m" [set play9-next playm-next + initial-offset-9][set play9-next playm-next + initial-offset-9]]]]]]]]]]] ] [ set play9-next precision (play9-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing9? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait9 + note-dur instrument.9 ((item q local-list) + (12 * octave.9)) volume.9 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing9? true ] set wait9 wait9 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-10 let i 0 set wait10 0 let number-of-notes (length get-phrase "phrase" phrase.10) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.10) 3 let local-list (get-phrase "phrase" phrase.10) ;select the transformation... ;....................................................................... ifelse transform.10 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.10 = "inversion" [set local-list evaluate-transformation local-list 10 "inversion"] [ ifelse transform.10 = "subtraction" [set local-list subtract local-list] [ ifelse transform.10 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.10 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.10 = "transposition" [set local-list evaluate-transformation local-list 10 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing10? = false [ let initial-offset-10 0 if offset.10 != "none" [ ifelse offset.10 = "quarter" [set initial-offset-10 quarter] [ ifelse offset.10 = "eighth" [set initial-offset-10 eighth] [set initial-offset-10 sixteenth] ] ] ifelse sync10-to = 1 and play.1 = true [set play10-next play1-next + initial-offset-10] [ifelse sync10-to = 2 and play.2 = true [set play10-next play2-next + initial-offset-10] [ifelse sync10-to = 3 and play.3 = true [set play10-next play3-next + initial-offset-10] [ifelse sync10-to = 4 and play.4 = true [set play10-next play4-next + initial-offset-10] [ifelse sync10-to = 5 and play.5 = true [set play10-next play5-next + initial-offset-10] [ifelse sync10-to = 6 and play.6 = true [set play10-next play6-next + initial-offset-10] [ifelse sync10-to = 7 and play.7 = true [set play10-next play7-next + initial-offset-10] [ifelse sync10-to = 8 and play.8 = true [set play10-next play8-next + initial-offset-10] [ifelse sync10-to = 9 and play.9 = true [set play10-next play9-next + initial-offset-10] [ifelse sync10-to = 11 and play.11 = true [set play10-next play11-next + initial-offset-10] [ifelse sync10-to = "m" [set play10-next playm-next + initial-offset-10][set play10-next playm-next + initial-offset-10]]]]]]]]]]] ] [ set play10-next precision (play10-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing10? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait10 + note-dur instrument.10 ((item q local-list) + (12 * octave.10)) volume.10 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing10? true ] set wait10 wait10 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to play-11 let i 0 set wait11 0 let number-of-notes (length get-phrase "phrase" phrase.11) / 2 let loop-duration precision (get-duration get-phrase "phrase" phrase.11) 3 let local-list (get-phrase "phrase" phrase.11) ;select the transformation... ;....................................................................... ifelse transform.11 = "retrograde" [set local-list do-retrograde local-list] [ ifelse transform.11 = "inversion" [set local-list evaluate-transformation local-list 11 "inversion"] [ ifelse transform.11 = "subtraction" [set local-list subtract local-list] [ ifelse transform.11 = "reiteration" [ set local-list reiterate local-list set loop-duration get-duration local-list ] [ ifelse transform.11 = "augmentation" [ set local-list augment local-list set loop-duration get-duration local-list ] [ if transform.11 = "transposition" [set local-list evaluate-transformation local-list 11 "transposition"] ] ] ] ] ] ;........................................................................ ifelse playing11? = false [ let initial-offset-11 0 if offset.11 != "none" [ ifelse offset.11 = "quarter" [set initial-offset-11 quarter] [ ifelse offset.11 = "eighth" [set initial-offset-11 eighth] [set initial-offset-11 sixteenth] ] ] ifelse sync11-to = 1 and play.1 = true [set play11-next play1-next + initial-offset-11] [ifelse sync11-to = 2 and play.2 = true [set play11-next play2-next + initial-offset-11] [ifelse sync11-to = 3 and play.3 = true [set play11-next play3-next + initial-offset-11] [ifelse sync11-to = 4 and play.4 = true [set play11-next play4-next + initial-offset-11] [ifelse sync11-to = 5 and play.5 = true [set play11-next play5-next + initial-offset-11] [ifelse sync11-to = 6 and play.6 = true [set play11-next play6-next + initial-offset-11] [ifelse sync11-to = 7 and play.7 = true [set play11-next play7-next + initial-offset-11] [ifelse sync11-to = 8 and play.8 = true [set play11-next play8-next + initial-offset-11] [ifelse sync11-to = 9 and play.9 = true [set play11-next play9-next + initial-offset-11] [ifelse sync11-to = 10 and play.10 = true [set play11-next play10-next + initial-offset-11] [ifelse sync11-to = "m" [set play11-next playm-next + initial-offset-11][set play11-next playm-next + initial-offset-11]]]]]]]]]]] ] [ set play11-next precision (play11-next + loop-duration) 3 ] let q 0 let note-dur 0 ifelse playing11? = true [ while [q < length local-list][ if is-number? item q local-list [ note wait11 + note-dur instrument.11 ((item q local-list) + (12 * octave.11)) volume.11 get-time-value (item (q + 1) local-list) ] set note-dur note-dur + get-time-value (item (q + 1) local-list) set q q + 2 ] ] [ set playing11? true ] set wait11 wait11 + loop-duration end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to note [delay instrument-name keynumber velocity this-duration] if instrument-name != "none" [ ;;print (sentence "Playing" instrument-name "in" delay) sound:play-note-later delay instrument-name keynumber velocity this-duration] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to calc-middle-measure ifelse hindmost = foremost or foremost - 1 = hindmost [set middle 0] [set middle hindmost + 1] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to calc-average-volume let itotal-players 0 let itotal-volume 0 if play.1 = true and volume.1 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.1] if play.2 = true and volume.2 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.2] if play.3 = true and volume.3 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.3] if play.4 = true and volume.4 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.4] if play.5 = true and volume.5 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.5] if play.6 = true and volume.6 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.6] if play.7 = true and volume.7 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.7] if play.8 = true and volume.8 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.8] if play.9 = true and volume.9 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.9] if play.10 = true and volume.10 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.10] if play.11 = true and volume.11 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.11] ifelse itotal-volume > 0 and itotal-players > 0 [set average-vol itotal-volume / itotal-players] [set average-vol 0] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to sync-with-others [this-agent] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 1 [ if (canon.1 = true) and (player1-synced = false) [ set player1-synced true ifelse (phrase.1 = phrase.3) and (turtle3-elapsed > turtle1-elapsed) and playing3? = true [set sync1-to 3] [ifelse (phrase.1 = phrase.4) and (turtle4-elapsed > turtle1-elapsed) and playing4? = true [set sync1-to 4] [ifelse (phrase.1 = phrase.5) and (turtle5-elapsed > turtle1-elapsed) and playing5? = true [set sync1-to 5] [ifelse (phrase.1 = phrase.6) and (turtle6-elapsed > turtle1-elapsed) and playing6? = true [set sync1-to 6] [ifelse (phrase.1 = phrase.7) and (turtle7-elapsed > turtle1-elapsed) and playing7? = true [set sync1-to 7] [ifelse (phrase.1 = phrase.8) and (turtle8-elapsed > turtle1-elapsed) and playing8? = true [set sync1-to 8] [ifelse (phrase.1 = phrase.9) and (turtle9-elapsed > turtle1-elapsed) and playing9? = true [set sync1-to 9] [ifelse (phrase.1 = phrase.10) and (turtle10-elapsed > turtle1-elapsed) and playing10? = true [set sync1-to 10] [ifelse (phrase.1 = phrase.11) and (turtle11-elapsed > turtle1-elapsed) and playing11? = true [set sync1-to 11] [ifelse (phrase.1 = phrase.2) and (turtle2-elapsed > turtle1-elapsed) and playing2? = true [set sync1-to 2] [ set sync1-to "m" set player1-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.1) or (phrase.1 < hindmost)) and (phrase.1 <= phrase.2) and (phrase.1 <= phrase.3) and (phrase.1 <= phrase.4) and (phrase.1 <= phrase.5) and (phrase.1 <= phrase.6) and (phrase.1 <= phrase.7) and (phrase.1 <= phrase.8) and (phrase.1 <= phrase.9) and (phrase.1 <= phrase.10) and (phrase.1 <= phrase.11)[set hindmost phrase.1] if phrase.1 >= foremost [set foremost phrase.1] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 2 [ if (canon.2 = true) and (player2-synced = false) [ set player2-synced true ifelse (phrase.2 = phrase.3) and (turtle3-elapsed > turtle2-elapsed) and playing3? = true [set sync2-to 3] [ifelse (phrase.2 = phrase.4) and (turtle4-elapsed > turtle2-elapsed) and playing4? = true [set sync2-to 4] [ifelse (phrase.2 = phrase.5) and (turtle5-elapsed > turtle2-elapsed) and playing5? = true [set sync2-to 5] [ifelse (phrase.2 = phrase.6) and (turtle6-elapsed > turtle2-elapsed) and playing6? = true [set sync2-to 6] [ifelse (phrase.2 = phrase.7) and (turtle7-elapsed > turtle2-elapsed) and playing7? = true [set sync2-to 7] [ifelse (phrase.2 = phrase.8) and (turtle8-elapsed > turtle2-elapsed) and playing8? = true [set sync2-to 8] [ifelse (phrase.2 = phrase.9) and (turtle9-elapsed > turtle2-elapsed) and playing9? = true [set sync2-to 9] [ifelse (phrase.2 = phrase.10) and (turtle10-elapsed > turtle2-elapsed) and playing10? = true [set sync2-to 10] [ifelse (phrase.2 = phrase.11) and (turtle11-elapsed > turtle2-elapsed) and playing11? = true [set sync2-to 11] [ifelse (phrase.2 = phrase.1) and (turtle1-elapsed > turtle2-elapsed) and playing1? = true [set sync2-to 1] [ set sync2-to "m" set player2-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.2) or (phrase.2 < hindmost)) and (phrase.2 <= phrase.1) and (phrase.2 <= phrase.3) and (phrase.2 <= phrase.4) and (phrase.2 <= phrase.5) and (phrase.2 <= phrase.6) and (phrase.2 <= phrase.7) and (phrase.2 <= phrase.8) and (phrase.2 <= phrase.9) and (phrase.2 <= phrase.10) and (phrase.2 <= phrase.11)[set hindmost phrase.2] if phrase.2 >= foremost [set foremost phrase.2] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 3 [ if (canon.3 = true) and (player3-synced = false) [ set player3-synced true ifelse (phrase.3 = phrase.2) and (turtle2-elapsed > turtle3-elapsed) and playing2? = true [set sync3-to 2] [ifelse (phrase.3 = phrase.4) and (turtle4-elapsed > turtle3-elapsed) and playing4? = true [set sync3-to 4] [ifelse (phrase.3 = phrase.5) and (turtle5-elapsed > turtle3-elapsed) and playing5? = true [set sync3-to 5] [ifelse (phrase.3 = phrase.6) and (turtle6-elapsed > turtle3-elapsed) and playing6? = true [set sync3-to 6] [ifelse (phrase.3 = phrase.7) and (turtle7-elapsed > turtle3-elapsed) and playing7? = true [set sync3-to 7] [ifelse (phrase.3 = phrase.8) and (turtle8-elapsed > turtle3-elapsed) and playing8? = true [set sync3-to 8] [ifelse (phrase.3 = phrase.9) and (turtle9-elapsed > turtle3-elapsed) and playing9? = true [set sync3-to 9] [ifelse (phrase.3 = phrase.10) and (turtle10-elapsed > turtle3-elapsed) and playing10? = true [set sync3-to 10] [ifelse (phrase.3 = phrase.11) and (turtle11-elapsed > turtle3-elapsed) and playing11? = true [set sync3-to 11] [ifelse (phrase.3 = phrase.1) and (turtle1-elapsed > turtle3-elapsed) and playing1? = true [set sync3-to 1] [ set sync3-to "m" set player3-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.3) or (phrase.3 < hindmost)) and (phrase.3 <= phrase.1) and (phrase.3 <= phrase.2) and (phrase.3 <= phrase.4) and (phrase.3 <= phrase.5) and (phrase.3 <= phrase.6) and (phrase.3 <= phrase.7) and (phrase.3 <= phrase.8) and (phrase.3 <= phrase.9) and (phrase.3 <= phrase.10) and (phrase.3 <= phrase.11)[set hindmost phrase.3] if phrase.3 >= foremost [set foremost phrase.3] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 4 [ if (canon.4 = true) and (player4-synced = false) [ set player4-synced true ifelse (phrase.4 = phrase.2) and (turtle2-elapsed > turtle4-elapsed) and playing2? = true [set sync4-to 2] [ifelse (phrase.4 = phrase.3) and (turtle3-elapsed > turtle4-elapsed) and playing3? = true [set sync4-to 3] [ifelse (phrase.4 = phrase.5) and (turtle5-elapsed > turtle4-elapsed) and playing5? = true [set sync4-to 5] [ifelse (phrase.4 = phrase.6) and (turtle6-elapsed > turtle4-elapsed) and playing6? = true [set sync4-to 6] [ifelse (phrase.4 = phrase.7) and (turtle7-elapsed > turtle4-elapsed) and playing7? = true [set sync4-to 7] [ifelse (phrase.4 = phrase.8) and (turtle8-elapsed > turtle4-elapsed) and playing8? = true [set sync4-to 8] [ifelse (phrase.4 = phrase.9) and (turtle9-elapsed > turtle4-elapsed) and playing9? = true [set sync4-to 9] [ifelse (phrase.4 = phrase.10) and (turtle10-elapsed > turtle4-elapsed) and playing10? = true [set sync4-to 10] [ifelse (phrase.4 = phrase.11) and (turtle11-elapsed > turtle4-elapsed) and playing11? = true [set sync4-to 11] [ifelse (phrase.4 = phrase.1) and (turtle1-elapsed > turtle4-elapsed) and playing1? = true [set sync4-to 1] [ set sync4-to "m" set player4-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.4) or (phrase.4 < hindmost)) and (phrase.4 <= phrase.1) and (phrase.4 <= phrase.2) and (phrase.4 <= phrase.3) and (phrase.4 <= phrase.5) and (phrase.4 <= phrase.6) and (phrase.4 <= phrase.7) and (phrase.4 <= phrase.8) and (phrase.4 <= phrase.9) and (phrase.4 <= phrase.10) and (phrase.4 <= phrase.11) [set hindmost phrase.4] if phrase.4 >= foremost [set foremost phrase.4] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 5 [ if (canon.5 = true) and (player5-synced = false) [ set player5-synced true ifelse (phrase.5 = phrase.2) and (turtle2-elapsed > turtle5-elapsed) and playing2? = true [set sync5-to 2] [ifelse (phrase.5 = phrase.3) and (turtle3-elapsed > turtle5-elapsed) and playing3? = true [set sync5-to 3] [ifelse (phrase.5 = phrase.4) and (turtle4-elapsed > turtle5-elapsed) and playing4? = true [set sync5-to 4] [ifelse (phrase.5 = phrase.6) and (turtle6-elapsed > turtle5-elapsed) and playing6? = true [set sync5-to 6] [ifelse (phrase.5 = phrase.7) and (turtle7-elapsed > turtle5-elapsed) and playing7? = true [set sync5-to 7] [ifelse (phrase.5 = phrase.8) and (turtle8-elapsed > turtle5-elapsed) and playing8? = true [set sync5-to 8] [ifelse (phrase.5 = phrase.9) and (turtle9-elapsed > turtle5-elapsed) and playing9? = true [set sync5-to 9] [ifelse (phrase.5 = phrase.10) and (turtle10-elapsed > turtle5-elapsed) and playing10? = true [set sync5-to 10] [ifelse (phrase.5 = phrase.11) and (turtle11-elapsed > turtle5-elapsed) and playing11? = true [set sync5-to 11] [ifelse (phrase.5 = phrase.1) and (turtle1-elapsed > turtle5-elapsed) and playing1? = true [set sync5-to 1] [ set sync5-to "m" set player5-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.5) or (phrase.5 < hindmost)) and (phrase.5 <= phrase.1) and (phrase.5 <= phrase.2) and (phrase.5 <= phrase.3) and (phrase.5 <= phrase.4) and (phrase.5 <= phrase.6) and (phrase.5 <= phrase.7) and (phrase.5 <= phrase.8) and (phrase.5 <= phrase.9) and (phrase.5 <= phrase.10) and (phrase.5 <= phrase.11) [set hindmost phrase.5] if phrase.5 >= foremost [set foremost phrase.5] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 6 [ if (canon.6 = true) and (player6-synced = false) [ set player6-synced true ifelse (phrase.6 = phrase.2) and (turtle2-elapsed > turtle6-elapsed) and playing2? = true [set sync6-to 2] [ifelse (phrase.6 = phrase.3) and (turtle3-elapsed > turtle6-elapsed) and playing3? = true [set sync6-to 3] [ifelse (phrase.6 = phrase.4) and (turtle4-elapsed > turtle6-elapsed) and playing4? = true [set sync6-to 4] [ifelse (phrase.6 = phrase.5) and (turtle5-elapsed > turtle6-elapsed) and playing5? = true [set sync6-to 5] [ifelse (phrase.6 = phrase.7) and (turtle7-elapsed > turtle6-elapsed) and playing7? = true [set sync6-to 7] [ifelse (phrase.6 = phrase.8) and (turtle8-elapsed > turtle6-elapsed) and playing8? = true [set sync6-to 8] [ifelse (phrase.6 = phrase.9) and (turtle9-elapsed > turtle6-elapsed) and playing9? = true [set sync6-to 9] [ifelse (phrase.6 = phrase.10) and (turtle10-elapsed > turtle6-elapsed) and playing10? = true [set sync6-to 10] [ifelse (phrase.6 = phrase.11) and (turtle11-elapsed > turtle6-elapsed) and playing11? = true [set sync6-to 11] [ifelse (phrase.6 = phrase.1) and (turtle1-elapsed > turtle6-elapsed) and playing1? = true [set sync6-to 1] [ set sync6-to "m" set player6-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.6) or (phrase.6 < hindmost)) and (phrase.6 <= phrase.1) and (phrase.6 <= phrase.2) and (phrase.6 <= phrase.3) and (phrase.6 <= phrase.4) and (phrase.6 <= phrase.5) and (phrase.6 <= phrase.7) and (phrase.6 <= phrase.8) and (phrase.6 <= phrase.9) and (phrase.6 <= phrase.10) and (phrase.6 <= phrase.11) [set hindmost phrase.6] if phrase.6 >= foremost [set foremost phrase.6] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 7 [ if (canon.7 = true) and (player7-synced = false) [ set player7-synced true ifelse (phrase.7 = phrase.2) and (turtle2-elapsed > turtle7-elapsed) and playing2? = true [set sync7-to 2] [ifelse (phrase.7 = phrase.3) and (turtle3-elapsed > turtle7-elapsed) and playing3? = true [set sync7-to 3] [ifelse (phrase.7 = phrase.4) and (turtle4-elapsed > turtle7-elapsed) and playing4? = true [set sync7-to 4] [ifelse (phrase.7 = phrase.5) and (turtle5-elapsed > turtle7-elapsed) and playing5? = true [set sync7-to 5] [ifelse (phrase.7 = phrase.6) and (turtle6-elapsed > turtle7-elapsed) and playing6? = true [set sync7-to 6] [ifelse (phrase.7 = phrase.8) and (turtle8-elapsed > turtle7-elapsed) and playing8? = true [set sync7-to 8] [ifelse (phrase.7 = phrase.9) and (turtle9-elapsed > turtle7-elapsed) and playing9? = true [set sync7-to 9] [ifelse (phrase.7 = phrase.10) and (turtle10-elapsed > turtle7-elapsed) and playing10? = true [set sync7-to 10] [ifelse (phrase.7 = phrase.11) and (turtle11-elapsed > turtle7-elapsed) and playing11? = true [set sync7-to 11] [ifelse (phrase.7 = phrase.1) and (turtle1-elapsed > turtle7-elapsed) and playing1? = true [set sync7-to 1] [ set sync7-to "m" set player7-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.7) or (phrase.7 < hindmost)) and (phrase.7 <= phrase.1) and (phrase.7 <= phrase.2) and (phrase.7 <= phrase.3) and (phrase.7 <= phrase.4) and (phrase.7 <= phrase.5) and (phrase.7 <= phrase.6) and (phrase.7 <= phrase.8) and (phrase.7 <= phrase.9) and (phrase.7 <= phrase.10) and (phrase.7 <= phrase.11) [set hindmost phrase.7] if phrase.7 >= foremost [set foremost phrase.7] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 8 [ if (canon.8 = true) and (player8-synced = false) [ set player8-synced true ifelse (phrase.8 = phrase.2) and (turtle2-elapsed > turtle8-elapsed) and playing2? = true [set sync8-to 2] [ifelse (phrase.8 = phrase.3) and (turtle3-elapsed > turtle8-elapsed) and playing3? = true [set sync8-to 3] [ifelse (phrase.8 = phrase.4) and (turtle4-elapsed > turtle8-elapsed) and playing4? = true [set sync8-to 4] [ifelse (phrase.8 = phrase.5) and (turtle5-elapsed > turtle8-elapsed) and playing5? = true [set sync8-to 5] [ifelse (phrase.8 = phrase.6) and (turtle6-elapsed > turtle8-elapsed) and playing6? = true [set sync8-to 6] [ifelse (phrase.8 = phrase.7) and (turtle7-elapsed > turtle8-elapsed) and playing7? = true [set sync8-to 7] [ifelse (phrase.8 = phrase.9) and (turtle9-elapsed > turtle8-elapsed) and playing9? = true [set sync8-to 9] [ifelse (phrase.8 = phrase.10) and (turtle10-elapsed > turtle8-elapsed) and playing10? = true [set sync8-to 10] [ifelse (phrase.8 = phrase.11) and (turtle11-elapsed > turtle8-elapsed) and playing11? = true [set sync8-to 11] [ifelse (phrase.8 = phrase.1) and (turtle1-elapsed > turtle8-elapsed) and playing1? = true [set sync8-to 1] [ set sync8-to "m" set player8-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.8) or (phrase.8 < hindmost)) and (phrase.8 <= phrase.1) and (phrase.8 <= phrase.2) and (phrase.8 <= phrase.3) and (phrase.8 <= phrase.4) and (phrase.8 <= phrase.5) and (phrase.8 <= phrase.6) and (phrase.8 <= phrase.7) and (phrase.8 <= phrase.9) and (phrase.8 <= phrase.10) and (phrase.8 <= phrase.11) [set hindmost phrase.8] if phrase.8 >= foremost [set foremost phrase.8] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 9 [ if (canon.9 = true) and (player9-synced = false) [ set player9-synced true ifelse (phrase.9 = phrase.2) and (turtle2-elapsed > turtle9-elapsed) and playing2? = true [set sync9-to 2] [ifelse (phrase.9 = phrase.3) and (turtle3-elapsed > turtle9-elapsed) and playing3? = true [set sync9-to 3] [ifelse (phrase.9 = phrase.4) and (turtle4-elapsed > turtle9-elapsed) and playing4? = true [set sync9-to 4] [ifelse (phrase.9 = phrase.5) and (turtle5-elapsed > turtle9-elapsed) and playing5? = true [set sync9-to 5] [ifelse (phrase.9 = phrase.6) and (turtle6-elapsed > turtle9-elapsed) and playing6? = true [set sync9-to 6] [ifelse (phrase.9 = phrase.7) and (turtle7-elapsed > turtle9-elapsed) and playing7? = true [set sync9-to 7] [ifelse (phrase.9 = phrase.8) and (turtle8-elapsed > turtle9-elapsed) and playing8? = true [set sync9-to 8] [ifelse (phrase.9 = phrase.10) and (turtle10-elapsed > turtle9-elapsed) and playing10? = true [set sync9-to 10] [ifelse (phrase.9 = phrase.11) and (turtle11-elapsed > turtle9-elapsed) and playing11? = true [set sync9-to 11] [ifelse (phrase.9 = phrase.1) and (turtle1-elapsed > turtle9-elapsed) and playing1? = true [set sync9-to 1] [ set sync9-to "m" set player9-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.9) or (phrase.9 < hindmost)) and (phrase.9 <= phrase.1) and (phrase.9 <= phrase.2) and (phrase.9 <= phrase.3) and (phrase.9 <= phrase.4) and (phrase.9 <= phrase.5) and (phrase.9 <= phrase.6) and (phrase.9 <= phrase.7) and (phrase.9 <= phrase.8) and (phrase.9 <= phrase.10) and (phrase.9 <= phrase.11) [set hindmost phrase.9] if phrase.9 >= foremost [set foremost phrase.9] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 10 [ if (canon.10 = true) and (player10-synced = false) [ set player10-synced true ifelse (phrase.10 = phrase.2) and (turtle2-elapsed > turtle10-elapsed) and playing2? = true [set sync10-to 2] [ifelse (phrase.10 = phrase.3) and (turtle3-elapsed > turtle10-elapsed) and playing3? = true [set sync10-to 3] [ifelse (phrase.10 = phrase.4) and (turtle4-elapsed > turtle10-elapsed) and playing4? = true [set sync10-to 4] [ifelse (phrase.10 = phrase.5) and (turtle5-elapsed > turtle10-elapsed) and playing5? = true [set sync10-to 5] [ifelse (phrase.10 = phrase.6) and (turtle6-elapsed > turtle10-elapsed) and playing6? = true [set sync10-to 6] [ifelse (phrase.10 = phrase.7) and (turtle7-elapsed > turtle10-elapsed) and playing7? = true [set sync10-to 7] [ifelse (phrase.10 = phrase.8) and (turtle8-elapsed > turtle10-elapsed) and playing8? = true [set sync10-to 8] [ifelse (phrase.10 = phrase.9) and (turtle9-elapsed > turtle10-elapsed) and playing9? = true [set sync10-to 9] [ifelse (phrase.10 = phrase.11) and (turtle11-elapsed > turtle10-elapsed) and playing11? = true [set sync10-to 11] [ifelse (phrase.10 = phrase.1) and (turtle1-elapsed > turtle10-elapsed) and playing1? = true [set sync10-to 1] [ set sync10-to "m" set player10-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.10) or (phrase.10 < hindmost)) and (phrase.10 <= phrase.1) and (phrase.10 <= phrase.2) and (phrase.10 <= phrase.3) and (phrase.10 <= phrase.4) and (phrase.10 <= phrase.5) and (phrase.10 <= phrase.6) and (phrase.10 <= phrase.7) and (phrase.10 <= phrase.8) and (phrase.10 <= phrase.9) and (phrase.10 <= phrase.11) [set hindmost phrase.10] if phrase.10 >= foremost [set foremost phrase.10] set minimum-vol get-softest set maximum-vol get-loudest ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if this-agent = 11 [ if (canon.11 = true) and (player11-synced = false) [ set player11-synced true ifelse (phrase.11 = phrase.2) and (turtle2-elapsed > turtle11-elapsed) and playing2? = true [set sync11-to 2] [ifelse (phrase.11 = phrase.3) and (turtle3-elapsed > turtle11-elapsed) and playing3? = true [set sync11-to 3] [ifelse (phrase.11 = phrase.4) and (turtle4-elapsed > turtle11-elapsed) and playing4? = true [set sync11-to 4] [ifelse (phrase.11 = phrase.5) and (turtle5-elapsed > turtle11-elapsed) and playing5? = true [set sync11-to 5] [ifelse (phrase.11 = phrase.6) and (turtle6-elapsed > turtle11-elapsed) and playing6? = true [set sync11-to 6] [ifelse (phrase.11 = phrase.7) and (turtle7-elapsed > turtle11-elapsed) and playing7? = true [set sync11-to 7] [ifelse (phrase.11 = phrase.8) and (turtle8-elapsed > turtle11-elapsed) and playing8? = true [set sync11-to 8] [ifelse (phrase.11 = phrase.9) and (turtle9-elapsed > turtle11-elapsed) and playing9? = true [set sync11-to 9] [ifelse (phrase.11 = phrase.10) and (turtle10-elapsed > turtle11-elapsed) and playing10? = true [set sync11-to 10] [ifelse (phrase.11 = phrase.1) and (turtle1-elapsed > turtle11-elapsed) and playing1? = true [set sync11-to 1] [ set sync11-to "m" set player11-synced false ] ] ] ] ] ] ] ] ] ] ] if ((hindmost <= phrase.11) or (phrase.11 < hindmost)) and (phrase.11 <= phrase.1) and (phrase.11 <= phrase.2) and (phrase.11 <= phrase.3) and (phrase.11 <= phrase.4) and (phrase.11 <= phrase.5) and (phrase.11 <= phrase.6) and (phrase.11 <= phrase.7) and (phrase.11 <= phrase.8) and (phrase.11 <= phrase.9) and (phrase.11 <= phrase.10) [set hindmost phrase.11] if phrase.11 >= foremost [set foremost phrase.11] set minimum-vol get-softest set maximum-vol get-loudest ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to turtle-time ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 1 [ let bmove false if ((phrase.1 + 1) - hindmost < 3) and (timer > player1-start + (get-duration (get-phrase "phrase" phrase.1))) and (no-agents-this-phrase (phrase.1 + 1) < max-per-phrase) [ let x random ((probability / turtle1-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle1-timer + duration - (random-move1)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.1) = 1) and last-agent-playing (phrase.1) = who)[ if last-agent-play = true [ set play.1 true if octave = true [ if no-agents-this-instrument instrument.1 > 1 [ set octave.1 new-octave instrument.1 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle1-timer timer set phrase.1 phrase.1 + 1 set random-move1 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.1 = true) [ if playing > min-play [ set play.1 false set player1-transformed-pitchlist [""] set player1-start 0 ] ] if (y = 1) and (play.1 = false) [ if playing < max-play [ set play.1 true set player1-start timer set turtle1-timer timer set random-move1 random 30 ] ] ] ifelse play.1 = true and (timer > player1-start + (get-duration (get-phrase "phrase" phrase.1))) [ if (phrase = false) and (play = false) and (timer > player1-start + (get-duration (get-phrase "phrase" phrase.1)))[ set player1-start timer set turtle1-timer timer set random-move1 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.1 = true) [set canon.1 false] if (z = 1) and (canon.1 = false) [set canon.1 true] ] if (transform = true) and (transforming < max-transforming) [set transform.1 transformation] if octave = true [ if no-agents-this-instrument instrument.1 > 1 [set octave.1 new-octave instrument.1 who] ] ;************************************* ifelse volume = true [set volume.1 get-volume-change ] [set volume.1 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.1 "none" ] if q = 1 [set offset.1 "quarter" ] if q = 2 [set offset.1 "eighth" ] if q = 3 [set offset.1 "sixteenth"] ] [ set offset.1 "none" ] ] [ set sync1-to "m" set offset.1 "none" if octave = true [ if no-agents-this-instrument instrument.1 > 1 [set octave.1 0] ] if transform = true [set transform.1 "none"] set canon.1 false ] ] ifelse play.1 = true [ if volume.1 = 0 [ ifelse volume = true [set volume.1 get-volume-change ] [set volume.1 64] ] ] [ set canon.1 false set sync1-to "m" set offset.1 "none" set volume.1 0 if transform = true [set transform.1 "none"] if octave = true [set octave.1 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 2 [ let bmove false if ((phrase.2 + 1) - hindmost < 3) and (timer > player2-start + (get-duration (get-phrase "phrase" phrase.2))) and (no-agents-this-phrase (phrase.2 + 1) < max-per-phrase) [ let x random ((probability / turtle2-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle2-timer + duration - (random-move2)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.2) = 1) and last-agent-playing (phrase.2) = who)[ if last-agent-play = true [ set play.2 true if octave = true [ if no-agents-this-instrument instrument.2 > 1 [ set octave.2 new-octave instrument.2 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle2-timer timer set phrase.2 phrase.2 + 1 set random-move2 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.2 = true) [ if playing > min-play [ set play.2 false set player2-transformed-pitchlist [""] set player2-start 0 ;set volume.2 0 ] ] if (y = 1) and (play.2 = false) [ if playing < max-play [ set play.2 true set player2-start timer set turtle2-timer timer set random-move2 random 30 ] ] ] ifelse play.2 = true and (timer > player2-start + (get-duration (get-phrase "phrase" phrase.2))) [ if (phrase = false) and (play = false) and (timer > player2-start + (get-duration (get-phrase "phrase" phrase.2)))[ set player2-start timer set turtle2-timer timer set random-move2 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.2 = true) [set canon.2 false] if (z = 1) and (canon.2 = false) [set canon.2 true] ] if (transform = true) and (transforming < max-transforming) [set transform.2 transformation] if octave = true [ if no-agents-this-instrument instrument.2 > 1 [set octave.2 new-octave instrument.2 who] ] ;************************************* ifelse volume = true [set volume.2 get-volume-change] [set volume.2 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.2 "none" ] if q = 1 [set offset.2 "quarter" ] if q = 2 [set offset.2 "eighth" ] if q = 3 [set offset.2 "sixteenth"] ] [ set offset.2 "none" ] ] [ set sync2-to "m" set offset.2 "none" if octave = true [ if no-agents-this-instrument instrument.2 > 1 [set octave.2 0] ] if transform = true [set transform.2 "none"] set canon.2 false ] ] ifelse play.2 = true [ if volume.2 = 0 [ ifelse volume = true [set volume.2 get-volume-change] [set volume.2 64] ] ] [ set canon.2 false set sync2-to "m" set offset.2 "none" set volume.2 0 if transform = true [set transform.2 "none"] if octave = true [set octave.2 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 3 [ let bmove false if ((phrase.3 + 1) - hindmost < 3) and (timer > player3-start + (get-duration (get-phrase "phrase" phrase.3))) and (no-agents-this-phrase (phrase.3 + 1) < max-per-phrase) [ let x random ((probability / turtle3-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle3-timer + duration - (random-move3)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.3) = 1) and last-agent-playing (phrase.3) = who)[ if last-agent-play = true [ set play.3 true if octave = true [ if no-agents-this-instrument instrument.3 > 1 [ set octave.3 new-octave instrument.3 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle3-timer timer set phrase.3 phrase.3 + 1 set random-move3 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.3 = true) [ if playing > min-play [ set play.3 false set player3-transformed-pitchlist [""] set player3-start 0 ;set volume.3 0 ] ] if (y = 1) and (play.3 = false) [ if playing < max-play [ set play.3 true set player3-start timer set turtle3-timer timer set random-move3 random 30 ] ] ] ifelse play.3 = true and (timer > player3-start + (get-duration (get-phrase "phrase" phrase.3))) [ if (phrase = false) and (play = false) and (timer > player3-start + (get-duration (get-phrase "phrase" phrase.3)))[ set player3-start timer set turtle3-timer timer set random-move3 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.3 = true) [set canon.3 false] if (z = 1) and (canon.3 = false) [set canon.3 true] ] if (transform = true) and (transforming < max-transforming) [set transform.3 transformation] if octave = true [ if no-agents-this-instrument instrument.3 > 1 [set octave.3 new-octave instrument.3 who] ] ;************************************* ifelse volume = true [set volume.3 get-volume-change ] [set volume.3 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.3 "none" ] if q = 1 [set offset.3 "quarter" ] if q = 2 [set offset.3 "eighth" ] if q = 3 [set offset.3 "sixteenth"] ] [ set offset.3 "none" ] ] [ set sync3-to "m" set offset.3 "none" if octave = true [ if no-agents-this-instrument instrument.3 > 1 [set octave.3 0] ] if transform = true [set transform.3 "none"] set canon.3 false ] ] ifelse play.3 = true [ if volume.3 = 0 [ ifelse volume = true [set volume.3 get-volume-change ] [set volume.3 64] ] ] [ set canon.3 false set sync3-to "m" set offset.3 "none" set volume.3 0 if transform = true [set transform.3 "none"] if octave = true [set octave.3 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 4 [ let bmove false if ((phrase.4 + 1) - hindmost < 3) and (timer > player4-start + (get-duration (get-phrase "phrase" phrase.4))) and (no-agents-this-phrase (phrase.4 + 1) < max-per-phrase) [ let x random ((probability / turtle4-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle4-timer + duration - (random-move4)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.4) = 1) and last-agent-playing (phrase.4) = who)[ if last-agent-play = true [ set play.4 true if octave = true [ if no-agents-this-instrument instrument.4 > 1 [ set octave.4 new-octave instrument.4 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle4-timer timer set phrase.4 phrase.4 + 1 set random-move4 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.4 = true) [ if playing > min-play [ set play.4 false set player4-transformed-pitchlist [""] set player4-start 0 ;set volume.4 0 ] ] if (y = 1) and (play.4 = false) [ if playing < max-play [ set play.4 true set player4-start timer set turtle4-timer timer set random-move4 random 30 ] ] ] ifelse play.4 = true and (timer > player4-start + (get-duration (get-phrase "phrase" phrase.4))) [ if (phrase = false) and (play = false) and (timer > player4-start + (get-duration (get-phrase "phrase" phrase.4)))[ set player4-start timer set turtle4-timer timer set random-move4 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.4 = true) [set canon.4 false] if (z = 1) and (canon.4 = false) [set canon.4 true] ] if (transform = true) and (transforming < max-transforming) [set transform.4 transformation] if octave = true [ if no-agents-this-instrument instrument.4 > 1 [set octave.4 new-octave instrument.4 who] ] ;************************************* ifelse volume = true [set volume.4 get-volume-change ] [set volume.4 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.4 "none" ] if q = 1 [set offset.4 "quarter" ] if q = 2 [set offset.4 "eighth" ] if q = 3 [set offset.4 "sixteenth"] ] [ set offset.4 "none" ] ] [ set sync4-to "m" set offset.4 "none" if octave = true [ if no-agents-this-instrument instrument.4 > 1 [set octave.4 0] ] if transform = true [set transform.4 "none"] set canon.4 false ] ] ifelse play.4 = true [ if volume.4 = 0 [ ifelse volume = true [set volume.4 get-volume-change] [set volume.4 64] ] ] [ set canon.4 false set sync4-to "m" set offset.4 "none" set volume.4 0 if transform = true [set transform.4 "none"] if octave = true [set octave.4 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 5 [ let bmove false if ((phrase.5 + 1) - hindmost < 3) and (timer > player5-start + (get-duration (get-phrase "phrase" phrase.5))) and (no-agents-this-phrase (phrase.5 + 1) < max-per-phrase) [ let x random ((probability / turtle5-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle5-timer + duration - (random-move5)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.5) = 1) and last-agent-playing (phrase.5) = who)[ if last-agent-play = true [ set play.5 true if octave = true [ if no-agents-this-instrument instrument.5 > 1 [ set octave.5 new-octave instrument.5 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle5-timer timer set phrase.5 phrase.5 + 1 set random-move5 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.5 = true) [ if playing > min-play [ set play.5 false set player5-transformed-pitchlist [""] set player5-start 0 ;set volume.5 0 ] ] if (y = 1) and (play.5 = false) [ if playing < max-play [ set play.5 true set player5-start timer set turtle5-timer timer set random-move5 random 30 ] ] ] ifelse play.5 = true and (timer > player5-start + (get-duration (get-phrase "phrase" phrase.5))) [ if (phrase = false) and (play = false) and (timer > player5-start + (get-duration (get-phrase "phrase" phrase.5)))[ set player5-start timer set turtle5-timer timer set random-move5 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.5 = true) [set canon.5 false] if (z = 1) and (canon.5 = false) [set canon.5 true] ] if (transform = true) and (transforming < max-transforming) [set transform.5 transformation] if octave = true [ if no-agents-this-instrument instrument.5 > 1 [set octave.5 new-octave instrument.5 who] ] ;************************************* ifelse volume = true [set volume.5 get-volume-change ] [set volume.5 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.5 "none" ] if q = 1 [set offset.5 "quarter" ] if q = 2 [set offset.5 "eighth" ] if q = 3 [set offset.5 "sixteenth"] ] [ set offset.5 "none" ] ] [ set sync5-to "m" set offset.5 "none" if octave = true [ if no-agents-this-instrument instrument.5 > 1 [set octave.5 0] ] if transform = true [set transform.5 "none"] set canon.5 false ] ] ifelse play.5 = true [ if volume.5 = 0 [ ifelse volume = true [set volume.5 get-volume-change ] [set volume.5 64] ] ] [ set canon.5 false set sync5-to "m" set offset.5 "none" set volume.5 0 if transform = true [set transform.5 "none"] if octave = true [set octave.5 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 6 [ let bmove false if ((phrase.6 + 1) - hindmost < 3) and (timer > player6-start + (get-duration (get-phrase "phrase" phrase.6))) and (no-agents-this-phrase (phrase.6 + 1) < max-per-phrase) [ let x random ((probability / turtle6-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle6-timer + duration - (random-move6)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.6) = 1) and last-agent-playing (phrase.6) = who)[ if last-agent-play = true [ set play.6 true if octave = true [ if no-agents-this-instrument instrument.6 > 1 [ set octave.6 new-octave instrument.6 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle6-timer timer set phrase.6 phrase.6 + 1 set random-move6 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.6 = true) [ if playing > min-play [ set play.6 false set player6-transformed-pitchlist [""] set player6-start 0 ;set volume.6 0 ] ] if (y = 1) and (play.6 = false) [ if playing < max-play [ set play.6 true set player6-start timer set turtle6-timer timer set random-move6 random 30 ] ] ] ifelse play.6 = true and (timer > player6-start + (get-duration (get-phrase "phrase" phrase.6))) [ if (phrase = false) and (play = false) and (timer > player6-start + (get-duration (get-phrase "phrase" phrase.6)))[ set player6-start timer set turtle6-timer timer set random-move6 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.6 = true) [set canon.6 false] if (z = 1) and (canon.6 = false) [set canon.6 true] ] if (transform = true) and (transforming < max-transforming) [set transform.6 transformation] if octave = true [ if no-agents-this-instrument instrument.6 > 1 [set octave.6 new-octave instrument.6 who] ] ;************************************* ifelse volume = true [set volume.6 get-volume-change] [set volume.6 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.6 "none" ] if q = 1 [set offset.6 "quarter" ] if q = 2 [set offset.6 "eighth" ] if q = 3 [set offset.6 "sixteenth"] ] [ set offset.6 "none" ] ] [ set sync6-to "m" set offset.6 "none" if octave = true [ if no-agents-this-instrument instrument.6 > 1 [set octave.6 0] ] if transform = true [set transform.6 "none"] set canon.6 false ] ] ifelse play.6 = true [ if volume.6 = 0 [ ifelse volume = true [set volume.6 get-volume-change] [set volume.6 64] ] ] [ set canon.6 false set sync6-to "m" set offset.6 "none" set volume.6 0 if transform = true [set transform.6 "none"] if octave = true [set octave.6 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 7 [ let bmove false if ((phrase.7 + 1) - hindmost < 3) and (timer > player7-start + (get-duration (get-phrase "phrase" phrase.7))) and (no-agents-this-phrase (phrase.7 + 1) < max-per-phrase) [ let x random ((probability / turtle7-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle7-timer + duration - (random-move7)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.7) = 1) and last-agent-playing (phrase.7) = who)[ if last-agent-play = true [ set play.7 true if octave = true [ if no-agents-this-instrument instrument.7 > 1 [ set octave.7 new-octave instrument.7 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle7-timer timer set phrase.7 phrase.7 + 1 set random-move7 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.7 = true) [ if playing > min-play [ set play.7 false set player7-transformed-pitchlist [""] set player7-start 0 ;set volume.7 0 ] ] if (y = 1) and (play.7 = false) [ if playing < max-play [ set play.7 true set player7-start timer set turtle7-timer timer set random-move7 random 30 ] ] ] ifelse play.7 = true and (timer > player7-start + (get-duration (get-phrase "phrase" phrase.7))) [ if (phrase = false) and (play = false) and (timer > player7-start + (get-duration (get-phrase "phrase" phrase.7)))[ set player7-start timer set turtle7-timer timer set random-move7 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.7 = true) [set canon.7 false] if (z = 1) and (canon.7 = false) [set canon.7 true] ] if (transform = true) and (transforming < max-transforming) [set transform.7 transformation] if octave = true [ if no-agents-this-instrument instrument.7 > 1 [set octave.7 new-octave instrument.7 who] ] ;************************************* ifelse volume = true [set volume.7 get-volume-change ] [set volume.7 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.7 "none" ] if q = 1 [set offset.7 "quarter" ] if q = 2 [set offset.7 "eighth" ] if q = 3 [set offset.7 "sixteenth"] ] [ set offset.7 "none" ] ] [ set sync7-to "m" set offset.7 "none" if octave = true [ if no-agents-this-instrument instrument.7 > 1 [set octave.7 0] ] if transform = true [set transform.7 "none"] set canon.7 false ] ] ifelse play.7 = true [ if volume.7 = 0 [ ifelse volume = true [set volume.7 get-volume-change ] [set volume.7 64] ] ] [ set canon.7 false set sync7-to "m" set offset.7 "none" set volume.7 0 if transform = true [set transform.7 "none"] if octave = true [set octave.7 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 8 [ let bmove false if ((phrase.8 + 1) - hindmost < 3) and (timer > player8-start + (get-duration (get-phrase "phrase" phrase.8))) and (no-agents-this-phrase (phrase.8 + 1) < max-per-phrase) [ let x random ((probability / turtle8-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle8-timer + duration - (random-move8)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.8) = 1) and last-agent-playing (phrase.8) = who)[ if last-agent-play = true [ set play.8 true if octave = true [ if no-agents-this-instrument instrument.8 > 1 [ set octave.8 new-octave instrument.8 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle8-timer timer set phrase.8 phrase.8 + 1 set random-move8 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.8 = true) [ if playing > min-play [ set play.8 false set player8-transformed-pitchlist [""] set player8-start 0 ;set volume.8 0 ] ] if (y = 1) and (play.8 = false) [ if playing < max-play [ set play.8 true set player8-start timer set turtle8-timer timer set random-move8 random 30 ] ] ] ifelse play.8 = true and (timer > player8-start + (get-duration (get-phrase "phrase" phrase.8))) [ if (phrase = false) and (play = false) and (timer > player8-start + (get-duration (get-phrase "phrase" phrase.8)))[ set player8-start timer set turtle8-timer timer set random-move8 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.8 = true) [set canon.8 false] if (z = 1) and (canon.8 = false) [set canon.8 true] ] if (transform = true) and (transforming < max-transforming) [set transform.8 transformation] if octave = true [ if no-agents-this-instrument instrument.8 > 1 [set octave.8 new-octave instrument.8 who] ] ;************************************* ifelse volume = true [set volume.8 get-volume-change] [set volume.8 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.8 "none" ] if q = 1 [set offset.8 "quarter" ] if q = 2 [set offset.8 "eighth" ] if q = 3 [set offset.8 "sixteenth"] ] [ set offset.8 "none" ] ] [ set sync8-to "m" set offset.8 "none" if octave = true [ if no-agents-this-instrument instrument.8 > 1 [set octave.8 0] ] if transform = true [set transform.8 "none"] set canon.8 false ] ] ifelse play.8 = true [ if volume.8 = 0 [ ifelse volume = true [set volume.8 get-volume-change] [set volume.8 64] ] ] [ set canon.8 false set sync8-to "m" set offset.8 "none" set volume.8 0 if transform = true [set transform.8 "none"] if octave = true [set octave.8 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 9 [ let bmove false if ((phrase.9 + 1) - hindmost < 3) and (timer > player9-start + (get-duration (get-phrase "phrase" phrase.9))) and (no-agents-this-phrase (phrase.9 + 1) < max-per-phrase) [ let x random ((probability / turtle9-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle9-timer + duration - (random-move9)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.9) = 1) and last-agent-playing (phrase.9) = who)[ if last-agent-play = true [ set play.9 true if octave = true [ if no-agents-this-instrument instrument.9 > 1 [ set octave.9 new-octave instrument.9 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle9-timer timer set phrase.9 phrase.9 + 1 set random-move9 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.9 = true) [ if playing > min-play [ set play.9 false set player9-transformed-pitchlist [""] set player9-start 0 ;set volume.9 0 ] ] if (y = 1) and (play.9 = false) [ if playing < max-play [ set play.9 true set player9-start timer set turtle9-timer timer set random-move9 random 30 ] ] ] ifelse play.9 = true and (timer > player9-start + (get-duration (get-phrase "phrase" phrase.9))) [ if (phrase = false) and (play = false) and (timer > player9-start + (get-duration (get-phrase "phrase" phrase.9)))[ set player9-start timer set turtle9-timer timer set random-move9 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.9 = true) [set canon.9 false] if (z = 1) and (canon.9 = false) [set canon.9 true] ] if (transform = true) and (transforming < max-transforming) [set transform.9 transformation] if octave = true [ if no-agents-this-instrument instrument.9 > 1 [set octave.9 new-octave instrument.9 who] ] ;************************************* ifelse volume = true [set volume.9 get-volume-change] [set volume.9 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.9 "none" ] if q = 1 [set offset.9 "quarter" ] if q = 2 [set offset.9 "eighth" ] if q = 3 [set offset.9 "sixteenth"] ] [ set offset.9 "none" ] ] [ set sync9-to "m" set offset.9 "none" if octave = true [ if no-agents-this-instrument instrument.9 > 1 [set octave.9 0] ] if transform = true [set transform.9 "none"] set canon.9 false ] ] ifelse play.9 = true [ if volume.9 = 0 [ ifelse volume = true [set volume.9 get-volume-change ] [set volume.9 64] ] ] [ set canon.9 false set sync9-to "m" set offset.9 "none" set volume.9 0 if transform = true [set transform.9 "none"] if octave = true [set octave.9 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 10 [ let bmove false if ((phrase.10 + 1) - hindmost < 3) and (timer > player10-start + (get-duration (get-phrase "phrase" phrase.10))) and (no-agents-this-phrase (phrase.10 + 1) < max-per-phrase) [ let x random ((probability / turtle10-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle10-timer + duration - (random-move10)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.10) = 1) and last-agent-playing (phrase.10) = who)[ if last-agent-play = true [ set play.10 true if octave = true [ if no-agents-this-instrument instrument.10 > 1 [ set octave.10 new-octave instrument.10 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle10-timer timer set phrase.10 phrase.10 + 1 set random-move10 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.10 = true) [ if playing > min-play [ set play.10 false set player10-transformed-pitchlist [""] set player10-start 0 ;set volume.10 0 ] ] if (y = 1) and (play.10 = false) [ if playing < max-play [ set play.10 true set player10-start timer set turtle10-timer timer set random-move10 random 30 ] ] ] ifelse play.10 = true and (timer > player10-start + (get-duration (get-phrase "phrase" phrase.10))) [ if (phrase = false) and (play = false) and (timer > player10-start + (get-duration (get-phrase "phrase" phrase.10)))[ set player10-start timer set turtle10-timer timer set random-move10 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.10 = true) [set canon.10 false] if (z = 1) and (canon.10 = false) [set canon.10 true] ] if (transform = true) and (transforming < max-transforming) [set transform.10 transformation] if octave = true [ if no-agents-this-instrument instrument.10 > 1 [set octave.10 new-octave instrument.10 who] ] ;************************************* ifelse volume = true [set volume.10 get-volume-change ] [set volume.10 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.10 "none" ] if q = 1 [set offset.10 "quarter" ] if q = 2 [set offset.10 "eighth" ] if q = 3 [set offset.10 "sixteenth"] ] [ set offset.10 "none" ] ] [ set sync10-to "m" set offset.10 "none" if octave = true [ if no-agents-this-instrument instrument.10 > 1 [set octave.10 0] ] if transform = true [set transform.10 "none"] set canon.10 false ] ] ifelse play.10 = true [ if volume.10 = 0 [ ifelse volume = true [set volume.10 get-volume-change] [set volume.10 64] ] ] [ set canon.10 false set sync10-to "m" set offset.10 "none" set volume.10 0 if transform = true [set transform.10 "none"] if octave = true [set octave.10 0] ] sync-with-others who ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if who = 11 [ let bmove false if ((phrase.11 + 1) - hindmost < 3) and (timer > player11-start + (get-duration (get-phrase "phrase" phrase.11))) and (no-agents-this-phrase (phrase.11 + 1) < max-per-phrase) [ let x random ((probability / turtle11-elapsed) * 100) ifelse x = 0 [ set bmove true ] [ if (timer >= turtle11-timer + duration - (random-move11)) [ set bmove true ] ] ] if bmove = false and ((no-agents-this-phrase (phrase.11) = 1) and last-agent-playing (phrase.11) = who)[ if last-agent-play = true [ set play.11 true if octave = true [ if no-agents-this-instrument instrument.11 > 1 [ set octave.11 new-octave instrument.11 who ] ] ] ] if bmove = true [ if phrase = true [ set turtle11-timer timer set phrase.11 phrase.11 + 1 set random-move11 random 30 ] if play = true [ let y random 2 if (y = 0) and (play.11 = true) [ if playing > min-play [ set play.11 false set player11-transformed-pitchlist [""] set player11-start 0 ;set volume.11 0 ] ] if (y = 1) and (play.11 = false) [ if playing < max-play [ set play.11 true set player11-start timer set turtle11-timer timer set random-move11 random 30 ] ] ] ifelse play.11 = true and (timer > player11-start + (get-duration (get-phrase "phrase" phrase.11))) [ if (phrase = false) and (play = false) and (timer > player11-start + (get-duration (get-phrase "phrase" phrase.11)))[ set player11-start timer set turtle11-timer timer set random-move11 random 30 ] if canon = true [ let z random 2 if (z = 0) and (canon.11 = true) [set canon.11 false] if (z = 1) and (canon.11 = false) [set canon.11 true] ] if (transform = true) and (transforming < max-transforming) [set transform.11 transformation] if octave = true [ if no-agents-this-instrument instrument.11 > 1 [set octave.11 new-octave instrument.11 who] ] ;************************************* ifelse volume = true [set volume.11 get-volume-change ] [set volume.11 64] ;************************************* ifelse offset = true and canon = true and offsetting < max-offsetting [ let q random offset-base-no if q = 0 [set offset.11 "none" ] if q = 1 [set offset.11 "quarter" ] if q = 2 [set offset.11 "eighth" ] if q = 3 [set offset.11 "sixteenth"] ] [ set offset.11 "none" ] ] [ set sync11-to "m" set offset.11 "none" if octave = true [ if no-agents-this-instrument instrument.11 > 1 [set octave.11 0] ] if transform = true [set transform.11 "none"] set canon.11 false ] ] ifelse play.11 = true [ if volume.11 = 0 [ ifelse volume = true [set volume.11 get-volume-change ] [set volume.11 64] ] ] [ set canon.11 false set sync11-to "m" set offset.11 "none" set volume.11 0 if transform = true [set transform.11 "none"] if octave = true [set octave.11 0] ] sync-with-others who ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to turtle-time2 ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 1 [ set label (word instrument.1 " (" phrase.1 ")") ifelse play.1 = true and instrument.1 != "none" [set color red] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 2 [ set label (word instrument.2 " (" phrase.2 ")") ifelse play.2 = true and instrument.2 != "none" [set color orange] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 3 [ set label (word instrument.3 " (" phrase.3 ")") ifelse play.3 = true and instrument.3 != "none" [set color yellow] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 4 [ set label (word instrument.4 " (" phrase.4 ")") ifelse play.4 = true and instrument.4 != "none" [set color green] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 5 [ set label (word instrument.5 " (" phrase.5 ")") ifelse play.5 = true and instrument.5 != "none" [set color blue] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 6 [ set label (word instrument.6 " (" phrase.6 ")") ifelse play.6 = true and instrument.6 != "none" [set color violet] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 7 [ set label (word instrument.7 " (" phrase.7 ")") ifelse play.7 = true and instrument.7 != "none" [set color pink] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 8 [ set label (word instrument.8 " (" phrase.8 ")") ifelse play.8 = true and instrument.8 != "none" [set color brown] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 9 [ set label (word instrument.9 " (" phrase.9 ")") ifelse play.9 = true and instrument.9 != "none" [set color lime] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 10 [ set label (word instrument.10 " (" phrase.10 ")") ifelse play.10 = true and instrument.10 != "none" [set color cyan] [set color gray] ] ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ask turtle 11 [ set label (word instrument.11 " (" phrase.11 ")") ifelse play.11 = true and instrument.11 != "none" [set color magenta] [set color gray] ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to sync-timers set turtle1-elapsed (TIMER - turtle1-timer) set turtle2-elapsed (TIMER - turtle2-timer) set turtle3-elapsed (TIMER - turtle3-timer) set turtle4-elapsed (TIMER - turtle4-timer) set turtle5-elapsed (TIMER - turtle5-timer) set turtle6-elapsed (TIMER - turtle6-timer) set turtle7-elapsed (TIMER - turtle7-timer) set turtle8-elapsed (TIMER - turtle8-timer) set turtle9-elapsed (TIMER - turtle9-timer) set turtle10-elapsed (TIMER - turtle10-timer) set turtle11-elapsed (TIMER - turtle11-timer) end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to capture-moment set this-moment user-new-file ;file-open user-new-file file-open this-moment ;;player settings ;;................................1 file-write instrument.1 file-write phrase.1 file-write sync1-to file-write offset.1 file-write octave.1 file-write volume.1 file-write play.1 file-write transform.1 file-write canon.1 ;;................................2 file-write instrument.2 file-write phrase.2 file-write sync2-to file-write offset.2 file-write octave.2 file-write volume.2 file-write play.2 file-write transform.2 file-write canon.2 ;;................................3 file-write instrument.3 file-write phrase.3 file-write sync3-to file-write offset.3 file-write octave.3 file-write volume.3 file-write play.3 file-write transform.3 file-write canon.3 ;;................................4 file-write instrument.4 file-write phrase.4 file-write sync4-to file-write offset.4 file-write octave.4 file-write volume.4 file-write play.4 file-write transform.4 file-write canon.4 ;;................................5 file-write instrument.5 file-write phrase.5 file-write sync5-to file-write offset.5 file-write octave.5 file-write volume.5 file-write play.5 file-write transform.5 file-write canon.5 ;;................................6 file-write instrument.6 file-write phrase.6 file-write sync6-to file-write offset.6 file-write octave.6 file-write volume.6 file-write play.6 file-write transform.6 file-write canon.6 ;;................................7 file-write instrument.7 file-write phrase.7 file-write sync7-to file-write offset.7 file-write octave.7 file-write volume.7 file-write play.7 file-write transform.7 file-write canon.7 ;;................................8 file-write instrument.8 file-write phrase.8 file-write sync8-to file-write offset.8 file-write octave.8 file-write volume.8 file-write play.8 file-write transform.8 file-write canon.8 ;;................................9 file-write instrument.9 file-write phrase.9 file-write sync9-to file-write offset.9 file-write octave.9 file-write volume.9 file-write play.9 file-write transform.9 file-write canon.9 ;;................................10 file-write instrument.10 file-write phrase.10 file-write sync10-to file-write offset.10 file-write octave.10 file-write volume.10 file-write play.10 file-write transform.10 file-write canon.10 ;;................................11 file-write instrument.11 file-write phrase.11 file-write sync11-to file-write offset.11 file-write octave.11 file-write volume.11 file-write play.11 file-write transform.11 file-write canon.11 ;;volume file-write max-vol file-write min-vol ;;phrase navigation file-write hindmost file-write middle file-write foremost ;;players file-write min-play file-write max-play file-write max-per-phrase ;* file-write last-agent-play ;;phrase file-write duration file-write probability ;;offset file-write finest-offset file-write max-offsetting ;* ;transformation file-write direction file-write transpose-by file-write max-transforming file-write augmentation file-write inversion file-write reiteration file-write retrograde file-write subtraction file-write transposition ;additional transformation harmonic content file-write player1-transformed-pitchlist file-write player2-transformed-pitchlist file-write player3-transformed-pitchlist file-write player4-transformed-pitchlist file-write player5-transformed-pitchlist file-write player6-transformed-pitchlist file-write player7-transformed-pitchlist file-write player8-transformed-pitchlist file-write player9-transformed-pitchlist file-write player10-transformed-pitchlist file-write player11-transformed-pitchlist ;inflection file-write inflection ;;metronome file-write instrument.m file-write phrase.m file-write octave.m file-write volume.m ;;tempo file-write bpm ;;ensemble name file-write ensemble-name ;name of the captured moment file-write this-moment file-close end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to replay-moment set play.1 false set play.2 false set play.3 false set play.4 false set play.5 false set play.6 false set play.7 false set play.8 false set play.9 false set play.10 false set play.11 false set turtle1-elapsed 0 set turtle2-elapsed 0 set turtle3-elapsed 0 set turtle4-elapsed 0 set turtle5-elapsed 0 set turtle6-elapsed 0 set turtle7-elapsed 0 set turtle8-elapsed 0 set turtle9-elapsed 0 set turtle10-elapsed 0 set turtle11-elapsed 0 set turtle1-timer 0 set turtle2-timer 0 set turtle3-timer 0 set turtle4-timer 0 set turtle5-timer 0 set turtle6-timer 0 set turtle7-timer 0 set turtle8-timer 0 set turtle9-timer 0 set turtle10-timer 0 set turtle11-timer 0 wait 2 let replay-delay 15 set play1-next play1-next + replay-delay set play2-next play2-next + replay-delay set play3-next play3-next + replay-delay set play4-next play4-next + replay-delay set play5-next play5-next + replay-delay set play6-next play6-next + replay-delay set play7-next play7-next + replay-delay set play8-next play8-next + replay-delay set play9-next play9-next + replay-delay set play10-next play10-next + replay-delay set play11-next play11-next + replay-delay set playingm? false set playing1? false set playing2? false set playing3? false set playing4? false set playing5? false set playing6? false set playing7? false set playing8? false set playing9? false set playing10? false set playing11? false wait 1 file-open user-file ;;................................1 set instrument.1 file-read set phrase.1 file-read set sync1-to file-read set offset.1 file-read set octave.1 file-read set volume.1 file-read set play.1 file-read set transform.1 file-read set canon.1 file-read ;;................................2 set instrument.2 file-read set phrase.2 file-read set sync2-to file-read set offset.2 file-read set octave.2 file-read set volume.2 file-read set play.2 file-read set transform.2 file-read set canon.2 file-read ;;................................3 set instrument.3 file-read set phrase.3 file-read set sync3-to file-read set offset.3 file-read set octave.3 file-read set volume.3 file-read set play.3 file-read set transform.3 file-read set canon.3 file-read ;;................................4 set instrument.4 file-read set phrase.4 file-read set sync4-to file-read set offset.4 file-read set octave.4 file-read set volume.4 file-read set play.4 file-read set transform.4 file-read set canon.4 file-read ;;................................5 set instrument.5 file-read set phrase.5 file-read set sync5-to file-read set offset.5 file-read set octave.5 file-read set volume.5 file-read set play.5 file-read set transform.5 file-read set canon.5 file-read ;;................................6 set instrument.6 file-read set phrase.6 file-read set sync6-to file-read set offset.6 file-read set octave.6 file-read set volume.6 file-read set play.6 file-read set transform.6 file-read set canon.6 file-read ;;................................7 set instrument.7 file-read set phrase.7 file-read set sync7-to file-read set offset.7 file-read set octave.7 file-read set volume.7 file-read set play.7 file-read set transform.7 file-read set canon.7 file-read ;;................................8 set instrument.8 file-read set phrase.8 file-read set sync8-to file-read set offset.8 file-read set octave.8 file-read set volume.8 file-read set play.8 file-read set transform.8 file-read set canon.8 file-read ;;................................9 set instrument.9 file-read set phrase.9 file-read set sync9-to file-read set offset.9 file-read set octave.9 file-read set volume.9 file-read set play.9 file-read set transform.9 file-read set canon.9 file-read ;;................................10 set instrument.10 file-read set phrase.10 file-read set sync10-to file-read set offset.10 file-read set octave.10 file-read set volume.10 file-read set play.10 file-read set transform.10 file-read set canon.10 file-read ;;................................11 set instrument.11 file-read set phrase.11 file-read set sync11-to file-read set offset.11 file-read set octave.11 file-read set volume.11 file-read set play.11 file-read set transform.11 file-read set canon.11 file-read ;;volume set max-vol file-read ;* set min-vol file-read ;* ;;phrase navigation set hindmost file-read set middle file-read set foremost file-read ;;players set min-play file-read set max-play file-read set max-per-phrase file-read ;* set last-agent-play file-read ;;phrase set duration file-read set probability file-read ;;offset set finest-offset file-read set max-offsetting file-read ;* ;transformation set direction file-read set transpose-by file-read set max-transforming file-read set augmentation file-read set inversion file-read set reiteration file-read set retrograde file-read set subtraction file-read set transposition file-read ;additional transformation harmonic content set player1-transformed-pitchlist file-read set player2-transformed-pitchlist file-read set player3-transformed-pitchlist file-read set player4-transformed-pitchlist file-read set player5-transformed-pitchlist file-read set player6-transformed-pitchlist file-read set player7-transformed-pitchlist file-read set player8-transformed-pitchlist file-read set player9-transformed-pitchlist file-read set player10-transformed-pitchlist file-read set player11-transformed-pitchlist file-read set inflection file-read ;;;metronome set instrument.m file-read set phrase.m file-read set octave.m file-read set volume.m file-read ;;tempo set bpm file-read ;;ensemble name set ensemble-name file-read ;name of the captured moment set from-moment file-read file-close let str-len length from-moment let i str-len let bfound false while [i > 0 and not bfound] [ if item (i - 1) from-moment = "/" [set bfound true] set i i - 1 ] set from-moment substring from-moment (i + 1) (length from-moment - 4) end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- ;==================================================================================================================================================================== ; 4. REPORTERS ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report whole report precision (half + half) precision-no end to-report half report precision (quarter + quarter) precision-no end to-report quarter report precision (1 / (bpm / 60)) precision-no end to-report eighth report precision (quarter / 2) precision-no end to-report sixteenth report precision (eighth / 2) precision-no end to-report thirtysecond report precision (sixteenth / 2) precision-no end to-report sixtyfourth report precision (thirtysecond / 2) precision-no end to-report onetwentyeighth report precision (sixtyfourth / 2) precision-no end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-phrase [list-type phrase-index] let x 0 let ldur 0 let lbfound false let mylist "" ifelse list-type = "phrase" [ while [(x < length phrase-list) and (lbfound = false)][ if phrase-index = (item x phrase-list) [ set lbfound true ;stop the loop set mylist (item (x + 1) phrase-list) ] set x x + 1 ] ] [ ;get phrases from the metronome list instead here..... while [(x < length metronome-list) and (lbfound = false)][ if phrase-index = (item x metronome-list) [ set lbfound true ;stop the loop set mylist (item (x + 1) metronome-list) ] set x x + 1 ] ] report mylist end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-duration [this-phrase] let lstring "" let x 0 let ldur 0 while [x < length this-phrase][ if (is-string? (item x this-phrase)) and ((item x this-phrase)!= "rest") [ ;Normal values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "half" [set ldur (ldur + half) ] if (item x this-phrase) = "quarter" [set ldur (ldur + quarter) ] if (item x this-phrase) = "eighth" [set ldur (ldur + eighth) ] if (item x this-phrase) = "whole" [set ldur (ldur + whole) ] if (item x this-phrase) = "sixteenth" [set ldur (ldur + sixteenth) ] if (item x this-phrase) = "thirtysecond" [set ldur (ldur + thirtysecond) ] if (item x this-phrase) = "sixtyfourth" [set ldur (ldur + sixtyfourth) ] if (item x this-phrase) = "onetwentyeighth" [set ldur (ldur + onetwentyeighth) ] ;Dotted values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "dotted whole" [set ldur (ldur + (whole + half)) ] if (item x this-phrase) = "dotted half" [set ldur (ldur + (half + quarter)) ] if (item x this-phrase) = "dotted quarter" [set ldur (ldur + (quarter + eighth)) ] if (item x this-phrase) = "dotted eighth" [set ldur (ldur + (eighth + sixteenth)) ] if (item x this-phrase) = "dotted sixteenth" [set ldur (ldur + (sixteenth + thirtysecond)) ] ;Tied values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "sixteenth and dotted quarter" [set ldur (ldur + (sixteenth + quarter + eighth)) ] if (item x this-phrase) = "sixteenth and dotted half" [set ldur (ldur + (sixteenth + half + quarter)) ] if (item x this-phrase) = "eighth and eighth" [set ldur (ldur + (eighth + eighth)) ] if (item x this-phrase) = "eighth and dotted half" [set ldur (ldur + (eighth + half + quarter)) ] if (item x this-phrase) = "eighth and half" [set ldur (ldur + (eighth + half)) ] ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;AUGMENTED VALUES ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;by eighth note: ;============== ;Normal values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "whole and eighth" [set ldur (ldur + (whole + eighth)) ] if (item x this-phrase) = "half and eighth" [set ldur (ldur + (half + eighth)) ] if (item x this-phrase) = "quarter and eighth" [set ldur (ldur + (quarter + eighth)) ] if (item x this-phrase) = "eighth and eighth" [set ldur (ldur + (eighth + eighth)) ] if (item x this-phrase) = "sixteenth and eighth" [set ldur (ldur + (sixteenth + eighth)) ] if (item x this-phrase) = "thirtysecond and eighth" [set ldur (ldur + (thirtysecond + eighth)) ] if (item x this-phrase) = "sixtyfourth and eighth" [set ldur (ldur + (sixtyfourth + eighth)) ] if (item x this-phrase) = "onetwentyeighth and eighth" [set ldur (ldur + (onetwentyeighth + eighth)) ] ;Dot values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "dotted whole and eighth" [set ldur (ldur + (whole + half + eighth)) ] if (item x this-phrase) = "dotted half and eighth" [set ldur (ldur + (half + quarter + eighth)) ] if (item x this-phrase) = "dotted quarter and eighth" [set ldur (ldur + (quarter + eighth + eighth)) ] if (item x this-phrase) = "dotted eighth and eighth" [set ldur (ldur + (eighth + sixteenth + eighth)) ] if (item x this-phrase) = "dotted sixteenth and eighth" [set ldur (ldur + (sixteenth + thirtysecond + eighth)) ] ;Tied values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "sixteenth and dotted quarter and eighth" [set ldur (ldur + (sixteenth + quarter + eighth + eighth)) ] if (item x this-phrase) = "sixteenth and dotted half and eighth" [set ldur (ldur + (sixteenth + half + quarter + eighth)) ] if (item x this-phrase) = "eighth and eighth and eighth" [set ldur (ldur + (eighth + eighth + eighth)) ] if (item x this-phrase) = "eighth and dotted half and eighth" [set ldur (ldur + (eighth + half + quarter + eighth)) ] if (item x this-phrase) = "eighth and half and eighth" [set ldur (ldur + (eighth + half + eighth)) ] ;by quarter note: ;Normal values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "half and quarter" [set ldur (ldur + half + quarter) ] if (item x this-phrase) = "quarter and quarter" [set ldur (ldur + quarter + quarter) ] if (item x this-phrase) = "eighth and quarter" [set ldur (ldur + eighth + quarter) ] if (item x this-phrase) = "whole and quarter" [set ldur (ldur + whole + quarter) ] if (item x this-phrase) = "sixteenth and quarter" [set ldur (ldur + sixteenth + quarter) ] if (item x this-phrase) = "thirtysecond and quarter" [set ldur (ldur + thirtysecond + quarter) ] if (item x this-phrase) = "sixtyfourth and quarter" [set ldur (ldur + sixtyfourth + quarter) ] if (item x this-phrase) = "onetwentyeighth and quarter" [set ldur (ldur + onetwentyeighth + quarter) ] ;Dotted values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "dotted whole and quarter" [set ldur (ldur + (whole + half + quarter)) ] if (item x this-phrase) = "dotted half and quarter" [set ldur (ldur + (half + quarter + quarter)) ] if (item x this-phrase) = "dotted quarter and quarter" [set ldur (ldur + (quarter + eighth + quarter)) ] if (item x this-phrase) = "dotted eighth and quarter" [set ldur (ldur + (eighth + sixteenth + quarter)) ] if (item x this-phrase) = "dotted sixteenth and quarter" [set ldur (ldur + (sixteenth + thirtysecond + quarter)) ] ;Tied values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if (item x this-phrase) = "sixteenth and dotted quarter and quarter" [set ldur (ldur + (sixteenth + quarter + eighth + quarter)) ] if (item x this-phrase) = "sixteenth and dotted half and quarter" [set ldur (ldur + (sixteenth + half + quarter + quarter)) ] if (item x this-phrase) = "eighth and eighth and quarter" [set ldur (ldur + (eighth + eighth + quarter)) ] if (item x this-phrase) = "eighth and dotted half and quarter" [set ldur (ldur + (eighth + half + quarter + quarter)) ] if (item x this-phrase) = "eighth and half and quarter" [set ldur (ldur + (eighth + half + quarter)) ] ] set x x + 1 ] report precision ldur precision-no end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-volume-change let this-vol 0 let i-min-avg-max random 3 let i-rand-vol-offset random 21 let i-offset-direction random 2 ifelse i-min-avg-max = 0 [ ifelse i-offset-direction = 0 [set this-vol (minimum-vol - i-rand-vol-offset)] [set this-vol (minimum-vol + i-rand-vol-offset)] ] [ ifelse i-min-avg-max = 1 [ ifelse i-offset-direction = 0 [set this-vol (average-vol - i-rand-vol-offset)] [set this-vol (average-vol + i-rand-vol-offset)] ] [ ifelse i-offset-direction = 0 [set this-vol (maximum-vol - i-rand-vol-offset)] [set this-vol (maximum-vol + i-rand-vol-offset)] ] ] ifelse this-vol > max-vol [ set this-vol max-vol ] [ if this-vol < min-vol [set this-vol min-vol] ] report this-vol end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-average-volume let itotal-players 0 let itotal-volume 0 if play.1 = true and volume.1 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.1] if play.2 = true and volume.2 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.2] if play.3 = true and volume.3 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.3] if play.4 = true and volume.4 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.4] if play.5 = true and volume.5 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.5] if play.6 = true and volume.6 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.6] if play.7 = true and volume.7 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.7] if play.8 = true and volume.8 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.8] if play.9 = true and volume.9 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.9] if play.10 = true and volume.10 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.10] if play.11 = true and volume.11 > 0 [set itotal-players itotal-players + 1 set itotal-volume itotal-volume + volume.11] ifelse itotal-volume > 0 and itotal-players > 0 [set average-vol itotal-volume / itotal-players] [set average-vol 0] report average-vol end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-time-value [value-string] ;Converts a string to a numeric variable ;Normal values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "whole" [report whole ] if value-string = "half" [report half ] if value-string = "quarter" [report quarter ] if value-string = "eighth" [report eighth ] if value-string = "sixteenth" [report sixteenth ] if value-string = "thirtysecond" [report thirtysecond ] if value-string = "sixtyfourth" [report sixtyfourth ] if value-string = "onetwentyeighth" [report onetwentyeighth ] ;Dot values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "dotted whole" [report whole + half ] if value-string = "dotted half" [report half + quarter ] if value-string = "dotted quarter" [report quarter + eighth ] if value-string = "dotted eighth" [report eighth + sixteenth ] if value-string = "dotted sixteenth" [report sixteenth + thirtysecond ] ;Tied values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "sixteenth and dotted quarter" [report sixteenth + quarter + eighth ] if value-string = "sixteenth and dotted half" [report sixteenth + half + quarter ] if value-string = "eighth and eighth" [report eighth + eighth ] if value-string = "eighth and dotted half" [report eighth + half + quarter ] if value-string = "eighth and half" [report eighth + half ] ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;AUGMENTED VALUES ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;by eighth note: ;============== ;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "whole and eighth" [report whole + eighth ] if value-string = "half and eighth" [report half + eighth ] if value-string = "quarter and eighth" [report quarter + eighth ] if value-string = "eighth and eighth" [report eighth + eighth ] if value-string = "sixteenth and eighth" [report sixteenth + eighth ] if value-string = "thirtysecond and eighth" [report thirtysecond + eighth ] if value-string = "sixtyfourth and eighth" [report sixtyfourth + eighth ] if value-string = "onetwentyeighth and eighth" [report onetwentyeighth + eighth ] ;Dot values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "dotted whole and eighth" [report whole + half + eighth ] if value-string = "dotted half and eighth" [report half + quarter + eighth ] if value-string = "dotted quarter and eighth" [report quarter + eighth + eighth ] if value-string = "dotted eighth and eighth" [report eighth + sixteenth + eighth ] if value-string = "dotted sixteenth and eighth" [report sixteenth + thirtysecond + eighth ] ;Tied values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "sixteenth and dotted quarter and eighth" [report sixteenth + quarter + eighth + eighth ] if value-string = "sixteenth and dotted half and eighth" [report sixteenth + half + quarter + eighth ] if value-string = "eighth and eighth and eighth" [report eighth + eighth + eighth ] if value-string = "eighth and dotted half and eighth" [report eighth + half + quarter + eighth ] if value-string = "eighth and half and eighth" [report eighth + half + eighth ] ;by quarter note: ;=============== ;Normal values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "whole and quarter" [report whole + quarter ] if value-string = "half and quarter" [report half + quarter ] if value-string = "quarter and quarter" [report quarter + quarter ] if value-string = "eighth and quarter" [report eighth + quarter ] if value-string = "sixteenth and quarter" [report sixteenth + quarter ] if value-string = "thirtysecond and quarter" [report thirtysecond + quarter ] if value-string = "sixtyfourth and quarter" [report sixtyfourth + quarter ] if value-string = "onetwentyeighth and quarter" [report onetwentyeighth + quarter ] ;Dot values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "dotted whole and quarter" [report whole + half + quarter ] if value-string = "dotted half and quarter" [report half + quarter + quarter ] if value-string = "dotted quarter and quarter" [report quarter + eighth + quarter ] if value-string = "dotted eighth and quarter" [report eighth + sixteenth + quarter ] if value-string = "dotted sixteenth and quarter" [report sixteenth + thirtysecond + quarter ] ;Tied values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if value-string = "sixteenth and dotted quarter and quarter" [report sixteenth + quarter + eighth + quarter ] if value-string = "sixteenth and dotted half and quarter" [report sixteenth + half + quarter + quarter ] if value-string = "eighth and eighth and quarter" [report eighth + eighth + quarter ] if value-string = "eighth and dotted half and quarter" [report eighth + half + quarter + quarter ] if value-string = "eighth and half and quarter" [report eighth + half + quarter ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report playing let itotal-players-playing 0 if play.1 = true [set itotal-players-playing itotal-players-playing + 1] if play.2 = true [set itotal-players-playing itotal-players-playing + 1] if play.3 = true [set itotal-players-playing itotal-players-playing + 1] if play.4 = true [set itotal-players-playing itotal-players-playing + 1] if play.5 = true [set itotal-players-playing itotal-players-playing + 1] if play.6 = true [set itotal-players-playing itotal-players-playing + 1] if play.7 = true [set itotal-players-playing itotal-players-playing + 1] if play.8 = true [set itotal-players-playing itotal-players-playing + 1] if play.9 = true [set itotal-players-playing itotal-players-playing + 1] if play.10 = true [set itotal-players-playing itotal-players-playing + 1] if play.11 = true [set itotal-players-playing itotal-players-playing + 1] report itotal-players-playing end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report transforming let itotal-players-transforming 0 if transform.1 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.2 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.3 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.4 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.5 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.6 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.7 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.8 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.9 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.10 != "none" [set itotal-players-transforming itotal-players-transforming + 1] if transform.11 != "none" [set itotal-players-transforming itotal-players-transforming + 1] report itotal-players-transforming end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report offsetting let itotal-players-offsetting 0 if offset.1 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.2 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.3 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.4 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.5 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.6 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.7 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.8 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.9 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.10 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] if offset.11 != "none" [set itotal-players-offsetting itotal-players-offsetting + 1] report itotal-players-offsetting end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report new-octave [instrument this-agent-no] ;clear-output let this-list ["octaves"] ;let exclude-agent-no 13 ;if include-current = true ; [set exclude-agent-no this-agent-no] let exclude-agent-no this-agent-no set this-list remove-item 0 this-list if (instrument.1 = instrument) and (exclude-agent-no != 1) and play.1 = true [set this-list lput octave.1 this-list] if (instrument.2 = instrument) and (exclude-agent-no != 2) and play.2 = true [set this-list lput octave.2 this-list] if (instrument.3 = instrument) and (exclude-agent-no != 3) and play.3 = true [set this-list lput octave.3 this-list] if (instrument.4 = instrument) and (exclude-agent-no != 4) and play.4 = true [set this-list lput octave.4 this-list] if (instrument.5 = instrument) and (exclude-agent-no != 5) and play.5 = true [set this-list lput octave.5 this-list] if (instrument.6 = instrument) and (exclude-agent-no != 6) and play.6 = true [set this-list lput octave.6 this-list] if (instrument.7 = instrument) and (exclude-agent-no != 7) and play.7 = true [set this-list lput octave.7 this-list] if (instrument.8 = instrument) and (exclude-agent-no != 8) and play.8 = true [set this-list lput octave.8 this-list] if (instrument.9 = instrument) and (exclude-agent-no != 9) and play.9 = true [set this-list lput octave.9 this-list] if (instrument.10 = instrument) and (exclude-agent-no != 10) and play.10 = true [set this-list lput octave.10 this-list] if (instrument.11 = instrument) and (exclude-agent-no != 11) and play.11 = true [set this-list lput octave.11 this-list] set this-list remove-duplicates this-list let i length this-list let j 0 while [j < i][ let this-item item j this-list ifelse is-string? item j this-list [set this-list remove-item this-item this-list] [set j j + 1] ] ;(1) - other player . . . . . . . . . . . . .. . . . . . . . . . . . . . . . if length this-list > 1 [ set this-list sort-by [ [a b] -> a < b ] this-list ] let mylist this-list let val-to-add "" ifelse length mylist = 1 [ ifelse item 0 mylist = 0 [set val-to-add 1] [ ifelse abs item 0 mylist = 1 [set val-to-add 0] [ ifelse abs item 0 mylist > 2 [ if item 0 mylist > 0 [set val-to-add item 0 mylist - 1] if item 0 mylist < 0 [set val-to-add item 0 mylist + 1] ] [ if item 0 mylist = 2 [set val-to-add 1] if item 0 mylist = -2 [set val-to-add -1] ] ] ] ] [ ;(2) - other players . . . . . . . . . . . . .. . . . . . . . . . . . . . . . ifelse length mylist = 2 [ set mylist sort-by [ [a b] -> a < b ] mylist ifelse item 1 mylist - item 0 mylist > 1 ;there's a gap [set val-to-add item 1 mylist - 1] ;gapless [ ifelse item 0 mylist = 0 or item 1 mylist = 0 [ if item 0 mylist = 0 [set val-to-add -1] if item 1 mylist = 0 [set val-to-add 1] ] [ ifelse item 0 mylist = 1 or item 1 mylist = -1 [ set val-to-add 0 ] [ if item 0 mylist > 0 [set val-to-add item 0 mylist - 1] if item 1 mylist < 0 [set val-to-add item 1 mylist + 1] ] ] ] ] [ ;(3) - other players . . . . . . . . . . . . .. . . . . . . . . . . . . . . . if length mylist = 3 [ set mylist sort-by [ [a b] -> a < b ] mylist ifelse item 2 mylist - item 1 mylist > 1 [ set val-to-add item 2 mylist - 1 ] [ ifelse item 1 mylist - item 0 mylist > 1 [ set val-to-add item 1 mylist - 1 ] [ if (item 2 mylist - item 1 mylist = 1) and (item 1 mylist - item 0 mylist = 1) [ ifelse (item 0 mylist = -1) and (item 1 mylist = 0) and (item 2 mylist = 1) [ set val-to-add 2 ] [ ;[ ifelse item 0 mylist = 1 [ set val-to-add 0 ] [ ifelse item 2 mylist = -1 [ set val-to-add 0 ] [ ifelse item 0 mylist > 1 [ set val-to-add item 0 mylist - 1 ] [ ifelse item 2 mylist < -1 [ set val-to-add item 2 mylist + 1 ] [ ifelse item 0 mylist = 0 [ set val-to-add -1 ] [ if item 2 mylist = 0 [set val-to-add 1] ] ] ] ] ] ] ] ] ] ] ] ] if is-number? val-to-add [set mylist lput val-to-add mylist] set mylist sort-by [ [a b] -> a < b ] mylist ifelse is-string? val-to-add [report 0] [report val-to-add] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report no-agents-this-phrase [phrase-no] let x 1 let player-count 0 while [x < 12][ ask turtle x [ if member? (word phrase-no) label = true [set player-count player-count + 1] ] set x x + 1 ] report player-count end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report no-agents-this-instrument [instrument] let x 1 let player-count 0 while [x < 12][ ask turtle x [ if member? (word instrument) label = true [set player-count player-count + 1] ] set x x + 1 ] report player-count end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report last-agent-playing [phrase-no] let is-playing? false let x 1 let player-count 0 let bfound false while [x < 12 and bfound = false][ ask turtle x [ if member? (word phrase-no) label = true [set bfound true] ] if bfound != true [set x x + 1] ] report x end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report actually-playing [phrase-no] let is-playing? false let x 1 let player-count 0 let bfound false while [x < 12 and bfound = false][ ask turtle x [ if member? (word phrase-no) label = true [set bfound true] ] if bfound != true [set x x + 1] ] report x if phrase-no = 1 and play.1 = true [ ] if phrase-no = 2 and play.2 = true [ ] if phrase-no = 3 and play.3 = true [ ] if phrase-no = 4 and play.4 = true [ ] if phrase-no = 5 and play.5 = true [ ] if phrase-no = 6 and play.6 = true [ ] if phrase-no = 7 and play.7 = true [ ] if phrase-no = 8 and play.8 = true [ ] if phrase-no = 9 and play.9 = true [ ] if phrase-no = 10 and play.10 = true [ ] if phrase-no = 11 and play.11 = true [ ] end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-loudest let volume-list [""] let loudest-volume 0 if play.1 = true [set volume-list lput volume.1 volume-list] if play.2 = true [set volume-list lput volume.2 volume-list] if play.3 = true [set volume-list lput volume.3 volume-list] if play.4 = true [set volume-list lput volume.4 volume-list] if play.5 = true [set volume-list lput volume.5 volume-list] if play.6 = true [set volume-list lput volume.6 volume-list] if play.7 = true [set volume-list lput volume.7 volume-list] if play.8 = true [set volume-list lput volume.8 volume-list] if play.9 = true [set volume-list lput volume.9 volume-list] if play.10 = true [set volume-list lput volume.10 volume-list] if play.11 = true [set volume-list lput volume.11 volume-list] set volume-list remove-item 0 volume-list if length volume-list > 0 [ set volume-list remove-duplicates volume-list set volume-list sort-by [ [a b] -> a < b ] volume-list set loudest-volume item (length volume-list - 1) volume-list ] report loudest-volume end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-softest let volume-list [""] let softest-volume 0 if play.1 = true and volume.1 > 0 [set volume-list lput volume.1 volume-list] if play.2 = true and volume.2 > 0 [set volume-list lput volume.2 volume-list] if play.3 = true and volume.3 > 0 [set volume-list lput volume.3 volume-list] if play.4 = true and volume.4 > 0 [set volume-list lput volume.4 volume-list] if play.5 = true and volume.5 > 0 [set volume-list lput volume.5 volume-list] if play.6 = true and volume.6 > 0 [set volume-list lput volume.6 volume-list] if play.7 = true and volume.7 > 0 [set volume-list lput volume.7 volume-list] if play.8 = true and volume.8 > 0 [set volume-list lput volume.8 volume-list] if play.9 = true and volume.9 > 0 [set volume-list lput volume.9 volume-list] if play.10 = true and volume.10 > 0 [set volume-list lput volume.10 volume-list] if play.11 = true and volume.11 > 0 [set volume-list lput volume.11 volume-list] set volume-list remove-item 0 volume-list if length volume-list > 0 [ set volume-list remove-duplicates volume-list set volume-list sort-by [ [a b] -> a < b ] volume-list set softest-volume item 0 volume-list ] report softest-volume end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report do-retrograde [this-list] let new-list reverse this-list let number-of-notes (length this-list) / 2 let i 0 while [i < number-of-notes * 2][ let first-item (item i new-list) let second-item (item (i + 1) new-list) set new-list replace-item (i + 1) new-list first-item set new-list replace-item i new-list second-item set i i + 2 ] report new-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report invert [old-list] let new-list old-list let i 0 let j 0 while [(i < length old-list - 1)][ let bskipped-rest false if (i + 2) <= (length old-list - 1) [ let first-note item i old-list let second-note item (i + 2) old-list if is-number? first-note [ ifelse is-number? second-note [ ifelse second-note > first-note [ let interval second-note - first-note set new-list replace-item (i + 2) new-list (item i new-list - interval) ] [ ifelse first-note > second-note [ let interval first-note - second-note set new-list replace-item (i + 2) new-list (item i new-list + interval) ] [ set new-list replace-item (i + 2) new-list (item i new-list) ] ] ] [;--------------------------------------------------------------------------------------- set j i + 4 while [(j < length old-list - 1) and bskipped-rest = false][ set second-note item j old-list ifelse is-number? second-note [ set bskipped-rest true ] [ set j j + 2 ] ];end of j while loop if bskipped-rest = true [ ifelse second-note > first-note [ let interval second-note - first-note set new-list replace-item j new-list (item i new-list - interval) ] [ ifelse first-note > second-note [ let interval first-note - second-note set new-list replace-item j new-list (item i new-list + interval) ] [ set new-list replace-item j new-list (item i new-list) ] ] ] ];end of else case for skipping a rest ;--------------------------------------------------------------------------------------- ];end of is-number check for first note ];end of phrase-length offset ifelse bskipped-rest = true [set i j];if a rest was skipped reset the big loop to the position of the next note [set i i + 2];if not, then just continue to the big loop with the next note ];end of i while loop report new-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report transpose [old-list] let transpose-value 0 ifelse transpose-by = "minor second" [set transpose-value 1] [ifelse transpose-by = "major second" [set transpose-value 2] [ifelse transpose-by = "minor third" [set transpose-value 3] [ifelse transpose-by = "major third" [set transpose-value 4] [ifelse transpose-by = "perfect fourth" [set transpose-value 5] [ifelse transpose-by = "perfect fifth" [set transpose-value 7][]]]]]] ;last else case left blank for future cases.... let new-list old-list if (direction != "none") and (transpose-by != "none") [ let i 0 while [i < length old-list - 1][ if is-number? item i old-list [ ifelse direction = "up" [set new-list replace-item i new-list (item i new-list + transpose-value)] ;transpose direction is "down" for the else case... [set new-list replace-item i new-list (item i new-list - transpose-value)] ] set i i + 2 ] ] report new-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report augment [old-list] let new-list old-list if augment-by != "none" [ let i 1 while [i < length old-list][ set new-list replace-item i new-list ((word (item i new-list) " and " augment-by)) set i i + 2 ] ] report new-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report reiterate [old-list] let new-list old-list let number-of-notes (length old-list / 2) let rand-reiterate-no random (number-of-notes) let i 0 let this-sentence "x" while [i < length old-list][ ifelse i = rand-reiterate-no * 2 [set this-sentence (sentence this-sentence item i old-list item (i + 1) old-list) set this-sentence (sentence this-sentence item i old-list item (i + 1) old-list)] [set this-sentence (sentence this-sentence item i old-list item (i + 1) old-list)] set i i + 2 ] set new-list but-first this-sentence report new-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report subtract [old-list] let new-list old-list let number-of-notes (length old-list / 2) let i 0 let bfound-note false while [i < 1000 and not bfound-note = true][ let rand-note random (number-of-notes) if item (rand-note * 2) old-list != "rest" [ set bfound-note true set new-list replace-item (rand-note * 2) new-list "rest" ] set i i + 1 ] report new-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report transformation let transformation-list ["none"] if augmentation = true [set transformation-list lput "augmentation" transformation-list] if inversion = true [set transformation-list lput "inversion" transformation-list] if reiteration = true [set transformation-list lput "reiteration" transformation-list] if retrograde = true [set transformation-list lput "retrograde" transformation-list] if subtraction = true [set transformation-list lput "subtraction" transformation-list] if transposition = true [set transformation-list lput "transposition" transformation-list] let i-select-transform random length transformation-list set transformation-list shuffle transformation-list let this-transformation item i-select-transform transformation-list report this-transformation end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report harmonic-content let this-phrase-list [" "] let this-note-list [" "] let this-inverted-note-list [" "] set this-phrase-list lput phrase.1 this-phrase-list set this-phrase-list lput phrase.2 this-phrase-list set this-phrase-list lput phrase.3 this-phrase-list set this-phrase-list lput phrase.4 this-phrase-list set this-phrase-list lput phrase.5 this-phrase-list set this-phrase-list lput phrase.6 this-phrase-list set this-phrase-list lput phrase.7 this-phrase-list set this-phrase-list lput phrase.8 this-phrase-list set this-phrase-list lput phrase.9 this-phrase-list set this-phrase-list lput phrase.10 this-phrase-list set this-phrase-list lput phrase.11 this-phrase-list set this-phrase-list remove-item 0 this-phrase-list set this-phrase-list remove-duplicates this-phrase-list set this-phrase-list sort-by [ [a b] -> a < b ] this-phrase-list let current-phrase [""] let ilength length this-phrase-list let i 0 while [i < ilength] [ set current-phrase get-phrase "phrase" item i this-phrase-list let jlength length current-phrase let j 0 while [j < jlength][ set this-note-list lput item j current-phrase this-note-list set j j + 1 ] set i i + 1 ] let klength length this-note-list let k 0 while [k < klength][ ifelse is-number? item k this-note-list [set k k + 1] [ set this-note-list remove-item k this-note-list set klength klength - 1 ] ] set this-note-list remove-duplicates this-note-list set this-note-list sort-by [ [a b] -> a < b ] this-note-list let additional-notes get-additional-transformation-notes let z 0 if length additional-notes > 0 [ while [z < length additional-notes][ set this-note-list lput item z additional-notes this-note-list set z z + 1 ] ] set this-note-list remove-duplicates this-note-list set this-note-list sort-by [ [a b] -> a < b ] this-note-list report this-note-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-additional-transformation-notes let transformation-note-list [""] let i 0 ; . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 1 if length player1-transformed-pitchlist > 0 [ set i 0 while [i < length player1-transformed-pitchlist][ set transformation-note-list lput item i player1-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 2 if length player2-transformed-pitchlist > 0 [ set i 0 while [i < length player2-transformed-pitchlist][ set transformation-note-list lput item i player2-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 3 if length player3-transformed-pitchlist > 0 [ set i 0 while [i < length player3-transformed-pitchlist][ set transformation-note-list lput item i player3-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 4 if length player4-transformed-pitchlist > 0 [ set i 0 while [i < length player4-transformed-pitchlist][ set transformation-note-list lput item i player4-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 5 if length player5-transformed-pitchlist > 0 [ set i 0 while [i < length player5-transformed-pitchlist][ set transformation-note-list lput item i player5-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 6 if length player6-transformed-pitchlist > 0 [ set i 0 while [i < length player6-transformed-pitchlist][ set transformation-note-list lput item i player6-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 7 if length player7-transformed-pitchlist > 0 [ set i 0 while [i < length player7-transformed-pitchlist][ set transformation-note-list lput item i player7-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 8 if length player8-transformed-pitchlist > 0 [ set i 0 while [i < length player8-transformed-pitchlist][ set transformation-note-list lput item i player8-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 9 if length player9-transformed-pitchlist > 0 [ set i 0 while [i < length player9-transformed-pitchlist][ set transformation-note-list lput item i player9-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 10 if length player10-transformed-pitchlist > 0 [ set i 0 while [i < length player10-transformed-pitchlist][ set transformation-note-list lput item i player10-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ;player 11 if length player11-transformed-pitchlist > 0 [ set i 0 while [i < length player11-transformed-pitchlist][ set transformation-note-list lput item i player11-transformed-pitchlist transformation-note-list set i i + 1 ] ];. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . set transformation-note-list remove-item 0 transformation-note-list set transformation-note-list remove-duplicates transformation-note-list set i 0 while [i < length transformation-note-list][ ifelse is-number? item i transformation-note-list [set i i + 1] [set transformation-note-list remove-item i transformation-note-list] ] report transformation-note-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report create-scale [initial-note] let scalar-list [""] set scalar-list remove-item 0 scalar-list set scalar-list lput initial-note scalar-list ;I set scalar-list lput (initial-note + 2) scalar-list ;ii set scalar-list lput (initial-note + 4) scalar-list ;III set scalar-list lput (initial-note + 5) scalar-list ;IV set scalar-list lput (initial-note + 7) scalar-list ;V set scalar-list lput (initial-note + 9) scalar-list ;vi set scalar-list lput (initial-note + 11) scalar-list ;vii report scalar-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report expand-by-octaves [initial-note] let octaves-list [""] set octaves-list remove-item 0 octaves-list set octaves-list lput initial-note octaves-list let octave-down initial-note while [octave-down >= 0] [ set octave-down octave-down - 12 if octave-down >= 0 [set octaves-list lput octave-down octaves-list] ] let octave-up initial-note while [octave-up <= 127] [ set octave-up octave-up + 12 if octave-up <= 127 [set octaves-list lput octave-up octaves-list] ] set octaves-list sort-by [ [a b] -> a < b ] octaves-list report octaves-list end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report do-stuff [initial-note] let scale-notes create-scale initial-note let phrase-notes harmonic-content let evidence-tonic 0 let evidence-second 0 let evidence-third 0 let evidence-fourth 0 let evidence-fifth 0 let evidence-sixth 0 let evidence-seventh 0 let iphrase-notes-length length phrase-notes let iphrase-note-index 0 while [iphrase-note-index < iphrase-notes-length][ let iscale-note-index 0 let iscale-notes-length length scale-notes let bfound false while [(iscale-note-index < iscale-notes-length) and bfound = false][ ifelse item iphrase-note-index phrase-notes = item iscale-note-index scale-notes [ set bfound true if bfound = true [ ifelse iscale-note-index = 0 [set evidence-tonic evidence-tonic + 10] [ifelse iscale-note-index = 1 [set evidence-second evidence-second + 3] [ifelse iscale-note-index = 2 [set evidence-third evidence-third + 7] [ifelse iscale-note-index = 3 [set evidence-fourth evidence-fourth + 5] [ifelse iscale-note-index = 4 [set evidence-fifth evidence-fifth + 5] [ifelse iscale-note-index = 5 [set evidence-sixth evidence-sixth + 3] [ifelse iscale-note-index = 6 [set evidence-seventh evidence-seventh + 7][]]]]]]]] ] [ let expanded-scale-notes expand-by-octaves item iscale-note-index scale-notes let iexpanded-scale-notes-index 0 let iexpanded-scale-notes-length length expanded-scale-notes while [(iexpanded-scale-notes-index < iexpanded-scale-notes-length) and bfound = false ][ ifelse item iphrase-note-index phrase-notes = item iexpanded-scale-notes-index expanded-scale-notes [ set bfound true if bfound = true [ ifelse iscale-note-index = 0 [set evidence-tonic evidence-tonic + 10] [ifelse iscale-note-index = 1 [set evidence-second evidence-second + 3] [ifelse iscale-note-index = 2 [set evidence-third evidence-third + 7] [ifelse iscale-note-index = 3 [set evidence-fourth evidence-fourth + 5] [ifelse iscale-note-index = 4 [set evidence-fifth evidence-fifth + 5] [ifelse iscale-note-index = 5 [set evidence-sixth evidence-sixth + 3] [ifelse iscale-note-index = 6 [set evidence-seventh evidence-seventh + 7][]]]]]]]] ] [ set iexpanded-scale-notes-index iexpanded-scale-notes-index + 1 ] ] set iscale-note-index iscale-note-index + 1 ] ] ;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . set iphrase-note-index iphrase-note-index + 1 ] let total-evidence-this-scale evidence-tonic + evidence-second + evidence-third + evidence-fourth + evidence-fifth + evidence-sixth + evidence-seventh report total-evidence-this-scale end ;--------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report start-doing-stuff let initial-note 60 let i 0 let current-note "" let current-evidence 0 let previous-note "" let previous-evidence 0 let best-note "" let best-evidence 0 while [i < 12 ][ set current-note initial-note + i set current-evidence do-stuff (initial-note + i) if current-evidence > best-evidence [ set best-evidence current-evidence set best-note current-note ] set previous-note current-note set previous-evidence current-evidence set i i + 1 ] let expanded-best-scale [""] let initial-scale create-scale best-note let iinitial-scale-index 0 let iinitial-scale-length length initial-scale while [iinitial-scale-index < iinitial-scale-length] [ let expanded-note-list expand-by-octaves item iinitial-scale-index initial-scale let iexpanded-note-list-index 0 let iexpanded-note-list-length length expanded-note-list while [iexpanded-note-list-index < iexpanded-note-list-length][ set expanded-best-scale lput item iexpanded-note-list-index expanded-note-list expanded-best-scale set iexpanded-note-list-index iexpanded-note-list-index + 1 ] set iinitial-scale-index iinitial-scale-index + 1 ] set expanded-best-scale remove-item 0 expanded-best-scale set expanded-best-scale sort-by [ [a b] -> a < b ] expanded-best-scale report expanded-best-scale end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report evaluate-transformation [this-phrase this-player this-type] let inverted-phrase this-phrase ifelse this-type = "inversion" [ set inverted-phrase invert this-phrase ] [ if this-type = "transposition" [ set inverted-phrase transpose this-phrase ] ] let original-phrase this-phrase if inflection = true [ let best-fit-scale start-doing-stuff let inverted-phase-notes [""] let i 0 while [i < length inverted-phrase][ ;if the current item in the inverted phrase list is a number then, evaluate futher..... if is-number? item i inverted-phrase [ let j 0 let bfound false ;look in the expanded best-fit scale while [(j < length best-fit-scale) and bfound = false][ ifelse item (i) inverted-phrase = item j best-fit-scale [ set bfound true ] [ set j j + 1 ] ] ifelse bfound = true [ ] [ let best-fit-scale-plus best-fit-scale set best-fit-scale-plus lput item i inverted-phrase best-fit-scale-plus set best-fit-scale-plus sort-by [ [a b] -> a < b ] best-fit-scale-plus let k 0 let bfound-k false let inflection-target-index 0 while [(k < length best-fit-scale-plus) and bfound-k = false][ ifelse item k best-fit-scale-plus = item i inverted-phrase [ set bfound-k true ] [ set k k + 1 ] ] let preceeding-note item (k - 1) best-fit-scale-plus let following-note item (k + 1) best-fit-scale-plus let inflected-note-index 0 let new-note "" let interval-down (k - (k - 1)) let interval-up ((k + 1) - k) ifelse interval-down < interval-up [ set inflected-note-index (k - 1) set new-note item inflected-note-index best-fit-scale-plus ] [ ifelse interval-up < interval-down [ set inflected-note-index (k + 1) set inverted-phrase replace-item i inverted-phrase item inflected-note-index best-fit-scale-plus ] [ let fifty-fifty-chance random 2 ifelse fifty-fifty-chance = 0 [ set inflected-note-index (k - 1) set inverted-phrase replace-item i inverted-phrase item inflected-note-index best-fit-scale-plus ] [ set inflected-note-index (k + 1) set inverted-phrase replace-item i inverted-phrase item inflected-note-index best-fit-scale-plus ] ] ] ] ] set i i + 2 ] let x 0 let new-pitch-list [""] while [x < length inverted-phrase][ if is-number? item x inverted-phrase [ set new-pitch-list lput item x inverted-phrase new-pitch-list ] set x x + 1 ] set new-pitch-list remove-item 0 new-pitch-list set new-pitch-list sort-by [ [a b] -> a < b ] new-pitch-list set new-pitch-list remove-duplicates new-pitch-list ifelse this-player = 1 [set player1-transformed-pitchlist new-pitch-list] [ifelse this-player = 2 [set player2-transformed-pitchlist new-pitch-list] [ifelse this-player = 3 [set player3-transformed-pitchlist new-pitch-list] [ifelse this-player = 4 [set player4-transformed-pitchlist new-pitch-list] [ifelse this-player = 5 [set player5-transformed-pitchlist new-pitch-list] [ifelse this-player = 6 [set player6-transformed-pitchlist new-pitch-list] [ifelse this-player = 7 [set player7-transformed-pitchlist new-pitch-list] [ifelse this-player = 8 [set player8-transformed-pitchlist new-pitch-list] [ifelse this-player = 9 [set player9-transformed-pitchlist new-pitch-list] [ifelse this-player = 10 [set player10-transformed-pitchlist new-pitch-list] [ifelse this-player = 11 [set player11-transformed-pitchlist new-pitch-list][]]]]]]]]]]] ] report inverted-phrase end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-hindmost let phrases [""] set phrases lput phrase.1 phrases set phrases lput phrase.2 phrases set phrases lput phrase.3 phrases set phrases lput phrase.4 phrases set phrases lput phrase.5 phrases set phrases lput phrase.6 phrases set phrases lput phrase.7 phrases set phrases lput phrase.8 phrases set phrases lput phrase.9 phrases set phrases lput phrase.10 phrases set phrases lput phrase.11 phrases set phrases remove-item 0 phrases set phrases remove-duplicates phrases set phrases sort-by [ [a b] -> a < b ] phrases let first-phrase item 0 phrases report first-phrase end ;-------------------------------------------------------------------------------------------------------------------------------------------------------------------- to-report get-foremost let phrases [""] set phrases lput phrase.1 phrases set phrases lput phrase.2 phrases set phrases lput phrase.3 phrases set phrases lput phrase.4 phrases set phrases lput phrase.5 phrases set phrases lput phrase.6 phrases set phrases lput phrase.7 phrases set phrases lput phrase.8 phrases set phrases lput phrase.9 phrases set phrases lput phrase.10 phrases set phrases lput phrase.11 phrases set phrases remove-item 0 phrases set phrases remove-duplicates phrases set phrases sort-by [ [a b] -> a < b ] phrases let last-phrase item ((length phrases) - 1) phrases report last-phrase end ;---------------------------------------- ;**************************************** ;COMPOSITION TEMPLATE ;add more phrases as needed... ;**************************************** ;to setup-composition-[name goes here...] ; set phrase-list [ ; 0 [ ; "rest" "whole" ; ] ; 1 [ ; notes go here... ; ] ; 2 [ ; notes go here... ; ] ; 3 [ ; notes go here... ; ] ; 4 [ ; notes go here... ; ] ; 5 [ ; "rest" "whole" ; ] ; ] ;end ;----------------------------------------