An open API service indexing awesome lists of open source software.

https://github.com/alvaro-cuesta/lambda-musika

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.
https://github.com/alvaro-cuesta/lambda-musika

audio daw functional-programming live-coding music

Last synced: about 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

          


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](examples/default.musika), other [examples](examples/), or just browse the [Musika library](src/lib/Musika/).

### 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](src/lib/Musika/)

### Empty script skeleton:

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

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

## Development

Install [Node.js](https://nodejs.org), clone this repository and run this in the root of the project to install the required dependencies:

```sh
npm install
```

### Local development

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

```sh
npm run dev
```

### Lints

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

```sh
npm run lint:tsc
npm run lint:eslint
npm run lint:prettier
# Or just let your IDE do the work with TypeScript/ESLint/Prettier integrations
npm run lint:knip
npm run lint:madge
```

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

### Things to do

- See [`TODO.md`](TODO.md) for outstanding general tasks.
- See [open issues](https://github.com/alvaro-cuesta/lambda-musika/issues).
- Do a global search for `@todo` in the code.

## Production build

Run this to serve the application in production mode:

```sh
npm run build
npm run preview
```