๐ฆ 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
Websites & Resources
- ๐ Website โ Project homepage
- โถ๏ธ Playground โ Try Devalang in your browser
- ๐ Documentation โ Complete language reference
Important files
- ๐ Changelog โ Version history
- ๐ก Examples
Common projects and tools
- ๐ฆ Devapack โ Community-driven addons
- ๐งฉ VSCode Extension โ Syntax highlighting & snippets
Downloads
- ๐ Installers โ For Windows, macOS, and Linux
- ๐ฆ npm โ Install via npm
- ๐ฆ cargo โ Install via Cargo
โก Quick Start
Try in Your Browser
Launch the Playground to try Devalang without installing anything.
Download the Installers (Recommended)
Visit the Download page to get the latest releases for Windows, macOS, and Linux.
Install via npm (Node.js)
Install via Cargo (Rust)
Create Your First Project
# Initialize a new project
# Navigate to the project
# Check syntax
# Build audio files
# Play audio (live mode)
๐ฆ (optional) Install addons
Devalang supports addons to extend functionalities. This allows you to easily add sound banks, effects, or other features.
To create your own addon, please refer to the Devapack documentation.
# List available addons
# Install an addon (format: <author>.<addon-name>)
This will install the devaloop.808 sound bank in your current working directory inside .deva folder.
You can then use it in your Devalang scripts !
๐ต Your First Devalang File
Create a file hello.deva or index.deva (if you do not specify --input argument, it defaults to index.deva).
Nomenclature for .deva files
- Devalang files use the
.devaextension. - Devalang engine is indentation-sensitive for blocks, similar to Python.
- Files are plain text and can be edited with any text editor (VSCode recommended).
- Ensure your text editor supports UTF-8 encoding.
- Devalang is case-sensitive, so be consistent with capitalization.
- Devalang reads files from top to bottom, so order matters.
- Devalang files typically start with global settings (e.g.,
bpm,bank), followed by definitions (synth,pattern,group), and finally execution commands (spawn,play). - Devalang files can include comments using
#or//for single-line comments. - You can name your files anything, but
index.devais a common convention for the main entry file. - You can organize your project with subfolders as needed. (use module system like
@import { var } from '<module_path>'and@export { var }).
Refer to the documentation for a complete syntax reference.
# Set the tempo
bpm 120
# Load a bank of sounds (make sure 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) # 500ms
mySynth -> note(E5)
-> duration(1/4) # Quarter note
mySynth -> note(G5)
-> duration(1/16) # Sixteenth note
-> velocity(0.8) # Velocity (0.0 to 1.0) or 0-127
-> lpf(800) # Lowpass filter at 800Hz
-> reverb({ size: 0.3 }) # Reverb effect
# Play the melody (in parallel)
spawn myMelody
# Play the kick pattern (in parallel too)
spawn kickPattern
(optional) Configure project settings
You can create a devalang.json (recommended) or devalang.toml or even .devalang (legacy) file to customize check/build/play settings.
This typically evitate to re-type common arguments like --path, --formats, etc.
Comments are not supported in config files, please use
devalang initto generate a default config.
{
"project": {
"name": "My Awesome Project" // Change this to adjust project name
},
"paths": {
"entry": "audio/helloWorld.deva", // Change this to adjust entry file path
"output": "output" // Change this to adjust output directory
},
"audio": {
"format": ["wav", "mid"], // Change this to adjust output formats (options: wav, mid, mp3)
"bit_depth": 16, // Change this to 24 or 32 for higher quality
"channels": 2, // Change this to 1 for mono output
"sample_rate": 44100, // Change this to 48000 for higher quality
"resample_quality": "sinc24", // Change this to adjust resampling quality (options: sinc8, sinc16, sinc24, sinc32)
"bpm": 120 // Change this to adjust the project tempo (only if not set in code)
},
"live": {
"crossfade_ms": 500 // Change this to adjust crossfade duration when playing live
}
}
Build the audio
# Build to WAV, MP3, and MIDI
Play the audio
# Play the audio file
# Play live (repeats and watch until stopped)
# Play live loop with very short crossfade
# With 50ms, transitions between loops are no more distinguishable
๐ 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,varwith scoping - โ Groups & Spawn โ Organize and parallelize execution
- โ
Loops & Conditions โ
for,if,elsecontrol flow - โ Triggers โ Conditional audio triggering
- โ
Events โ Event system with
onandemit
๐ ๏ธ 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 โ Lossy audio export (via LAME)
๐ฏ 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
# NPM (TypeScript) and Cargo (Rust) are required
# Build CLI (Rust)
# Build WASM (Web & Node.js)
# Build TypeScript
# Run tests
๐ค 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