diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-05 10:51:33 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-05 10:51:33 +0900 |
commit | 5c1eb3117b8f99f095f29f0df1f36891debcf954 (patch) | |
tree | 55ccbac604226bf520b4def30467839ff64b0358 | |
parent | 2b0b248c962aeb3a9779821218973e452eff5a1d (diff) | |
download | Orca-5c1eb3117b8f99f095f29f0df1f36891debcf954.tar.gz Orca-5c1eb3117b8f99f095f29f0df1f36891debcf954.zip |
Added midi channel to midi CC
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | desktop/core/library/_cc.js | 12 | ||||
-rw-r--r-- | desktop/sources/scripts/io.cc.js | 6 | ||||
-rw-r--r-- | examples/projects/pilot.orca | 18 |
4 files changed, 20 insertions, 18 deletions
@@ -64,7 +64,7 @@ For example, `:25C`, is a **C note, on the 5th octave, through the 3rd MIDI chan ## MIDI CC -The [MIDI CC](https://www.sweetwater.com/insync/continuous-controller/) operator `^` takes 2 inputs('channel, 'value). +The [MIDI CC](https://www.sweetwater.com/insync/continuous-controller/) operator `^` takes 3 inputs('channel, 'knob, 'value). It sends a value **between 0-127**, where the value is calculated as a ratio of 36, over a maximum of 127. For example, `^08`, is equal to **28**, or `(8/36)*127`. You can press `shift+enter`, with the `^` operator selected, to assign it to a controller. diff --git a/desktop/core/library/_cc.js b/desktop/core/library/_cc.js index 976ee7f..e6f8f1c 100644 --- a/desktop/core/library/_cc.js +++ b/desktop/core/library/_cc.js @@ -8,17 +8,19 @@ function OperatorCC (orca, x, y) { this.name = 'Midi CC' this.info = 'Sends a MIDI control change message.' - this.ports.haste.channel = { x: 1, y: 0 } - this.ports.haste.value = { x: 2, y: 0 } + this.ports.input.channel = { x: 1, y: 0 } + this.ports.input.knob = { x: 2, y: 0 } + this.ports.input.value = { x: 3, y: 0 } this.run = function (force = false) { if (!this.bang() && force === false) { return } - const channel = this.listen(this.ports.haste.channel, true) - const rawValue = this.listen(this.ports.haste.value, true) + const channel = this.listen(this.ports.input.channel, true) + const knob = this.listen(this.ports.input.channel, true) + const rawValue = this.listen(this.ports.input.value, true) const val = Math.ceil((127 * rawValue) / 35) - terminal.io.cc.send(channel, val) + terminal.io.cc.send(channel, knob, val) if (force === true) { terminal.io.cc.run() diff --git a/desktop/sources/scripts/io.cc.js b/desktop/sources/scripts/io.cc.js index 6e13b8a..5355d65 100644 --- a/desktop/sources/scripts/io.cc.js +++ b/desktop/sources/scripts/io.cc.js @@ -17,14 +17,14 @@ function MidiCC (terminal) { } } - this.send = function (channel, value) { - this.stack.push([channel, value]) + this.send = function (channel, knob, value) { + this.stack.push([channel, knob, value]) } this.play = function (data) { const device = terminal.io.midi.device() if (device) { - device.send([0xb0, 64 + data[0], data[1]]) + device.send([0xb0 + data[0], 64 + data[1], data[2]]) } else { console.warn(`No Midi device.`) } diff --git a/examples/projects/pilot.orca b/examples/projects/pilot.orca index 973909f..a57baf1 100644 --- a/examples/projects/pilot.orca +++ b/examples/projects/pilot.orca @@ -1,17 +1,17 @@ ......................................... .#.PILOT.#............................... ......................................... -.2D6...2C4......gC4...................... -...i36..34TCAFE..04T0123................. -.oV4....nVE......iV0..................... -......................................... -.#.PLAY.#................................ -......................................... -.D23Kion................................. -.*Y*;04E................................. -......................................... +.gC4......6C4......8C4.......C8.......... +..14T3456..04T3454..24TABCD..18T*.*..*... +..aV4......bV3......cVC......dV.......... ......................................... +.#.PLAY.#..........#.CTRL.#.............. ......................................... +.Vd3Kabc..D63K.bc..D8..C8....R.9......... +..Y.;43C...Y.;03C...Y.;1ENV:08f8......... ......................................... +.#.EFFECT.#.............................. ......................................... +.Dy.....R.f..Dy.....R.f..Dy.....R.f...... +..;DIS:fb.....;REV:f2.....;CHO:fc........ .........................................
\ No newline at end of file |