Skip to content

boorch/bOrca

 
 

Repository files navigation

ORCΛ

Orca is an esoteric programming language and live editor designed to quickly create procedural sequencers. Every letter of the alphabet is an operation, lowercase letters execute on *bang*, and uppercase letters execute each frame.

This is the C implementation of the ORCΛ language and terminal livecoding environment. It's designed to be power efficient. It can handle large files, even if your terminal is small.

Orca is not a synthesizer, but a flexible livecoding environment capable of sending MIDI, OSC, and UDP to your audio/visual interfaces like Ableton, Renoise, VCV Rack, or SuperCollider.

Main git repo GitHub mirror
git.sr.ht/~rabbits/orca github.com/hundredrabbits/Orca-c

About this fork

I'll try to add new operators based on my needs. I'm not a professional programmer, just a hobbyist, so most of the code here is generated by various AI assistants, based on 'painfully' extensive directions I provided. I've tried to include comments as much as possible to remember what I did and why, but I'm fairly certain it's not the most elegant code that adheres to proper standards. You should consider this fork to be 'somewhat' functional. Currently I'm focused on Orca-c only, since my use cases are:

  • Using it through SSH on a Raspberry Pi Zero 2W, connected to an iPad Pro 11", outputting MIDI data via USB, acting as a MIDI Gadget
  • Using it on my uConsole terminal, paired to a CME WIDI Jack via Bluetooth, which is connected to the MIDI ports of a Torso S4.

Tooltip System

This fork includes an enhanced tooltip system inspired by the original tooltip functionality found in the Elektron version of ORCA. When positioning the cursor over operator input ports, contextual tooltips appear in the bottom-right corner of the screen showing parameter names like "Channel", "Octave", "Velocity", etc. This makes learning and using operators much more intuitive, especially for complex operators with multiple inputs. The tooltip system works across all operators and provides immediate feedback about what each port represents without needing to reference documentation.

Scale Operator ($) - Unified Scales and Chords:

Outputs note and octave based on the provided root note, scale/chord type, and degree. The operator now supports a unified system with 62 total options: 10 essential scales (0-9), 26 chord root positions (a-z), and 26 chord first inversions (A-Z).

Operator Octave RootNote Scale/Chord Degree
$ O R S D

Output: The Scale operator outputs the octave above the operator and the note to the right of the operator.

Scale Examples (0-9):

  • $3C02 - C Major scale, 3rd degree → outputs octave '3' and note 'E'
  • $.C12 - C Minor scale, 3rd degree → outputs note 'd' (D#/Eb, no octave)

Chord Examples (a-z = root position, A-Z = first inversion):

  • $3Ca2 - C Major chord, 3rd note → outputs '3g' (G3)
  • $3CA2 - C Major first inversion, 3rd note → outputs '4c' (C4)

Available Scales (0-9):

Value Scale Type
0 Major Scale
1 Minor Scale
2 Dorian Scale
3 Lydian Scale
4 Mixolydian Scale
5 Pentatonic Scale
6 Hirajoshi Scale
7 Iwato Scale
8 Tetratonic Scale
9 Fifths Scale

Available Chords (a-z = root, A-Z = first inversion):

Value Chord Type Root Notes First Inversion
a/A Major C-E-G E-G-C
b/B Minor C-Eb-G Eb-G-C
c/C Sus4 C-F-G F-G-C
d/D Sus2 C-D-G D-G-C
e/E Major7 C-E-G-B E-G-B-C
f/F Minor7 C-Eb-G-Bb Eb-G-Bb-C
g/G Dom7 C-E-G-Bb E-G-Bb-C
h/H Major6 C-E-G-A E-G-A-C
i/I Minor6 C-Eb-G-A Eb-G-A-C
j/J Dim C-Eb-Gb Eb-Gb-C
k/K Dim7 C-Eb-Gb-A Eb-Gb-A-C
l/L HalfDim7 C-Eb-Gb-Bb Eb-Gb-Bb-C
m/M Aug C-E-G# E-G#-C
n/N Aug7 C-E-G#-Bb E-G#-Bb-C
o/O Major9 C-E-G-B-D E-G-B-D-C
p/P Minor9 C-Eb-G-Bb-D Eb-G-Bb-D-C
q/Q Dom9 C-E-G-Bb-D E-G-Bb-D-C
r/R Major11 C-E-G-B-D-F E-G-B-D-F-C
s/S Minor11 C-Eb-G-Bb-D-F Eb-G-Bb-D-F-C
t/T Major13 C-E-G-B-D-F-A E-G-B-D-F-A-C
u/U Minor13 C-Eb-G-Bb-D-F-A Eb-G-Bb-D-F-A-C
v/V Dom7b9 C-E-G-Bb-Db E-G-Bb-Db-C
w/W Dom7#9 C-E-G-Bb-D# E-G-Bb-D#-C
x/X Major7#11 C-E-G-B-F# E-G-B-F#-C
y/Y Minor7b5 C-Eb-Gb-Bb Eb-Gb-Bb-C
z/Z MinorMaj7 C-Eb-G-B Eb-G-B-C

This unified system allows the Scale operator to access both traditional scales for melodic work and a comprehensive chord library for harmonic progressions, with intuitive case-sensitive first inversion support.

Midichord Operator (=)

The Midichord operator outputs MIDI notes to form chord types using the unified system. It supports enriched chords (0-9), chord root positions (a-z) and first inversions (A-Z), making it useful for harmonic progressions and complex chord sequences. (This replaces OSC operator, as I never use it)

Operator Channel Octave Root Note Chord Type Velocity Duration
= C O R T V D

Examples

  • =13C0ff - Plays enriched C major chord (C-E-G-C) on channel 1, octave 3
  • =13C1ff - Plays enriched C minor chord (C-Eb-G-C) on channel 1, octave 3
  • =13Caff - Plays C major chord (C-E-G) on channel 1, octave 3
  • =13CAff - Plays C major first inversion (E-G-C) on channel 1, octave 3
  • =13Cbff - Plays C minor chord (C-Eb-G) on channel 1, octave 3

Available Chord Types

Enriched Chords (0-9) - Enhanced versions with strategic octave additions

Index Name Intervals Notes (C root)
0 Major + Oct 0,4,7,12 C-E-G-C
1 Minor + Oct 0,3,7,12 C-Eb-G-C
2 Sus4 + Oct 0,5,7,12 C-F-G-C
3 Sus2 + Oct 0,2,7,12 C-D-G-C
4 Major7 + Oct3rd 0,4,7,11,16 C-E-G-B-E
5 Minor7 + Oct3rd 0,3,7,10,15 C-Eb-G-Bb-Eb
6 Dom7 + Oct5th 0,4,7,10,19 C-E-G-Bb-G
7 Major6 + Oct 0,4,7,9,12 C-E-G-A-C
8 Minor6 + Oct 0,3,7,9,12 C-Eb-G-A-C
9 Dim + Oct 0,3,6,12 C-Eb-Gb-C

Root Position Chords (a-z) & First Inversions (A-Z)

The Midichord operator uses the same chord definitions as the Scale operator (a-z for root positions, A-Z for first inversions). See the Scale Operator section above for the complete chord reference table.

Random Operators (R and r):

The R operator (uppercase) provides pure random generation that runs every tick. The r operator (lowercase) requires bang and uses a shuffle-based algorithm to avoid producing identical outputs on consecutive bangs in a creative manner.

  • R (uppercase): Pure random, runs every tick
  • r (lowercase): Shuffle-based random, requires bang to avoid consecutive duplicates

Arpeggiator Operator (;):

The Arpeggiator operator (;) is a simplified degree-based arpeggiator that outputs degree numbers (0, 1, 2, 3...) instead of MIDI directly. This creates a modular system where the arpeggiator feeds degree numbers to the Scale operator ($), which then feeds notes to the MIDI operator (:). It only executes when banged (lowercase ;) and uses internal state tracking.

The operator reduces complexity by requiring only 2 inputs (pattern and range) while maintaining all pattern functionality through a cleaner separation of concerns:

  • ; (arpeggiator) → $ (scale) → : (midi)

Inputs

Range Operator Pattern
R ; P
  • R: Range (1-4) - Sets the octave range for arpeggiation
  • P: Pattern (0-9, a-d) - Selects the arpeggiation pattern

Output

  • Outputs degree numbers to the right of the operator

Example

.............
.......D2....
........;12..
....$3C03....
.:03Fa8......
.............

This example:

  1. Delay (D) with value 2 bangs the arpeggiator every 2 ticks
  2. Arpeggiator (;) uses range 1, pattern 2 (Up-Down)
  3. Scale operator ($) converts degrees to notes using octave 3, C major scale, degree received from Arpeggiator
  4. MIDI operator (:) plays the notes on channel 0 with velocity a, duration 8

Arpeggio Patterns

Pattern Description Pattern Style
0 Up Ascending notes in scale
1 Down Descending notes in scale
2 Up-Down Ascending then descending (no repeat at turn points)
3 Down-Up Descending then ascending (no repeat at turn points)
4 Up-Down+ Ascending then descending (with repeated turn points)
5 Down-Up+ Descending then ascending (with repeated turn points)
6 Converge Outside in (highest, lowest, 2nd highest, 2nd lowest...)
7 Diverge Inside out (middle notes outward)
8 Pinky Up Alternate between notes and highest note
9 Thumb Up Alternate between lowest and other notes
a Up-Down Alt Up-down alternating pattern
b Down-Up Alt Down-up alternating pattern
c Random Random selection from scale degrees
d Bounce Bouncing pattern

The modular design allows for flexible combinations: use the arpeggiator with any scale/chord from the Scale operator, and route the output to any MIDI operator for complete control over timing, velocity, and duration.

Bouncer (&) (A rudimentary LFO interpretation)

The bouncer operator creates smooth transitions between two values using various waveform patterns. Useful for creating continuous value changes and modulations. Each waveform has a resolution of 128 steps (some steps are repeating to reflect the 'waveform' as precisely as possible, e.g: closer to peaks of a sine wave).

The Rate parameter controls the speed of waveform traversal: Rate 0 = no movement, Rate 1 = advance 1 step per tick (slowest), Rate 2 = advance 2 steps per tick (faster), etc. Higher rate values make the waveform cycle faster but with lower resolution. By setting the Start and End values, you control the amplitude/range of the waveform output.

Inputs

Operator Start Value End Value Rate Shape
& A B R S
  • A: Start value (0-z)
  • B: End value (0-z)
  • R: Rate - Speed of transition (0-z, higher = faster)
  • S: Shape (0-7) - Selects waveform pattern

Example

  • &3a22
  • Transitions between values 3 and a, with rate 2 (advances 2 steps per tick), using waveform shape 2 (Sine)

Waveform Shapes

Value Pattern Description
0 Triangle Linear up then down
1 Inv. Triangle Linear down then up
2 Sine Smooth curved transition up then down
3 Inv. Sine Smooth curved transition down then up
4 Square Instant switch between min and max
5 Inv. Square Instant switch between max and min
6 Saw Linear up, instant down
7 Inv. Saw Linear down, instant up

Output value cycles through the chosen waveform pattern between start and end values at the specified rate. Perfect for creating LFO-like modulations or smooth parameter changes.

MIDI CC Operator (!) (Refactored)

The MIDI CC operator sends MIDI Control Change messages. The control number is specified using three decimal digits (hundreds, tens, ones) allowing access to all MIDI CC numbers from 0-127. Missing digits can be omitted using . (e.g., 003 or ..3 for CC#3, 049 or .49 for CC#49).

Inputs

Operator Channel Control Hundreds Control Tens Control Ones Value Interpolation Rate
! C Ch Ct Co V R
  • C: MIDI channel (0-F)
  • Ch: Hundreds digit of control number (0-9) or . to omit
  • Ct: Tens digit of control number (0-9) or . to omit
  • Co: Ones digit of control number (0-9) or . to omit
  • V: Control value (0-z) - maps to MIDI CC values in increments of 4
  • R: Interpolation rate (0-z) - . for instant, 1-z for interpolated transitions

Common MIDI CC Values

  • 0 → 0 (minimum)
  • 8 → 32 (25% intensity)
  • g → 64 (50% intensity, center)
  • o → 96 (75% intensity)
  • w → 127 (maximum)

Examples

  • !3..70. - Sends MIDI CC #7 (volume) on channel 3 with value 0 (silent), instant
  • !3..7g. - Sends MIDI CC #7 (volume) on channel 3 with value 64 (half volume), instant
  • !3..7w. - Sends MIDI CC #7 (volume) on channel 3 with value 127 (full volume), instant
  • !3.01o. - Sends MIDI CC #1 (mod wheel) on channel 3 with value 96, instant
  • !3..7g5 - Sends MIDI CC #7 on channel 3 with value 64, interpolated at rate 5
  • !3..7w1 - Sends MIDI CC #7 on channel 3 with value 127, slowly interpolated (rate 1)

Interpolation

When the 6th parameter (interpolation rate) is provided and not ., the operator will smoothly transition the CC value from its current position to the target value over multiple frames. This allows for smooth parameter sweeps and reduces the "staircase" effect of Orca's discrete timing.

  • Rate .: Instant change (default behavior)
  • Rate 1: Slowest interpolation (many steps)
  • Rate z: Fastest interpolation (few steps)

The interpolation system maintains separate state for each channel+control combination, allowing multiple CCs to interpolate independently.

The operator automatically clamps control numbers above 127 to 127 to ensure valid MIDI CC range. Values use increments of 4 for predictable and musical MIDI CC values.

About

Live Programming Environment(C Port)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 94.8%
  • Shell 5.1%
  • Makefile 0.1%