//Sound to Visual (Music Visualization)//////////////// a = Canvas() d = FM('bass').note.seq( [0,7], 1/4 ) //when mapping 2D you need to use the draw loop and grab instantaneous values a.draw = function() { a.clear() //mappping to visual parameter var size = d.frequency a.circle( 400,400, size).fill('red') } //Visual to Sound (Visual Sonification)//////////////////// a = Canvas() d = FM('bass') //no sequence needed because visuals will be the composition //some global variables that we can access both in the draw loop and in a custom function var bassNote = 0 var size = 0 //when mapping 2D you need to use the draw loop and grab instantaneous values a.draw = function() { a.clear() size += 1 //our visual "composition" //mapping to sound parameter bassNote = size + 200 a.circle( 400,400, size).fill('red') if(size > 1000) size = 0 //another rule of our visual "compostion" } playNote = function(){ d.note(bassNote) } Seq(playNote, 1/4)