Skip to content

alvaro-cuesta/lambda-musika

Repository files navigation

Lambda Musika, the functional DAW

Version License CI Status Issues PRs Welcome

A JavaScript DAW that emphasizes functions as its core building block. In practice, a realtime audio scripting language and batteries-included DSP library, running on the web. Live-coding ready!

Lambda Musika
Try it now on lambda.cuesta.dev!

Important

Keep in mind JavaScript is not the best language for CPU-intensive tasks, so performance will be limited.

On the other hand, it runs in your browser!

Usage

A Musika script is just a regular JS script:

  • interpreted client side
  • that returns a function t => [l, r]
  • where t is time
  • and l and r are output samples for the left and right channels in [-1, 1] range

For now there is no static documentation available, just dive in the source code and learn form the default song, other examples, or just browse the Musika library.

Available defines:

  • sampleRate, current audio device sample rate.
  • setLength(secs), sets the total length of the song in seconds.
    • Used to seek using the time slider.
    • When omitted the time slider is disabled and the sound is played endlessly (useful for drone or endless procedural music).
  • Musika, the Musika library

Empty script skeleton:

const { Generator, Envelope, Filter, Operator, Music, Util } = Musika;

return (t) => [0, 0];

Development

Install Node.js, clone this repository and run this in the root of the project to install the required dependencies:

corepack enable
corepack install
pnpm install --frozen-lockfile

Local development

Just run this to start a local development server and follow the instructions:

pnpm dev

Lints

You should periodically run linters to ensure the code passes some basic checks:

pnpm lint

Or just let your IDE do the work with TypeScript/ESLint/Prettier integrations. These are automatically run as checks on GitHub Actions, but it's better if you keep lints up to date as you code!

Tests

Run all package tests from the workspace root:

pnpm test

These are automatically run as checks on GitHub Actions, but it's better if you keep tests up to date as you code!

Things to do

  • See TODO.md for outstanding general tasks.
  • See open issues.
  • Do a global search for @todo in the code.

Production build

Run this to serve the application in production mode:

pnpm build
pnpm preview

About

A JavaScript DAW that emphasizes functions as its core building block. In practice, a realtime audio scripting language and batteries-included DSP library, running on the web.

Topics

Resources

License

Stars

Watchers

Forks

Contributors