Skip to content

Commit

Permalink
add documentation and sborca collection
Browse files Browse the repository at this point in the history
  • Loading branch information
unthingable committed Oct 26, 2020
1 parent 3cc6a1f commit 6672d47
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ npm start

## Operators

See `Language` section for alternative language definitions.

To display the list of operators inside of Orca, use `CmdOrCtrl+G`.

- `A` **add**(*a* b): Outputs sum of inputs.
Expand Down Expand Up @@ -149,7 +151,15 @@ All commands have a shorthand equivalent to their first two characters, for exam
- `midi:1;2` Set Midi output device to `#1`, and input device to `#2`.
- `udp:1234;5678` Set UDP output port to `1234`, and input port to `5678`.
- `osc:1234` Set OSC output port to `1234`.
- `lang:clr;default` Incrementally load language interpreters (`clr` clears the language library entirely). Multiple languages can be combined.
- `lang:clr;default;etc` Incrementally load language libraries (`clr` clears the language library entirely). Multiple languages can be combined.

### Language

Orca language is a "library" of operators (everything that is not a command) that together define its behavior. Orca has the ability to dynamically load and combine multiple operator libraries at runtime, effectively allowing you to reconfigure the language. For example, you may want this for playing older compositions that are no longer compatible with the current Orca, or to experiment with alternative operators without affecting mainline Orca. Language reconfiguration lets you tailor the language to your individual composition.

Orca starts with a `default` library, additional libraries can be loaded and combined via the `lang` command. Library loading is incremental, that is, operators defined in the new library are added to runtime, replacing existing operators. A given library may define all operators or only some. To completely clear the runtime library and start with the blank slate use the `clr` library.

You can see available libraries and their documentation [here](https://github.com/hundredrabbits/Orca/blob/master/desktop/sources/scripts/library).

## Base36 Table

Expand Down
1 change: 1 addition & 0 deletions desktop/sources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<script type="text/javascript" src="scripts/core/library/library.js"></script>
<script type="text/javascript" src="scripts/core/library/base.js"></script>
<script type="text/javascript" src="scripts/core/library/default.js"></script>
<script type="text/javascript" src="scripts/core/library/sborca.js"></script>
<script type="text/javascript" src="scripts/core/io.js"></script>
<script type="text/javascript" src="scripts/core/operator.js"></script>
<script type="text/javascript" src="scripts/core/orca.js"></script>
Expand Down
15 changes: 15 additions & 0 deletions desktop/sources/scripts/core/library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Orca language is a "library" of operators (everything that is not a command) that together define its behavior. Orca has the ability to dynamically load and combine multiple operator libraries at runtime, effectively allowing you to reconfigure the language. For example, you may want this for playing older compositions that are no longer compatible with the current Orca, or to experiment with alternative operators without affecting mainline Orca. Language reconfiguration lets you tailor the language to your individual composition.

Orca starts with a `default` library, additional libraries can be loaded and combined via the `lang` command. Library loading is incremental, that is, operators defined in the new library are added to runtime, replacing existing operators. A given library may define all operators or only some. To completely clear the runtime library and start with the blank slate use the `clr` library.

## Available libraries

"Complete" means you get a fully functioning Orca by loading just that library, "incremental" means it only defines a subset of operators and you need something loaded before that to get a full Orca (usually `default`).

* `clr`: a special library that unloads all definitions
* `default`: mainline Orca language, loaded at startup (complete)
* `orca157`: Orca before the BFL breaking change (complete) (TODO)
* `base`: not a very useful library by itself, defines the basics such as comments and numbers
* `sb*`: Sborca collection of alternative operators (see `sborca.md`)

## Usage examples
38 changes: 38 additions & 0 deletions desktop/sources/scripts/core/library/sborca.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
`use strict`

/* global Operator */
/* global library */

library.sbz = {
'z': function OperatorZ (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'z', passive)

this.name = 'lerp'
this.info = 'Transitions operand to target by duration'

this.ports.stepped = { x: -2, y: 0, default: '0' }
this.ports.duration = { x: -1, y: 0, default: '8' }
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 duration = this.listen(this.ports.duration, true)
const target = this.listen(this.ports.target, true)
const val = this.listen(this.ports.output, true)
var stepped = this.listen(this.ports.stepped, true)
if (stepped >= duration) {
stepped = duration
this.output(stepped, this.ports.stepped)
}
if (val !== target) {
if (stepped === duration) { stepped = 0 } // previous iteration done, ok to restart
const steps = duration - stepped
const remaining = target - val
const mod = Math.round(remaining / steps)
this.output(orca.keyOf(val + mod), this.ports.output)
this.output(orca.keyOf(stepped + 1), this.ports.stepped)
}
}
}
}

9 changes: 9 additions & 0 deletions desktop/sources/scripts/core/library/sborca.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Sborca collection of alternative operators

## `sbz` (incremental)

Defines:

* `Z` **lerp**(*step* *duration* target): duration-based variant of `Z`

TODO

0 comments on commit 6672d47

Please sign in to comment.