Skip to content
Live Programming Environment(C Port)
C Shell Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Cleaned up examples Jan 15, 2019
thirdparty Add WIP timing stuff Dec 7, 2018
.clang-format Remove being/end ports blocks Dec 29, 2018
.gitignore Init with basic test Nov 23, 2018
LICENSE.md Updated examples and README / Added LICENSE Dec 3, 2018
Makefile Update tool and Makefile for separate config/target Nov 30, 2018
README.md
bank.c Fix incorrect capacity adjustment in Oevent list Sep 13, 2019
bank.h Add raw UDP datagram ';' operator Jan 19, 2019
base.h Cleanup Jan 22, 2019
cli_main.c Clean up naming of Markmap_ stuff Jan 22, 2019
field.c Cleanup stdio.h and Field naming. Add comment about Field. Jan 21, 2019
field.h Remove typedef for Field from base.h Jan 21, 2019
gbuffer.c Add partial support for resizing grids (WIP) Dec 3, 2018
gbuffer.h Remove use of 'Gbuffer' and 'Mbuffer' typedef wrappers Jan 21, 2019
mark.c Clean up naming of Markmap_ stuff Jan 22, 2019
mark.h Clean up naming of Markmap_ stuff Jan 22, 2019
osc_out.c Cleanup stdio.h and Field naming. Add comment about Field. Jan 21, 2019
osc_out.h Add raw UDP datagram ';' operator Jan 19, 2019
sim.c changes V and K to match orcaJS, fixes #48 Jul 15, 2019
sim.h less deterministic random Jun 7, 2019
term_util.c Add more save as logic Dec 17, 2018
term_util.h Fix warnings in some gcc versions Dec 19, 2018
tool adds --nomouse option when compiling Jul 15, 2019
tui_main.c Reorder `random_seed` field to waste less space. Sep 13, 2019

README.md

ORCΛ

Each letter of the alphabet is an operation, lowercase letters typically operate on bang(*), uppercase letters operate on each frame. Bangs can be generated by various operations, such as E colliding with a 0, see the bang.orca example. Watch a music video of ORCΛ in action.

C Port for the ORCΛ programming environment, with a commandline interpreter.

Prerequisites

Core library: A C99 compiler (no VLAs required), plus enough libc for malloc, realloc, free, memcpy, memset, and memmove.

Command-line interpreter: The above, plus POSIX, and enough libc for the common string operations (strlen, strcmp, etc.)

Interactive terminal UI: The above, plus ncurses (or compatible curses library), and floating point support (for timing.) Optionally, PortMIDI can be used to enable direct MIDI output.

Note: the core library for running an orca virtual machine should in theory build on anything, but the project is being worked on quickly right now, so it might accidentally include something from POSIX that isn't available on Windows, for example. The header files also need some restructuring. Please open an issue or send a message on twitter if you need help building the core virtual machine for your own use, and I'll try to clean it up for you.

Your compiler must also support #pragma once, but it probably does.

Raspberry Pi

After the first step, it might be a good idea to do sudo reboot.

sudo apt-get install git libncurses5-dev libncursesw5-dev libportmidi-dev
git clone https://github.com/hundredrabbits/Orca-c.git
cd Orca-c
./tool --portmidi build release orca             # Build
./build/release/orca --portmidi-list-devices     # Select Midi Device
./build/release/orca --portmidi-output-device 2  # Start

Build

The build script is in bash. It should work with gcc (including the musl-gcc wrapper) and clang, and will automatically detect your compiler.

Currently known to build on macOS (gcc, clang) and Linux (gcc, musl-gcc, and clang, optionally with LLD), and Windows via cygwin or WSL (gcc or clang).

There is a fire-and-forget make wrapper around the build script.

PortMIDI is an optional dependency. It can be enabled by adding the option --portmidi when running the tool build script.

You can also disable the mouse by adding the --nomouse option, useful to avoid accidental touchpad clicks.

Make

make debug      # debugging build, binary placed at build/debug/orca
make release    # optimized build, binary placed at build/release/orca
make clean      # removes build/

Build Script

