Getting started

This guide takes you from trying Onda to a running sine oscillator. At the end, you will know how an Onda program is shaped, how to hear it in real time, and how to render it to a file.

Try Onda in your browser

The quickest way to get started is the Onda playground. It lets you edit, compile, and hear Onda programs directly in your browser, with no installation. Start with the included patch or open a program from the example cookbook.

Install Onda when you are ready to work with local files, use native audio tools, or embed it in an application.

Install a precompiled release

Precompiled release packages are available for:

  • Linux x64 (.tar.xz)
  • macOS arm64 (.tar.xz)
  • Windows x64 (.zip)

Each package contains the onda executable, static and shared C libraries, onda.h, the language guide, and the examples. Download the archive for your platform, extract it, and add its bin directory to your PATH. SHA-256 checksums are published with each release.

Releases also contain portable npm tarballs for the WebAssembly compiler and Web Audio packages.

Check the installation:

onda --help

Install the WebAssembly compiler

Browser and Node.js applications can install the source-to-WebAssembly compiler from its release tarball or npm package:

npm install ./onda-lang-wasm-compiler-X.Y.Z.tgz
npm install @onda-lang/wasm-compiler
npx onda-wasm compile sine.onda --output sine.wasm

The command writes sine.wasm and its integrity-associated sine.onda.json processor descriptor. It is a build-time compiler and does not require LLVM, Rust, or a Wasm linker after installation. Applications compiling source in the browser can use the package’s asynchronous JavaScript API and worker mode. @onda-lang/webaudio remains an optional playback host.

Write your first patch

Create a file named sine.onda:

params:
  freq = 440.0 {20.0, 20000.0}

init:
  phase = 0.0

block:
  incr = freq * TWO_PI / SR

  sample:
    phase = phase + incr
    if phase > TWO_PI:
      phase = phase - TWO_PI
    out1 = sin(phase)

This small program exposes one host parameter, stores oscillator phase between samples, calculates the phase increment once per block, and produces one output per sample.

Check and run it

Compile the file to check its syntax and semantics:

onda compile sine.onda

Open the standalone run window:

onda run sine.onda

The default host uses the native egui interface. To select the webview host explicitly:

onda run sine.onda --webview

You can also run without the UI and set parameters from the command line:

onda run play sine.onda --dur 3 --set freq=220

Render a WAV file

Offline rendering uses the same run pipeline without opening an audio device:

onda run render sine.onda --output first.wav --dur 5 --set freq=330