1

I'm implementing a model in which I need a global list to store some music notes during the execution. At the end of the execution, I would like to iterate over the list in order to listen all the musical phrase. I guess I need to use a global list but I don't know how to do it. Any suggestion? Thanks!

sergi martinez
  • 165
  • 1
  • 8

1 Answers1

2

Any global variable can be a number or a string or a list or an agentset or.... I'm not really sure what a 'music note' looks like in your implementation or how you are recording duration. But here's something to get you started that focuses on your specific question about global lists.

globals
[ melody
]

to setup
  clear-all
  set melody []
  reset-ticks
end

to go
  set melody lput one-of (list "A" "B" "C" "D" "E" "F" "G") melody
  print melody
  tick
end

Are you using the sound extension (see https://ccl.northwestern.edu/netlogo/docs/sound.html) to actually do notes?

JenB
  • 17,620
  • 2
  • 17
  • 45