TuningFork.Samples (TuningForkSamples v0.1.0)

Copy Markdown View Source

Sonic Pi's recordings by name, registered with TuningFork.Sample.Bank when this application starts and fetched from Sonic Pi's repository the first time each is played.

TuningFork.Samples.load!(:perc_bell)
TuningFork.Samples.prefetch()

Summary

Functions

The names grouped by what comes before their first underscore.

The recording name, fetched and decoded the first time and kept in the bank after that.

Every sample name, sorted.

Start fetching every recording into TuningFork.Sample.Fetch.dir/0 in the background, about 34 MB in all, and return at once. A recording already there is not fetched again.

Register every name with TuningFork.Sample.Bank. Done when the application starts.

Where the recordings are fetched from; source/1 changes it.

Fetch the recordings from url instead of Sonic Pi's repository, and register every name there. url is a directory holding <name>.flac files.

The URL name is fetched from, or nil for a name the bank does not have.

Functions

families()

@spec families() :: %{required(String.t()) => [String.t()]}

The names grouped by what comes before their first underscore.

iex> TuningFork.Samples.families()["vinyl"]
["vinyl_backspin", "vinyl_hiss", "vinyl_rewind", "vinyl_scratch"]

load!(name)

@spec load!(atom() | String.t()) :: TuningFork.Sample.t()

The recording name, fetched and decoded the first time and kept in the bank after that.

Raises ArgumentError for a name the bank does not have or a recording that cannot be fetched.

names()

@spec names() :: [String.t()]

Every sample name, sorted.

prefetch()

@spec prefetch() :: :ok

Start fetching every recording into TuningFork.Sample.Fetch.dir/0 in the background, about 34 MB in all, and return at once. A recording already there is not fetched again.

register()

@spec register() :: :ok

Register every name with TuningFork.Sample.Bank. Done when the application starts.

source()

@spec source() :: String.t()

Where the recordings are fetched from; source/1 changes it.

source(url)

@spec source(String.t()) :: :ok

Fetch the recordings from url instead of Sonic Pi's repository, and register every name there. url is a directory holding <name>.flac files.

url(name)

@spec url(atom() | String.t()) :: String.t() | nil

The URL name is fetched from, or nil for a name the bank does not have.