Sonic Pi's sample pack, which is under Creative Commons 0, and the files a song plays as samples: the pack's by name, a file by path, or a file of a public GitHub repository as {:github, repo, ref, path}.
The pack is too large for the repository, so download/1 fetches it from a fixed Sonic Pi release into a folder outside the repository, the user's cache by default.
Each file is written under a temporary name and renamed once complete, so an interrupted download never leaves a sample that looks downloaded.
Summary
Functions
Refuses options that cannot cut the sample ref at path, as :ok or {:error, message}.
Refuses a GitHub sample's reference that is not {:github, "owner/repo", ref, path}, as :ok or {:error, message}.
Sample options with from, to, slices, slice and beats worked out into start, finish and rate, for a file of seconds played at tempo; options that cut nothing need no length.
Whether an option cuts a sample or fits it to beats, which mx works out into the sample players' own options.
The folder in the user's cache the sample pack downloads to.
The folder the sample pack is in: the :samples_dir setting, or default_dir/0.
Downloads the files of the pack that are missing, with its licence, and returns {:ok, count} or {:error, file, reason, count}.
Downloads a collection ahead of time, for mx samples download SOURCE and mix mx.samples.download SOURCE, and returns {:ok, message} or {:error, message}.
The line mx prints when the song loads for a sample file played at peak, silent or too quiet to hear without normalize, or nil.
How messages name a sample: by its name in the pack, its path, or its repository and path.
The names of the files in Sonic Pi's sample pack, without their extension.
The full path of a sample named as an atom from the pack, given as a file path, or of a GitHub repository, downloaded into the cache when it is not there yet, or {:error, message} saying why it cannot play.
The loudest moment of a sample file mx can play, as a level from 0, read from the whole file.
The length in seconds of a sample file mx can play.
Functions
Refuses options that cannot cut the sample ref at path, as :ok or {:error, message}.
Refuses a GitHub sample's reference that is not {:github, "owner/repo", ref, path}, as :ok or {:error, message}.
Sample options with from, to, slices, slice and beats worked out into start, finish and rate, for a file of seconds played at tempo; options that cut nothing need no length.
Whether an option cuts a sample or fits it to beats, which mx works out into the sample players' own options.
The folder in the user's cache the sample pack downloads to.
The folder the sample pack is in: the :samples_dir setting, or default_dir/0.
Downloads the files of the pack that are missing, with its licence, and returns {:ok, count} or {:error, file, reason, count}.
Downloads a collection ahead of time, for mx samples download SOURCE and mix mx.samples.download SOURCE, and returns {:ok, message} or {:error, message}.
SOURCE is sonic_pi for Sonic Pi's pack, or a GitHub repository as owner/repo@ref, optionally followed by :folder for only that folder.
Files already on disk are skipped, so running it again finishes an interrupted download.
The line mx prints when the song loads for a sample file played at peak, silent or too quiet to hear without normalize, or nil.
How messages name a sample: by its name in the pack, its path, or its repository and path.
The names of the files in Sonic Pi's sample pack, without their extension.
The full path of a sample named as an atom from the pack, given as a file path, or of a GitHub repository, downloaded into the cache when it is not there yet, or {:error, message} saying why it cannot play.
The loudest moment of a sample file mx can play, as a level from 0, read from the whole file.
The length in seconds of a sample file mx can play.