devalang 0.2.0

Write music with code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text.
Documentation
# =================
# Loops
# =================
# You can create loops using the loop and for/foreach directives.
#
# Loop syntax:
# `loop <optional_number> <optional_pass>(<int>):`
#
# For/Foreach syntax:
# `for <index_var> in <number | array | range>:`
# `foreach <index_var> in <number | array | range>:`

# Load bank for the triggers below
bank devaloop.808 as myBank

# Basic loop (repeat 4 times 3x sounds)
loop 4:
    .myBank.kick
    .myBank.snare
    .myBank.clap

# Infinite loop (repeat until break statement)
loop:
    .myBank.kick
    .myBank.snare
    .myBank.clap
    break

# Loop with pass (non-blocking)
# Will play the kick in loop for 2 bars (at 120 BPM)
# Will execute next statements after the loop immediately
loop pass(2 bar):
    .myBank.kick

# For loop over an array of numbers
for i in [1, 2, 3]:
    print "Loop iteration: " + i

# Foreach loop (alternative syntax) over an array of notes
let mySynth = synth square
foreach note in [C4, E4, G4, B4]:
    print "Playing note: " + note
    mySynth -> note(note)
            -> velocity(100)
            -> duration(1 beat)

# For loop over a range of numbers
for index in [0..10]:
    print "Index: " + index