Skip to content

Instantly share code, notes, and snippets.

@echophon
Last active September 28, 2022 21:05
Show Gist options
  • Save echophon/1c7325f907b0e4eb1850e956c25dafd4 to your computer and use it in GitHub Desktop.
Save echophon/1c7325f907b0e4eb1850e956c25dafd4 to your computer and use it in GitHub Desktop.
orca_x_hydra.js
// Example of OSC control of Hydra video synth w/Orca programming language
// by Yancy Way (echophon)
//
// https://github.com/hundredrabbits/Orca
// https://github.com/ojack/hydra
// https://github.com/ojack/hydra-examples
// https://atom.io/packages/atom-hydra
//
// Prerequisites: Orca, Atom, Atom-hydra extension
//
// Open Atom, save and name as a .js file, and toggle atom-hydra from the packages menu
//
// Press CTRL+Alt+Enter to run this entire block of code in Hydra
//
// Orca section is at the bottom
//
// First, setup some handlers for Orca->Hydra communication
//
// set port to listen to osc messages.
// 49162 is the default OSC port that Orca sends from
msg.setPort(49162)
//init a single letter object for Hydra to use & to match the msg we send from Orca
z = [0,0,0,0]
//update on msg received
msg.on('/z', (args) => { z = args })
// end setup
//
// reference this object in hydra with indices
shape(4,0,()=>z[0]*0.1)
.diff(shape(2,0,()=>z[1]*0.1))
.scale(()=>(z[0]*z[2])*0.1)
.blend(osc(5,0.02))
.modulateScale(src(o0).scale(0.5),()=>z[3])
.diff(shape(2,0,()=>z[2]*0.1).rotate(Math.PI/2))
.modulateScale(shape(3,0.3,0).rotate(0,0.01).diff(shape(60,0.3,0)),()=>z[3])
.out()
/* Run this section in ORCA
.................
#.....HYDRA.....#
.................
#.SETUP.#........
....#..SOME.#....
........#..VARS.#
.................
.2C..3C...4C..5C.
bV6.dV7..cV3.eV6.
.................
.................
.D8..#.SEND.AN..#
..H..#.OSC.PACK.#
.gE.....5K.bcde..
.........=z6376..
.................
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment