-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orca Custom Operator? #1
Comments
Hi, yes that was me. Sadly, I don't have much memory or documentation of
that. I was planning to develop a port of Orca to iOS, but those plans
quickly got derailed, moved on to other things.
My memory is that it was a simple add-on to make, and that I did it only on
the javascript version. I've attached what I think was the only file I
altered, and I think the only thing I did was adding the function
'OperatorMidiWithTranspose', which you can search for in the file. I don't
think it required anything else, but maybe there's some other spot where it
lists functions or something, not sure, but I don't think so, I think it
just automatically includes whatever library operator functions you define.
. . .
(attached file should be named 'library.js', had to rename because it was
blocked for security reasons)
On Mon, Jun 19, 2023 at 7:04 AM 22bharris ***@***.***> wrote:
Hi! Are you the same person who posted the Orca custom operator example on
YouTube, showing transposition of a midi note? If so, can you please share
the custom operator? It looks very useful.
Thanks!
—
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADT2EVM47O6NL6LMST7YL3XMBL67ANCNFSM6AAAAAAZL73P4I>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
'use strict'
/* global Operator */
/* global client */
const library = {}
const notearray = 'CcDdEFfGgAaBJjKkLMmNnOoPQqRrSTtUuVvW'.split('')
const notetoval = {
'C':0, 'c':1, 'D':2, 'd':3,'E':4,'e':5 ,'F':5 ,'f':6,'G':7,'g':8,
'H':9,'h':10,'I':11 ,'i':12 ,'J':12,'j':13,'K':14,'k':15,'L':16,'l':17,'M':17,
'm':18,'N':19,'n':20,'O':21,'o':22,'P':23,'p':24 , 'Q':24 , 'q':25 , 'R': 26,
'r':27,'S':28 ,'s':29 , 'T':29 , 't':30 , 'U':31 ,'u':32,'V':33 ,'v':34, 'W':35
}
library.a = function OperatorA (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'a', passive)
this.name = 'add'
this.info = 'Outputs sum of inputs'
this.ports.a = { x: -1, y: 0 }
this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const a = this.listen(this.ports.a, true)
const b = this.listen(this.ports.b, true)
return orca.keyOf(a + b)
}
}
library.b = function OperatorL (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'b', passive)
this.name = 'subtract'
this.info = 'Outputs difference of inputs'
this.ports.a = { x: -1, y: 0 }
this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const a = this.listen(this.ports.a, true)
const b = this.listen(this.ports.b, true)
return orca.keyOf(Math.abs(b - a))
}
}
library.c = function OperatorC (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'c', passive)
this.name = 'clock'
this.info = 'Outputs modulo of frame'
this.ports.rate = { x: -1, y: 0, clamp: { min: 1 } }
this.ports.mod = { x: 1, y: 0, default: '8' }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const rate = this.listen(this.ports.rate, true)
const mod = this.listen(this.ports.mod, true)
const val = Math.floor(orca.f / rate) % mod
return orca.keyOf(val)
}
}
library.d = function OperatorD (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'd', passive)
this.name = 'delay'
this.info = 'Bangs on modulo of frame'
this.ports.rate = { x: -1, y: 0, clamp: { min: 1 } }
this.ports.mod = { x: 1, y: 0, default: '8' }
this.ports.output = { x: 0, y: 1, bang: true, output: true }
this.operation = function (force = false) {
const rate = this.listen(this.ports.rate, true)
const mod = this.listen(this.ports.mod, true)
const res = orca.f % (mod * rate)
return res === 0 || mod === 1
}
}
library.e = function OperatorE (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'e', passive)
this.name = 'east'
this.info = 'Moves eastward, or bangs'
this.draw = false
this.operation = function () {
this.move(1, 0)
this.passive = false
}
}
library.f = function OperatorF (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'f', passive)
this.name = 'if'
this.info = 'Bangs if inputs are equal'
this.ports.a = { x: -1, y: 0 }
this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, bang: true, output: true }
this.operation = function (force = false) {
const a = this.listen(this.ports.a)
const b = this.listen(this.ports.b)
return a === b
}
}
library.g = function OperatorG (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'g', passive)
this.name = 'generator'
this.info = 'Writes operands with offset'
this.ports.x = { x: -3, y: 0 }
this.ports.y = { x: -2, y: 0 }
this.ports.len = { x: -1, y: 0, clamp: { min: 1 } }
this.operation = function (force = false) {
const len = this.listen(this.ports.len, true)
const x = this.listen(this.ports.x, true)
const y = this.listen(this.ports.y, true) + 1
for (let offset = 0; offset < len; offset++) {
const inPort = { x: offset + 1, y: 0 }
const outPort = { x: x + offset, y: y, output: true }
this.addPort(`in${offset}`, inPort)
this.addPort(`out${offset}`, outPort)
const res = this.listen(inPort)
this.output(`${res}`, outPort)
}
}
}
library.h = function OperatorH (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'h', passive)
this.name = 'halt'
this.info = 'Halts southward operand'
this.ports.output = { x: 0, y: 1, reader: true, output: true }
this.operation = function (force = false) {
orca.lock(this.x + this.ports.output.x, this.y + this.ports.output.y)
return this.listen(this.ports.output, true)
}
}
library.i = function OperatorI (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'i', passive)
this.name = 'increment'
this.info = 'Increments southward operand'
this.ports.step = { x: -1, y: 0, default: '1' }
this.ports.mod = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, reader: true, output: true }
this.operation = function (force = false) {
const step = this.listen(this.ports.step, true)
const mod = this.listen(this.ports.mod, true)
const val = this.listen(this.ports.output, true)
return orca.keyOf((val + step) % (mod > 0 ? mod : 36))
}
}
library.j = function OperatorJ (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'j', passive)
this.name = 'jumper'
this.info = 'Outputs northward operand'
this.operation = function (force = false) {
const val = this.listen({ x: 0, y: -1 })
if (val != this.glyph) {
let i = 0
while (orca.inBounds(this.x, this.y + i)) {
if (this.listen({ x: 0, y: ++i }) != this.glyph) { break }
}
this.addPort('input', { x: 0, y: -1 })
this.addPort('output', { x: 0, y: i, output: true })
return val
}
}
}
library.k = function OperatorK (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'k', passive)
this.name = 'konkat'
this.info = 'Reads multiple variables'
this.ports.len = { x: -1, y: 0, clamp: { min: 1 } }
this.operation = function (force = false) {
this.len = this.listen(this.ports.len, true)
for (let offset = 0; offset < this.len; offset++) {
const key = orca.glyphAt(this.x + offset + 1, this.y)
orca.lock(this.x + offset + 1, this.y)
if (key === '.') { continue }
const inPort = { x: offset + 1, y: 0 }
const outPort = { x: offset + 1, y: 1, output: true }
this.addPort(`in${offset}`, inPort)
this.addPort(`out${offset}`, outPort)
const res = orca.valueIn(key)
this.output(`${res}`, outPort)
}
}
}
library.l = function OperatorL (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'l', passive)
this.name = 'lesser'
this.info = 'Outputs smallest input'
this.ports.a = { x: -1, y: 0 }
this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const a = this.listen(this.ports.a)
const b = this.listen(this.ports.b)
return a !== '.' && b !== '.' ? orca.keyOf(Math.min(orca.valueOf(a), orca.valueOf(b))) : '.'
}
}
library.m = function OperatorM (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'm', passive)
this.name = 'multiply'
this.info = 'Outputs product of inputs'
this.ports.a = { x: -1, y: 0 }
this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const a = this.listen(this.ports.a, true)
const b = this.listen(this.ports.b, true)
return orca.keyOf(a * b)
}
}
library.n = function OperatorN (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'n', passive)
this.name = 'north'
this.info = 'Moves Northward, or bangs'
this.draw = false
this.operation = function () {
this.move(0, -1)
this.passive = false
}
}
library.o = function OperatorO (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'o', passive)
this.name = 'read'
this.info = 'Reads operand with offset'
this.ports.x = { x: -2, y: 0 }
this.ports.y = { x: -1, y: 0 }
this.ports.output = { x: 0, y: 1, output: true }
this.operation = function (force = false) {
const x = this.listen(this.ports.x, true)
const y = this.listen(this.ports.y, true)
this.addPort('read', { x: x + 1, y: y })
return this.listen(this.ports.read)
}
}
library.p = function OperatorP (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'p', passive)
this.name = 'push'
this.info = 'Writes eastward operand'
this.ports.key = { x: -2, y: 0 }
this.ports.len = { x: -1, y: 0, clamp: { min: 1 } }
this.ports.val = { x: 1, y: 0 }
this.operation = function (force = false) {
const len = this.listen(this.ports.len, true)
const key = this.listen(this.ports.key, true)
for (let offset = 0; offset < len; offset++) {
orca.lock(this.x + offset, this.y + 1)
}
this.ports.output = { x: (key % len), y: 1, output: true }
return this.listen(this.ports.val)
}
}
library.q = function OperatorQ (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'q', passive)
this.name = 'query'
this.info = 'Reads operands with offset'
this.ports.x = { x: -3, y: 0 }
this.ports.y = { x: -2, y: 0 }
this.ports.len = { x: -1, y: 0, clamp: { min: 1 } }
this.operation = function (force = false) {
const len = this.listen(this.ports.len, true)
const x = this.listen(this.ports.x, true)
const y = this.listen(this.ports.y, true)
for (let offset = 0; offset < len; offset++) {
const inPort = { x: x + offset + 1, y: y }
const outPort = { x: offset - len + 1, y: 1, output: true }
this.addPort(`in${offset}`, inPort)
this.addPort(`out${offset}`, outPort)
const res = this.listen(inPort)
this.output(`${res}`, outPort)
}
}
}
library.r = function OperatorR (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'r', passive)
this.name = 'random'
this.info = 'Outputs random value'
this.ports.min = { x: -1, y: 0 }
this.ports.max = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const min = this.listen(this.ports.min, true)
const max = this.listen(this.ports.max, true)
const val = parseInt((Math.random() * ((max > 0 ? max : 36) - min)) + min)
return orca.keyOf(val)
}
}
library.s = function OperatorS (orca, x, y, passive) {
Operator.call(this, orca, x, y, 's', passive)
this.name = 'south'
this.info = 'Moves southward, or bangs'
this.draw = false
this.operation = function () {
this.move(0, 1)
this.passive = false
}
}
library.t = function OperatorT (orca, x, y, passive) {
Operator.call(this, orca, x, y, 't', passive)
this.name = 'track'
this.info = 'Reads eastward operand'
this.ports.key = { x: -2, y: 0 }
this.ports.len = { x: -1, y: 0, clamp: { min: 1 } }
this.ports.output = { x: 0, y: 1, output: true }
this.operation = function (force = false) {
const len = this.listen(this.ports.len, true)
const key = this.listen(this.ports.key, true)
for (let offset = 0; offset < len; offset++) {
orca.lock(this.x + offset + 1, this.y)
}
this.ports.val = { x: (key % len) + 1, y: 0 }
return this.listen(this.ports.val)
}
}
library.u = function OperatorU (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'u', passive)
this.name = 'uclid'
this.info = 'Bangs on Euclidean rhythm'
this.ports.step = { x: -1, y: 0, clamp: { min: 0 }, default: '1' }
this.ports.max = { x: 1, y: 0, clamp: { min: 1 }, default: '8' }
this.ports.output = { x: 0, y: 1, bang: true, output: true }
this.operation = function (force = false) {
const step = this.listen(this.ports.step, true)
const max = this.listen(this.ports.max, true)
const bucket = (step * (orca.f + max - 1)) % max + step
return bucket >= max
}
}
library.v = function OperatorV (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'v', passive)
this.name = 'variable'
this.info = 'Reads and writes variable'
this.ports.write = { x: -1, y: 0 }
this.ports.read = { x: 1, y: 0 }
this.operation = function (force = false) {
const write = this.listen(this.ports.write)
const read = this.listen(this.ports.read)
if (write === '.' && read !== '.') {
this.addPort('output', { x: 0, y: 1, output: true })
}
if (write !== '.') {
orca.variables[write] = read
return
}
return orca.valueIn(read)
}
}
library.w = function OperatorW (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'w', passive)
this.name = 'west'
this.info = 'Moves westward, or bangs'
this.draw = false
this.operation = function () {
this.move(-1, 0)
this.passive = false
}
}
library.x = function OperatorX (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'x', passive)
this.name = 'write'
this.info = 'Writes operand with offset'
this.ports.x = { x: -2, y: 0 }
this.ports.y = { x: -1, y: 0 }
this.ports.val = { x: 1, y: 0 }
this.operation = function (force = false) {
const x = this.listen(this.ports.x, true)
const y = this.listen(this.ports.y, true) + 1
this.addPort('output', { x: x, y: y, output: true })
return this.listen(this.ports.val)
}
}
library.y = function OperatorY (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'y', passive)
this.name = 'jymper'
this.info = 'Outputs westward operand'
this.operation = function (force = false) {
const val = this.listen({ x: -1, y: 0, output: true })
if (val != this.glyph) {
let i = 0
while (orca.inBounds(this.x + i, this.y)) {
if (this.listen({ x: ++i, y: 0 }) != this.glyph) { break }
}
this.addPort('input', { x: -1, y: 0 })
this.addPort('output', { x: i, y: 0, output: true })
return val
}
}
}
library.z = function OperatorZ (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'z', passive)
this.name = 'lerp'
this.info = 'Transitions operand to target'
this.ports.rate = { x: -1, y: 0, default: '1' }
this.ports.target = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, reader: true, output: true }
this.operation = function (force = false) {
const rate = this.listen(this.ports.rate, true)
const target = this.listen(this.ports.target, true)
const val = this.listen(this.ports.output, true)
const mod = val <= target - rate ? rate : val >= target + rate ? -rate : target - val
return orca.keyOf(val + mod)
}
}
// Specials
library['*'] = function OperatorBang (orca, x, y, passive) {
Operator.call(this, orca, x, y, '*', true)
this.name = 'bang'
this.info = 'Bangs neighboring operands'
this.draw = false
this.run = function (force = false) {
this.draw = false
this.erase()
}
}
library['#'] = function OperatorComment (orca, x, y, passive) {
Operator.call(this, orca, x, y, '#', true)
this.name = 'comment'
this.info = 'Halts line'
this.draw = false
this.operation = function () {
for (let x = this.x + 1; x <= orca.w; x++) {
orca.lock(x, this.y)
if (orca.glyphAt(x, this.y) === this.glyph) { break }
}
orca.lock(this.x, this.y)
}
}
// IO
library.$ = function OperatorSelf (orca, x, y, passive) {
Operator.call(this, orca, x, y, '*', true)
this.name = 'self'
this.info = 'Sends ORCA command'
this.run = function (force = false) {
let msg = ''
for (let x = 1; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
orca.lock(this.x + x, this.y)
if (g === '.') { break }
msg += g
}
if (!this.hasNeighbor('*') && force === false) { return }
if (msg === '') { return }
this.draw = false
client.commander.trigger(`${msg}`, { x, y: y + 1 }, false)
}
}
library['^'] = function OperatorSemi (orca, x, y, passive) {
Operator.call(this, orca, x, y, '^', passive)
this.name = 'semitoneadd'
this.info = 'Adds semitones to note operand'
this.ports.a = { x: -1, y: 0 }
this.ports.b = { x: 1, y: 0 }
this.ports.output = { x: 0, y: 1, sensitive: true, output: true }
this.operation = function (force = false) {
const a = this.listen(this.ports.a, true)
const b = this.listen(this.ports.b, true)
return orca.keyOf(a + b)
}
}
library[':'] = function OperatorMidi (orca, x, y, passive) {
Operator.call(this, orca, x, y, ':', true)
this.name = 'midi'
this.info = 'Sends MIDI note'
this.ports.channel = { x: 1, y: 0 }
this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
this.ports.note = { x: 3, y: 0 }
this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 32 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
if (this.listen(this.ports.channel) === '.') { return }
if (this.listen(this.ports.octave) === '.') { return }
if (this.listen(this.ports.note) === '.') { return }
if (!isNaN(this.listen(this.ports.note))) { return }
const channel = this.listen(this.ports.channel, true)
if (channel > 15) { return }
const octave = this.listen(this.ports.octave, true)
const note = this.listen(this.ports.note)
const velocity = this.listen(this.ports.velocity, true)
const length = this.listen(this.ports.length, true)
client.io.midi.push(channel, octave, note, velocity, length)
if (force === true) {
client.io.midi.run()
}
this.draw = false
}
}
library['~'] = function OperatorMidiWithTranspose (orca, x, y, passive) {
Operator.call(this, orca, x, y, '~', true)
this.name = 'midiwithtranspose'
this.info = 'Sends MIDI note with note transpose'
this.ports.channel = { x: 1, y: 0 }
this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
this.ports.note = { x: 3, y: 0 }
this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 32 } }
this.ports.transpose = { x: 6, y: 0, default: '0', clamp: { min: 0, max: 35 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
if (this.listen(this.ports.channel) === '.') { return }
if (this.listen(this.ports.octave) === '.') { return }
if (this.listen(this.ports.note) === '.') { return }
if (!isNaN(this.listen(this.ports.note))) { return }
const channel = this.listen(this.ports.channel, true)
if (channel > 15) { return }
const octave = this.listen(this.ports.octave, true)
/* const basenote = this.listen(this.ports.note, true) */
const basenote = notetoval[this.listen(this.ports.note)]
const trval = this.listen(this.ports.transpose, true)
const note = notearray[basenote + trval]
const velocity = this.listen(this.ports.velocity, true)
const length = this.listen(this.ports.length, true)
client.io.midi.push(channel, octave, note, velocity, length)
if (force === true) {
client.io.midi.run()
}
this.draw = false
}
}
library['!'] = function OperatorCC (orca, x, y) {
Operator.call(this, orca, x, y, '!', true)
this.name = 'cc'
this.info = 'Sends MIDI control change'
this.ports.channel = { x: 1, y: 0 }
this.ports.knob = { x: 2, y: 0, clamp: { min: 0 } }
this.ports.value = { x: 3, y: 0, clamp: { min: 0 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
if (this.listen(this.ports.channel) === '.') { return }
if (this.listen(this.ports.knob) === '.') { return }
const channel = this.listen(this.ports.channel, true)
if (channel > 15) { return }
const knob = this.listen(this.ports.knob, true)
const rawValue = this.listen(this.ports.value, true)
const value = Math.ceil((127 * rawValue) / 35)
client.io.cc.stack.push({ channel, knob, value, type: 'cc' })
this.draw = false
if (force === true) {
client.io.cc.run()
}
}
}
library['?'] = function OperatorPB (orca, x, y) {
Operator.call(this, orca, x, y, '?', true)
this.name = 'pb'
this.info = 'Sends MIDI pitch bend'
this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 15 } }
this.ports.lsb = { x: 2, y: 0, clamp: { min: 0 } }
this.ports.msb = { x: 3, y: 0, clamp: { min: 0 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
if (this.listen(this.ports.channel) === '.') { return }
if (this.listen(this.ports.lsb) === '.') { return }
const channel = this.listen(this.ports.channel, true)
const rawlsb = this.listen(this.ports.lsb, true)
const lsb = Math.ceil((127 * rawlsb) / 35)
const rawmsb = this.listen(this.ports.msb, true)
const msb = Math.ceil((127 * rawmsb) / 35)
client.io.cc.stack.push({ channel, lsb, msb, type: 'pb' })
this.draw = false
if (force === true) {
client.io.cc.run()
}
}
}
library['%'] = function OperatorMono (orca, x, y, passive) {
Operator.call(this, orca, x, y, '%', true)
this.name = 'mono'
this.info = 'Sends MIDI monophonic note'
this.ports.channel = { x: 1, y: 0 }
this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
this.ports.note = { x: 3, y: 0 }
this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 32 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
if (this.listen(this.ports.channel) === '.') { return }
if (this.listen(this.ports.octave) === '.') { return }
if (this.listen(this.ports.note) === '.') { return }
if (!isNaN(this.listen(this.ports.note))) { return }
const channel = this.listen(this.ports.channel, true)
if (channel > 15) { return }
const octave = this.listen(this.ports.octave, true)
const note = this.listen(this.ports.note)
const velocity = this.listen(this.ports.velocity, true)
const length = this.listen(this.ports.length, true)
client.io.mono.push(channel, octave, note, velocity, length)
if (force === true) {
client.io.mono.run()
}
this.draw = false
}
}
library['='] = function OperatorOsc (orca, x, y, passive) {
Operator.call(this, orca, x, y, '=', true)
this.name = 'osc'
this.info = 'Sends OSC message'
this.ports.path = { x: 1, y: 0 }
this.operation = function (force = false) {
let msg = ''
for (let x = 2; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
orca.lock(this.x + x, this.y)
if (g === '.') { break }
msg += g
}
if (!this.hasNeighbor('*') && force === false) { return }
const path = this.listen(this.ports.path)
if (!path || path === '.') { return }
this.draw = false
client.io.osc.push('/' + path, msg)
if (force === true) {
client.io.osc.run()
}
}
}
library[';'] = function OperatorUdp (orca, x, y, passive) {
Operator.call(this, orca, x, y, ';', true)
this.name = 'udp'
this.info = 'Sends UDP message'
this.operation = function (force = false) {
let msg = ''
for (let x = 1; x <= 36; x++) {
const g = orca.glyphAt(this.x + x, this.y)
orca.lock(this.x + x, this.y)
if (g === '.') { break }
msg += g
}
if (!this.hasNeighbor('*') && force === false) { return }
this.draw = false
client.io.udp.push(msg)
if (force === true) {
client.io.udp.run()
}
}
}
// Add numbers
for (let i = 0; i <= 9; i++) {
library[`${i}`] = function OperatorNull (orca, x, y, passive) {
Operator.call(this, orca, x, y, '.', false)
this.name = 'null'
this.info = 'empty'
// Overwrite run, to disable draw.
this.run = function (force = false) {
}
}
}
|
Thank you very much!! I don't actually see the file here (looks like Github still blocked it, perhaps?). I just found you and send you a message on Lines, too - could you possibly attach the file to a response to my message there? Thanks again - I really appreciate it! |
Replied in Lines thread, and here also is the custom operator link:
https://gist.github.com/hsitz/13b24eb9982d626d98f378edca2dbee3
…On Mon, Jun 19, 2023 at 9:38 AM 22bharris ***@***.***> wrote:
Thank you very much!! I don't actually see the file here (looks like
Github still blocked it, perhaps?). I just found you and send you a message
on Lines, too - could you possibly attach the file to a response to my
message there?
Thanks again - I really appreciate it!
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADT2EQB34Z3V6JZ7N5LINLXMB57HANCNFSM6AAAAAAZL73P4I>
.
You are receiving this because you commented.Message ID: <hsitz/hsitz.
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Are you the same person who posted the Orca custom operator example on YouTube, showing transposition of a midi note? If so, can you please share the custom operator? It looks very useful.
Thanks!
The text was updated successfully, but these errors were encountered: