TuningFork.Sample.Set (TuningFork v0.1.11)

Copy Markdown View Source

A set of named recordings described by a strudel.json, registered with TuningFork.Sample.Bank.

TuningFork.Sample.Set.load("github:eddyflux/crate")

Summary

Functions

Give every registered Machine_sound a second name alias_sound, from a map of machine names to aliases as Strudel's tidal-drum-machines-alias.json has it.

Load several sets one after another in the background and return at once, calling done when every one has been tried. Each is {source, opts} as load/2 takes them, plus :alias: the URL or path of an alias map to apply with aliases/1 after that set. No file is prefetched. A list already being loaded is not started again.

Register every name in a sample set.

Load several sets as background/2 does, returning once every one has been tried — or, when the same list is already loading in the background, once that has finished.

Functions

aliases(aliases)

@spec aliases(%{required(String.t()) => String.t()}) :: :ok

Give every registered Machine_sound a second name alias_sound, from a map of machine names to aliases as Strudel's tidal-drum-machines-alias.json has it.

background(sets, done \\ fn -> :ok end)

@spec background([{String.t() | map(), keyword()}], (-> term())) :: :ok

Load several sets one after another in the background and return at once, calling done when every one has been tried. Each is {source, opts} as load/2 takes them, plus :alias: the URL or path of an alias map to apply with aliases/1 after that set. No file is prefetched. A list already being loaded is not started again.

load(source, opts \\ [])

@spec load(String.t() | map(), keyword()) :: {:ok, [String.t()]} | {:error, term()}

Register every name in a sample set.

source is "github:user/repo" (branch main) or "github:user/repo/branch", the URL or local path of a strudel.json, or the decoded map itself. In the map, "_base" is put in front of every relative file, and each other key is a name holding one file or a list of them. Files are fetched on first use.

Options

  • :prefetch — start fetching every file in the background, default true
  • :only — register only these names, default all of them

Returns {:ok, names} or {:error, reason}.

load_all(sets, done \\ fn -> :ok end)

@spec load_all([{String.t() | map(), keyword()}], (-> term())) :: :ok

Load several sets as background/2 does, returning once every one has been tried — or, when the same list is already loading in the background, once that has finished.