
--[[ ---------------------------------------------------------- Mosaic | OF Visual Patching Developer Platform Copyright (c) 2018 Emanuele Mazza aka n3m3da See https://github.com/d3cod3/Mosaic for documentation ---------------------------------------------------------- Tablas, analisis audio, noise, ]] mouseX = 0 mouseY = 0 -- NOISE noise = {} getBand = 10 ---------------------------------------------------- function setup() of.enableSmoothing() for k = 0, getBand-1 do noise[k] ={} noise[k].audio= 0.0 noise[k].data = 0.0 noise[k].noiseTime = of.random(10000) noise[k].step = of.random(0.01,0.003) end end ---------------------------------------------------- function update() for k,v in pairs(_mosaic_data_table) do if k < getBand then if k > 0 then noise[k].audio = _mosaic_data_table[k] noise[k].step = noise[k].step + noise[k].audio noise[k].data = of.map(of.noise(noise[k].noiseTime),0.1,1.00,-OUTPUT_HEIGHT/1.7,OUTPUT_HEIGHT/1.5,false)*((noise[k].audio)*2 ) noise[k].noiseTime = noise[k].noiseTime + noise[k].step end end end end ---------------------------------------------------- function draw() of.setColor(0, 0, 0, 5) of.drawRectangle(0,0,OUTPUT_WIDTH,OUTPUT_HEIGHT) of.setColor(255, 255, 255, 30) of.noFill() of.pushMatrix() of.translate(25, 0, 0) for k = 0, getBand-1 do if k>0 then of.beginShape() of.curveVertex(50, OUTPUT_HEIGHT/4) x = (OUTPUT_WIDTH/getBand) y = OUTPUT_HEIGHT/2 of.curveVertex(x*(k-1) + noise[k-1].data/3, y + noise[k-1].data) of.curveVertex(x*(k) + noise[k].data/3, y + noise[k].data) of.curveVertex(OUTPUT_WIDTH,OUTPUT_HEIGHT) of.endShape(false) end end of.popMatrix() end ---------------------------------------------------- function exit() end -- input callbacks ----------------------------------------------------