diff --git a/AMS/img/swing.jpg b/AMS/img/swing.jpg new file mode 100644 index 0000000..24d7f23 Binary files /dev/null and b/AMS/img/swing.jpg differ diff --git a/AMS/swing.js b/AMS/swing.js new file mode 100644 index 0000000..5f2e941 --- /dev/null +++ b/AMS/swing.js @@ -0,0 +1,29 @@ +s0.initImage("file:///home/pln/Work/Hydra/AMS/img/swing.jpg") +src(s0) + // .scale(() => 0.95 + 0.05 * Math.sin(time/5)) + .out(o0) +// + + +src(o0) + // .scale(() => 1 - Math.sin(time) / 100) + .blend(o1,0.5) + .blend(o1,0.45) + .blend(o1,0.35) + .blend(o1,0.25) + .out(o1) +// +src(o1) + .modulate( + osc(0.94,-0.05).rotate(-20) + ) + // .scale(1.15) + .scrollX(-0.02) + .brightness(0.15).contrast(1.35) + .out(o2) + +src(o2) + .scale(1.25) + .out(o3) +// +render(o3) diff --git a/LIVE/Broken.js b/LIVE/Broken.js new file mode 100644 index 0000000..f6f3703 --- /dev/null +++ b/LIVE/Broken.js @@ -0,0 +1,21 @@ +osc(() => 0.2 + 20 * Math.sin(time / 100), 0.1, 0.8) + .color(1.04,0, -1.1) + .rotate(0.30, 0.2) + .pixelate(2, 20) + .modulate(noise(2.5), () => 1.5 * Math.sin(0.08 * time)) + .out(o0) + +s0.initCam(1) + +src(s0) + .pixelate(256) + .scale(() => 0.72 + Math.cos(time / 10)) + .modulateRotate(voronoi(10)) + .out(o1) + +src(o1) + .blend(o0, 0.23) + .out(o2) + + +render(o2) diff --git a/Neige/feuille_dor.js b/Neige/feuille_dor.js index f87648b..61c3067 100644 --- a/Neige/feuille_dor.js +++ b/Neige/feuille_dor.js @@ -1,7 +1,12 @@ s0.initImage("file:///home/pln/Work/Hydra/Neige/img/mer.jpg") s1.initImage("file:///home/pln/Work/Hydra/Neige/img/fonds.jpg") + +a.show() +a.setCutoff(0.1) +a.setBins(4) + src(s0) - .scale(() => 1.5 + 0.5 * Math.sin(time/100)) + .scale(() => 1.5 + 0.5 * Math.sin(a.fft[0] + time/10)) // .scale(() => 1.05 + 0.05 * Math.sin(time/5)) .out(o0) // diff --git a/StarryNights/GaLactic.js b/StarryNights/GaLactic.js index 36c9a86..3fe36b0 100644 --- a/StarryNights/GaLactic.js +++ b/StarryNights/GaLactic.js @@ -1,13 +1,17 @@ // From a picture of Galaxy Nasa 724203 // Private share: https://nech.pl/nights-galactic -s0.initImage("https://git.plnech.fr/pln/Hydra/raw/7ab247cae7f562ecc0f1c13a6646e5a71f6c0f1f/StarryNights/img/724203.jpg") +s0.initImage("file:///home/pln/Work/Hydra/StarryNights/img/724203.jpg") src(s0).out() + + src(o0) .blend(o0) .blend(src(o1).scale(0.5,0.9).rotate(() => Math.sin(time/900) * 360), 0.25) .out(o2) + + src(o2) .modulate(o0,() => Math.sin(time/20) % 2) .out(o1) diff --git a/StarryNights/img/arp299.jpg b/StarryNights/img/arp299.jpg new file mode 100644 index 0000000..21d6c6c Binary files /dev/null and b/StarryNights/img/arp299.jpg differ diff --git a/TidalSide/OSC.js b/TidalSide/OSC.js new file mode 100644 index 0000000..6b7434a --- /dev/null +++ b/TidalSide/OSC.js @@ -0,0 +1,104 @@ +// Forwarding tidal messages from supercollider to hydra. +// based on code by atsushi tadokoro: https://vimeo.com/265074689 +// To run examples, open file tidal-forward.sc in SuperCollider. This file forwards all messages +// received from tidal in SuperCollider to an additional port (3333) +// +// Note: +// to show developer console in atom, use the following commands: +// windows - Ctrl+Alt+I +// osx - Cmd+Opt+I +// linux - Ctrl + Shift + I + +// set port to listen to osc messages. default port is 57101 +msg.setPort(3333) +// + + +// function to convert tidal messages from an array to an object +// run this code once +parseTidal = (args) => { + obj = {} + for(var i = 0; i < args.length; i+=2){ + obj[args[i]] = args[i+1] + } + return obj +} + + +// receive messages from supercollider in hydra. '/play2' corresponds to the +// address of the OSC message, defined in the file tidal-forward.sc +// open the console to see the messages, using Ctrl+Alt+I (windows), Cmd+Opt+I (mac), or Ctrl + Shift + I(linux) +// +msg.on('/play2', (args) => { +// log osc results to console + //log(args) + tidal = parseTidal(args) + console.log(tidal) +}) + + + +// EXAMPLE USING TIDAL "sd" and "bd" to control hydra + +// define a variable to contain a blend value +blend = 0 +// + +// receive args from supercollider in hydra. Tidal sends OSC messages +// ahead of the time the sound is plays, so it is necessary to use setTimeout +// in order to wait to change the visuals +msg.on('/play2', (args) => { + // parse the values from tidal + var tidal = parseTidal(args) +// + setTimeout(() => { + // + // If the tidal sample is "sd", set blend to 0, if it is bd, set blend to 1 + // + if(tidal.s === "sd"){ + blend = 0 + } else if (tidal.s === "bd"){ + blend = 1 + } + // + }, tidal.delta * 1000) +}) + +// use the variable "blend" in a hydra function +osc(20, 0.1, 0.8) + .rotate(0.2) + .mult(osc(100), () => blend) + .out() + + +// +// +// EXAMPLE 2. increment values when a certain sample is received +// + +// define variables for frequency and number of sides in kaleidoscope +freq = 10 +numSides = 0 +// +msg.on('/play2', (args) => { + // parse the values from tidal + var tidal = parseTidal(args) +// + setTimeout(() => { + // + // increment values of freq and kaliedoscope based on tidal messages received + // + if(tidal.s === "sd"){ + // add 10 to frequency when "bd" message received + freq = freq + 10 + } else if (tidal.s === "bd"){ + // add 1 to num + numSides = numSides + 1 + } + }, (tidal.delta - tidal.latency) * 1000) +}) + +// use the variables freq and numSides in hydra +osc(() => freq, 0.0, 0.8) + .kaleid(() => numSides) + .out() diff --git a/Zelda.js b/Zelda.js new file mode 100644 index 0000000..4ab7867 --- /dev/null +++ b/Zelda.js @@ -0,0 +1,3 @@ +s0.initCam() +src(s0).out() +render() diff --git a/audio/wave.js b/audio/wave.js new file mode 100644 index 0000000..67de9a1 --- /dev/null +++ b/audio/wave.js @@ -0,0 +1,34 @@ +a.show() +a.setBins(4) +a.setScale(2) +a.setCutoff(4) +a.setSmooth(0.84) + +osc(30,() => 0.085, Math.PI/(1 + Math.sin(time))) + .luma() + .hue(() => Math.cos(time/10)) + .out(o0) + +src(o0) + .scale(() => 0.5 + (a.fft[0] % 10) / 10) + .rotate(() => Math.sin(time/12)) + .out(o1) + +src(o1) + .modulateScale( + noise(() => 100 * a.fft[3] + 80 + ,() => 10 * a.fft[2] + 5 * a.fft[3])) + .out(o2) + +src(o2) + .add( + shape(5) + .scale(() => 1.9 + Math.cos(time/3 + time/19 + time / 100)) + .colorama(0.1) + .rotate(() => Math.sin(time/4 + (0.01 + 0.1 * a.fft[1]) * Math.random() / 2) % 360) + .modulateHue(src(o2)) + .modulate(src(o2)) +) +.out(o3) + +render(o3) diff --git a/demo.js b/demo.js new file mode 100644 index 0000000..ec2aa6a --- /dev/null +++ b/demo.js @@ -0,0 +1,2 @@ +noise().out(o0) +render(o0)