Week 4 : Anthem [Objects, Arrays, New Functions, P5 audio library]

This piece of code involves an array of audio objects -- the National Anthems of the all the countries from which the students in our class hail -- and by clicking your mouse on the background image you essentially change the channel on which anthem is audible.  It was interesting to figure out how to use the Audio library in P5 to do things like jump() and currentTime(), and making use of some boolean statements allowed me to stop one anthem as another became audible.  Preload() of the audio didn't work, and after receiving some guidance from Cassie and Justin the Residents it was determined that this functionality is buggy.  So give the sketch a moment to load all the audio assets before expecting the mouseClick to work.  Also big thanks to Craig the resident and Shawn Van Every for their assistance in helping me build this!

The full concept for this is to combine this with a P-Comp project -- working title Anthem.  I'd like to have Globes filled with weight, or spherical weights painted like globes, swinging from a large scale Newton's Cradle such that when a new pendulum-swing makes contact in the row of balls an FSR sensor is triggered and will 'change the channel' on the anthems as seen in this sketch, effectively making a randomized composite 'World Anthem" if you will each time the piece is set in motion.

 Here's a video of someone who's made a large scale Newton's Cradle.  I imagine this might be set in motion for a little over a minute, and it appears the cycle between contacts would be a little over 1 second in duration.