Run ./tool --help to see usage info. Examples:

./tool -c clang-7 --portmidi build release orca
    # Build the terminal ui with a compiler named
    # clang-7, with optimizations enabled, and with
    # PortMIDI enabled for MIDI output.
    # Binary placed at build/release/orca

./tool build debug cli
    # Debug build of the headless CLI interpreter.
    # Binary placed at build/debug/cli

./tool clean
    # Same as make clean, removes build/

Run

Interactive terminal UI

Usage: orca [options] [file]

General options:
    --margins <number>     Set cosmetic margins.
                           Default: 2
    --undo-limit <number>  Set the maximum number of undo steps.
                           If you plan to work with large files,
                           set this to a low number.
                           Default: 100
    --initial-size <nxn>   When creating a new grid file, use these
                           starting dimensions.
                           Default: 57x25
    --bpm <number>         Set the tempo (beats per minute).
                           Default: 120
    --seed <number>        Set the seed for the random function.
                           Default: 1
    -h or --help           Print this message and exit.

OSC/MIDI options:
    --strict-timing
        Reduce the timing jitter of outgoing MIDI and OSC messages.
        Uses more CPU time.

    --osc-server <address>
        Hostname or IP address to send OSC messages to.
        Default: loopback (this machine)

    --osc-port <number or service name>
        UDP port (or service name) to send OSC messages to.
        This option must be set for OSC output to be enabled.
        Default: none

    --osc-midi-bidule <path>
        Set MIDI to be sent via OSC formatted for Plogue Bidule.
        The path argument is the path of the Plogue OSC MIDI device.
        Example: /OSC_MIDI_0/MIDI

Additional options are available if orca is built with --portmidi:

    --portmidi-list-devices
        List the MIDI output devices available through PortMIDI,
        along with each associated device ID number, and then exit.
        Do this to figure out which ID to use with
        --portmidi-output-device

    --portmidi-output-device <number>
        Set MIDI to be sent via PortMIDI on a specified device ID.
        Example: 1

Example: build and run orca with MIDI output

$ ./tool --portmidi build release orca           # compile orca
$ build/release/orca --portmidi-list-devices     # query for midi devices
ID: 3    Name: IAC Driver Bus
ID: 4    Name: USB MIDI Device
$ build/release/orca --portmidi-output-device 3  # run orca with midi device 3

Controls

┌ Controls ───────────────────────────────────────────┐
│           Ctrl+Q  Quit                              │
│       Arrow Keys  Move Cursor                       │
│     Ctrl+D or F1  Open Main Menu                    │
│   0-9, A-Z, a-z,  Insert Character                  │
│    !, :, =, #, *                                    │
│         Spacebar  Play/Pause                        │
│ Ctrl+Z or Ctrl+U  Undo                              │
│           Ctrl+X  Cut                               │
│           Ctrl+C  Copy                              │
│           Ctrl+V  Paste                             │
│           Ctrl+S  Save                              │
│           Ctrl+F  Frame Step Forward                │
│           Return  Append/Overwrite Mode             │
│                /  Key Trigger Mode                  │
│        ' (quote)  Rectangle Selection Mode          │
│ Shift+Arrow Keys  Adjust Rectangle Selection        │
│           Escape  Return to Normal Mode or Deselect │
│          ( and )  Resize Grid (Horizontal)          │
│          _ and +  Resize Grid (Vertical)            │
│          [ and ]  Adjust Grid Rulers (Horizontal)   │
│          { and }  Adjust Grid Rulers (Vertical)     │
│          < and >  Adjust BPM                        │
│                ?  Controls (this message)           │
└─────────────────────────────────────────────────────┘

CLI interpreter

The CLI (cli binary) reads from a file and runs the orca simulation for 1 timestep (default) or a specified number (-t option) and writes the resulting state of the grid to stdout.

cli [-t timesteps] infile

You can also make cli read from stdin:

echo -e "...\na34\n..." | cli /dev/stdin

Extras

  • Support this project through Patreon.
  • See the License file for license rights and limitations (MIT).
  • Pull Requests are welcome!
You can’t perform that action at this time.