Soundfont instruments as Strudel plays them: one file per instrument, a zone per key range, each zone a recording with its root pitch and loop.
{:ok, sample} = TuningFork.Sample.Font.sample("0040_JCLive_sf2_file", 60)
Summary
Functions
Returns a specification to start this module under a supervisor.
Forget every font loaded.
The zone's recording as a TuningFork.Sample, decoded through
TuningFork.Sample.Decode when it is a compressed file. index names it in the cache.
Fetch, decode and keep the font name; :ok when it is there, {:error, reason} when not.
Whether the font name is loaded.
The zones written in a webaudiofont file, undecoded. {:error, reason} for text that is
not one.
Start loading the font name in the background and return at once.
The recording to play midi on the font name, decoded and kept once fetched.
Fetch font files from url instead of Strudel's host.
The zone of zones covering midi, or nil.
Types
@type zone() :: %{ low: integer(), high: integer(), root: float(), rate: pos_integer(), loop: {non_neg_integer(), pos_integer()} | nil, data: {:file, binary()} | {:pcm, binary()}, sample: TuningFork.Sample.t() | nil }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear() :: :ok
Forget every font loaded.
@spec decode(zone(), String.t(), non_neg_integer()) :: {:ok, TuningFork.Sample.t()} | {:error, term()}
The zone's recording as a TuningFork.Sample, decoded through
TuningFork.Sample.Decode when it is a compressed file. index names it in the cache.
Fetch, decode and keep the font name; :ok when it is there, {:error, reason} when not.
Whether the font name is loaded.
The zones written in a webaudiofont file, undecoded. {:error, reason} for text that is
not one.
@spec prefetch(String.t()) :: :ok
Start loading the font name in the background and return at once.
@spec sample(String.t(), number(), keyword()) :: {:ok, TuningFork.Sample.t()} | :loading | :error
The recording to play midi on the font name, decoded and kept once fetched.
Options
:wait— whether to fetch and decode a font not loaded yet, defaulttrue. Withfalsethat starts in the background and the answer is:loadinguntil it is done
:error for a font that cannot be fetched or a note no zone covers.
@spec source() :: String.t()
Where font files are fetched from; source/1 changes it.
@spec source(String.t()) :: :ok
Fetch font files from url instead of Strudel's host.
The zone of zones covering midi, or nil.