JSPM

  • Created
  • Published
  • Downloads 108
  • Score
    100M100P100Q64688F
  • 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

    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

    GitHub Actions Workflow Status

    🦊 Devalang (CORE) β€” Compose music with code

    Devalang is a tiny domain-specific language (DSL) for music makers, sound designers, and audio hackers. Compose loops, control samples, render and play audio β€” all in clean, readable text.

    Whether you're building a track, shaping textures, or performing live, Devalang helps you think in rhythms. It’s designed to be simple, expressive, and fast β€” because your ideas shouldn’t wait.

    From studio sketches to live sets, Devalang gives you rhythmic control β€” with the elegance of code.

    🚧 Notice 🚧

    Includes synthesis, playback, and rendering features, but is still in early development, and breaking changes may occur.

    NEW: Devalang WORKSHOP is now available.

    πŸ“š Quick Access

    ⏱️ Try it now !

    Try Devalang in your browser

    Have a look at the Playground to try Devalang directly in your browser

    Try Devalang in your terminal

    With Node.js

    npm install -g @devaloop/devalang@latest

    With Rust

    cargo install devalang --version <version>

    Initialize a new project

    devalang init --name my-project --template minimal

    Write your first script

    Create a new Devalang file src/index.deva in the project directory:

    # src/index.deva
    
    # BPM definition
    bpm 125
    
    # Bank picking (make sure you've installed it)
    bank devaloop.808 as my808Bank
    
    # Pattern literal without options
    pattern kickPattern with my808Bank.kick = "x--- x--- x--- x---"
    
    group myGroup:
        # Rhythmic (each beat playing a kick)
        # on beat:
        #     .my808Bank.kick 1/4
    
        # Synth definition with ADSR
        let myLead = synth sine {
            attack: 0,
            decay: 100,
            sustain: 100,
            release: 100
        }
    
        # Global automation
        automate myLead:
            param volume {
                0% = 0.0
                100% = 0.5
            }
            param pitch {
                0% = -12.0
                100% = 12.0
            }
    
        # Notes in a loop with condition
        for i in [1, 2, 3]:
            if i == 3:
                myLead -> note(C5, { duration: 200 })
                print "Playing note C5 for " + i
    
        # Pause runtime for 500ms
        sleep 500
    
        # Note with automation
        myLead -> note(C4, {
            duration: 400,
            velocity: 0.8,
            automate: {
                pan: {
                    0%: -1.0,
                    100%: 0.0
                }
            }
        })
    
        # Notes with params
        myLead -> note(G4, { duration: 600, glide: true })
        myLead -> note(B3, { duration: 400, slide: true })
    
    # Spawning the group & the pattern to play them in parallel
    spawn myGroup
    spawn kickPattern

    And the best part ? You can play it directly from the command line:

    Play the script once

    devalang play

    LIVE mode (repeat the playback + watch mode)

    devalang play --repeat

    πŸŽ‰ You can now hear your Devalang code in action

    For more examples, check out the examples directory

    ❓ Why Devalang ?

    • 🎹 Prototype audio ideas without opening a DAW, even VSCode with our Playground
    • πŸ’» Integrate sound into code-based workflows
    • πŸŽ›οΈ Control audio parameters through readable syntax
    • πŸ§ͺ Build musical logic with variables and conditions
    • πŸ”„ Create complex patterns with ease

    πŸš€ Features

    • ⚑ Fast Build & Hot Reload β€” optimized build process for quicker iteration.
    • 🎡 Audio Engine & Real-time runner β€” low-latency playback, render-to-file, and a realtime runner used by devalang play --repeat for live feedback.
    • 🧩 Language primitives β€” synths, notes, ADSR, maps, arrays, loops, conditionals and functions for expressive musical logic.
    • πŸŽ›οΈ Per-note automation & modulators β€” automate maps, $mod.*, $easing.* and $math.* helpers for envelopes and LFOs.
    • 🧩 Module system & structured AST β€” import/export variables, stable AST output for debugging and tooling.
    • 🧰 Plugins & Addons (WASM-ready) β€” install plugins/banks, @use directive, and WASM plugin integration so plugins can render or process audio at runtime.
    • πŸ“¦ Addon manager & Devaforge β€” CLI commands to discover/install banks, plugins and templates; devaforge helps create addons.
    • βš™οΈ CLI tooling β€” build, check, play, install, init, discover, telemetry and more with consistent flags (--watch, --debug, --compress).
    • πŸ“‚ Project templates & examples β€” quick-start templates and many example projects in examples/.
    • πŸ§‘β€πŸ’» TypeScript API & WASM distribution β€” Node-friendly package with TypeScript bindings and a WASM build for browser/Node usage.
    • 🧰 Editor & formatting support β€” VSCode extension and Prettier plugin to edit Devalang with syntax and formatting support.
    • 🎡 Custom samples & banks β€” drop samples into .deva and reference them from code; banks of sounds for fast composition.
    • πŸ”„ Looping, grouping & scheduling β€” precise beat-tied scheduling primitives for complex rhythmic patterns.

    πŸ“„ Documentation

    Please refer to the online documentation for detailed information on syntax, features, and usage examples

    πŸ“° What's new

    • Effects chaining: Added support for chaining multiple effects on synths and samples.
    • New addons system: Revamped the addons system for better management and integration.
    • MIDI export: Added the ability to export MIDI files from Devalang scripts.
    • Synthesizer improvements: Enhanced the built-in synthesizer with new types and modulation options.
    • Devaforge: Introduced a new system for creating and managing addons, including a CLI for addon generation.
    • Documentation updates: Improved documentation for clarity and completeness.
    • Discovering addons: Introduced a new command to detect addons.
    • Public TypeScript API: Added a public TypeScript API for easier integration.
    • Improved error messages: Enhanced error messages for better debugging.
    • Major refactor: Significant codebase refactor for improved maintainability and performance.
    • Bug fixes: Various bug fixes and stability improvements.

    πŸ›‘οΈ License

    MIT β€” see LICENSE

    🀝 Contributing

    Contributions, bug reports and suggestions are welcome !
    Feel free to open an issue or submit a pull request.

    For more info, see docs/CONTRIBUTING.md.

    πŸ“’ Contact

    Feel free to reach out for any inquiries or feedback.

    πŸ“§ contact@devaloop.com