Skip to content

Install a Package

A package is a git repository with code (src/lib.non), sample kits (kits/), or both. It installs into the project that uses it, and resonon.toml and resonon.lock record it, so the project gets the same package on every machine. Every command is in the CLI reference; every manifest key in resonon.toml.

In the project folder, name the repository with gh:user/repo:

Terminal window
resonon install gh:resonon/drum-kits

The package is cloned into dependencies/drum-kits, and added to resonon.toml and resonon.lock. Resonon prints what it found in it:

Installed 'drum-kits' [kits] to /Users/you/my-song/dependencies/drum-kits
Kits:
808 — Sampler(Kit("drum-kits/808"))
vinyl — Sampler(Kit("drum-kits/vinyl"))
Updated resonon.toml and resonon.lock

[code] means the package has a src/lib.non, [kits] a kits/ folder, [code+kits] both. Outside a project, resonon install is an error: start one with resonon new first.

Add a git tag after @:

Terminal window
resonon install gh:resonon/drum-kits@v1.0

Or write it into resonon.toml and run resonon install:

[dependencies]
drum-kits = { source = "gh:resonon/drum-kits", version = "v1.0" }

Without a tag, the install takes the newest commit, and resonon.lock records which one.

In a project you cloned or were sent, run it with no argument:

Terminal window
resonon install

It installs every dependency in resonon.toml at the commit in resonon.lock, not at the newest one, so you get the same code as whoever committed the lock. A dependency that has moved away from the lock is put back, and the line says so:

Restored 'drum-kits' [kits] to /Users/you/my-song/dependencies/drum-kits, at locked commit 4f3c1a9e02b7d5c8a1f6e3b9d0c2a7e4f8b1d6c3

A version tag in resonon.toml wins over the lock.

If the project needs a version of resonon you do not have, resonon install stops before it fetches anything, and names the command that installs that version.

Terminal window
resonon update # every dependency
resonon update drum-kits # one

update fetches each dependency again, at its tag or at the newest commit, builds any native extension, and writes a new resonon.lock. Commit the lock: it is what makes the next resonon install reproducible.

Terminal window
resonon remove drum-kits

remove takes the package out of resonon.toml and resonon.lock, and deletes its folder.

use the package by its name. It binds the name with hyphens turned into underscores:

use "studio-tools";
let pattern = studio_tools.swing(42, 0.6);

Name the kit with the package in front of it:

use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");
drums.set_instrument(Sampler(Kit("drum-kits/808")));

Kit("808") works too. Write the package when two packages have a kit with the same name, or to show where a sound comes from.

Terminal window
resonon pkg list # every package, its type and its kits
resonon pkg inspect drum-kits # its description, exports and kits