JSPM

  • Created
  • Published
  • Downloads 104
  • Score
    100M100P100Q64599F
  • License MIT

Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound โ€” in plain text.

Package Exports

  • @devaloop/devalang
  • @devaloop/devalang/out-tsc/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@devaloop/devalang) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Devalang Logo

Rust TypeScript Node.js

Project Status Version License: MIT

Linux macOS Windows

npm crates

๐ŸฆŠ Devalang โ€” Write music with code

Devalang is a compact domain-specific language (DSL) for music makers, sound designers, and creative coders. Compose loops, control samples, synthesize audio, and render your ideas โ€” all in clean, readable text.

Whether you're prototyping a beat, building generative music, or performing live, Devalang gives you rhythmic precision with the elegance of code.

From studio sketches to live sets, Devalang puts musical ideas into motion.

๐Ÿš€ v0.1.0 - Complete Rewriting

NEW: Devalang Playground V2.0 is now available โ€” Try it in your browser!


๐Ÿ“š Quick Access


โšก Quick Start

Try in Your Browser

Launch the Playground to try Devalang without installing anything.

npm install -g @devaloop/devalang

Install via Cargo (Rust)

cargo install devalang

Create Your First Project

# Initialize a new project
devalang init my-project

# Navigate to the project
cd my-project

# Check syntax
devalang check --entry examples/index.deva

# Build audio files
devalang build --path examples/index.deva --formats wav mid

# Play audio (live mode)
devalang play --live --input examples/index.deva

๐ŸŽต Your First Devalang Script

Create a file hello.deva:

# Set the tempo
bpm 120

# Load a bank of sounds (make sur you have the bank installed)
bank devaloop.808 as drums

# Create a simple kick pattern
pattern kickPattern with drums.kick = "x--- x--- x--- x---"

# Define a synth and a melody
let mySynth = synth saw

# Define a melody using a group to organize notes
group myMelody:
    mySynth -> note(C5)
        -> duration(500)

    mySynth -> note(E5)
        -> duration(500)

    mySynth -> note(G5)
        -> duration(500)

# Play the melody
spawn myMelody

# Play the kick pattern
spawn kickPattern

Build the audio

# Build to WAV
devalang build --path hello.deva --formats wav

# Output: ./output/audio/hello.wav

Play the audio

# Play the audio file
devalang play --input hello.deva

# Play live (repeats and watch until stopped)
devalang play --live --input hello.deva

๐Ÿš€ Features

๐ŸŽต Core Language

  • โœ… Lexer & Parser โ€” Complete tokenization and AST generation
  • โœ… Patterns โ€” Rhythmic notation with swing, humanize, velocity
  • โœ… Synths โ€” Built-in synthesizers with ADSR envelopes
  • โœ… Filters โ€” Lowpass, highpass, bandpass audio filtering
  • โœ… Effects โ€” Reverb, delay, distortion, drive, chorus
  • โœ… Variables โ€” let, const, var with scoping
  • โœ… Groups & Spawn โ€” Organize and parallelize execution
  • โœ… Loops & Conditions โ€” for, if, else control flow
  • โœ… Triggers โ€” Conditional audio triggering
  • โœ… Events โ€” Event system with on and emit

๐Ÿ› ๏ธ CLI Tools

  • โœ… devalang init โ€” Scaffold new projects (3 templates)
  • โœ… devalang build โ€” Compile to WAV/MIDI
  • โœ… devalang check โ€” Validate syntax
  • โœ… devalang play โ€” Audio playback
  • โœ… devalang addon โ€” Manage addons (install, list, discover)
  • โœ… devalang login/logout โ€” Authentication
  • โœ… devalang telemetry โ€” Privacy controls

๐ŸŒ WASM API

  • โœ… render_audio() โ€” Browser audio rendering
  • โœ… render_midi_array() โ€” MIDI export
  • โœ… debug_render() โ€” Debug information
  • โœ… parse() โ€” Parse Devalang code
  • โœ… TypeScript types included

๐Ÿ“ฆ Output Formats

  • โœ… WAV โ€” 16/24/32-bit audio export
  • โœ… MIDI โ€” Standard MIDI file export
  • โœ… MP3/FLAC โ€” Planned

๐ŸŽฏ Performance

  • โšก Fast builds โ€” 7-10ms for typical projects
  • โšก Low latency โ€” Optimized audio engine
  • โšก Release builds โ€” 5-6x faster than debug

๐Ÿ“š Learning Resources

  • โœ… Online Docs โ€” Complete language reference
  • โœ… VSCode Extension โ€” Syntax highlighting

๐Ÿ’ก Why Devalang?

  • ๐ŸŽน Prototype audio ideas without opening a DAW
  • ๐Ÿ’ป Integrate sound into code-based workflows
  • ๐ŸŽ›๏ธ Control audio parameters with readable syntax
  • ๐Ÿงช Build musical logic with variables and conditions
  • ๐Ÿ”„ Create patterns with expressive notation
  • ๐ŸŽจ Live code with fast iteration cycles
  • ๐Ÿ“ฆ Version control your music with git

๐Ÿ“– Documentation

Visit docs.devalang.com for:

  • Complete syntax reference
  • API documentation
  • WASM integration guide
  • CLI command reference
  • Advanced tutorials
  • Best practices

๐Ÿ”ง Development

Build from Source

# Clone the repository
git clone https://github.com/devaloop-labs/devalang.git
cd devalang

# Build CLI (Rust)
cargo build --release --features cli

# Build WASM
cargo build --release --features wasm --lib

# Build TypeScript
npm install
npm run ts:build

# Run tests
cargo test --features cli
npm test

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Ways to Contribute

  • ๐Ÿ› Report bugs via GitHub Issues
  • ๐Ÿ’ก Suggest features in discussions
  • ๐Ÿ“ Improve docs with pull requests
  • ๐ŸŽต Share examples of your creations
  • ๐Ÿงช Write tests for new features

๐Ÿ“œ License

MIT License โ€” See LICENSE for details.

Copyright (c) 2025 Devaloop


Made with โค๏ธ by the Devaloop team
Star โญ the repo if you like it!