<div align="center">
<img src="https://devalang.com/images/devalang-logo-min.png" alt="Devalang Logo" width="100" />
</div>











# ๐ฆ 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](https://playground.devalang.com) โ Try it in your browser!
---
## ๐ Quick Access
- [โถ๏ธ Playground](https://playground.devalang.com) โ Try Devalang in your browser
- [๐ Documentation](https://docs.devalang.com) โ Complete language reference
- [๐งฉ VSCode Extension](https://marketplace.visualstudio.com/items?itemName=devaloop.devalang-vscode) โ Syntax highlighting & snippets
- [๐ Changelog](./docs/CHANGELOG.md) โ Version history
- [๐ก Examples](./examples/)
- [๐ Website](https://devalang.com) โ Project homepage
- [๐ฆ npm Package](https://www.npmjs.com/package/@devaloop/devalang)
- [๐ฆ Rust Crate](https://crates.io/crates/devalang)
---
## โก Quick Start
### Try in Your Browser
> **[Launch the Playground](https://playground.devalang.com)** to try Devalang without installing anything.
### Install via npm (Recommended)
```bash
npm install -g @devaloop/devalang
```
### Install via Cargo (Rust)
```bash
cargo install devalang
```
### Create Your First Project
```bash
# 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`:
```deva
# Set the tempo
bpm 120
# Load a bank of sounds
bank devaloop.808 as drums
# Create a simple drum pattern
pattern kickPattern with drums.kick = "x--- x--- x--- x---"
pattern snarePattern with drums.snare = "---- x--- ---- x---"
pattern hihatPattern with drums.hihat = "x-x- x-x- x-x- x-x-"
# Play the patterns
call kickPattern
call snarePattern
call hihatPattern
```
### Build the audio
```bash
# Build to WAV
devalang build --path hello.deva --formats wav
# Output: ./output/audio/hello.wav
```
# Play the audio
```bash
# 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 for v0.1.1
### ๐ฏ **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](https://docs.devalang.com)** for:
- Complete syntax reference
- API documentation
- WASM integration guide
- CLI command reference
- Advanced tutorials
- Best practices
---
## ๐ง Development
### Build from Source
```bash
# 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](./CONTRIBUTING.md) for guidelines.
### Ways to Contribute
- ๐ **Report bugs** via [GitHub Issues](https://github.com/devaloop-labs/devalang/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](./LICENSE) for details.
Copyright (c) 2025 Devaloop
---
<div align="center">
<strong>Made with โค๏ธ by the Devaloop team</strong>
<br />
<sub>Star โญ the repo if you like it!</sub>
</div>