Mx.Sampled (mx v0.1.0)

Copy Markdown View Source

A sampled instrument: recordings of an instrument one key at a time, often at several strengths and in several takes, played as a part plays a synth.

A folder's files give their note, strength and take in their names, as VCSL names them: "MBira4_pluck_Main_C#3_2_50_100_rr5.wav" is C#3, "BDrumNew_hit_v5_rr1_Sum.wav" strength 5, take 1. The name is split at underscores, spaces and hyphens, and a word such as C#3 or Bb2 is the note, v or vl and a number the strength, and rr and a number the take. Files of one note and strength are the takes of one key, in the order of their take and then their name.

A note plays the key nearest to it, the lower one on a tie, at the rate that brings it to the note's pitch; vel picks a strength, the softest at 0 and the hardest at 1, spread evenly over the key's strengths.

Summary

Functions

The note, strength and take a file's name carries, each only when it carries one.

Reads the instrument's files into its keys, or returns {:error, message} naming the folder or the file.

The instrument whose recordings are in the files of folder, a folder of a GitHub repository as {:github, repo, ref, folder}, or listed as {file, note: note, strength: strength, take: take}; its files are read by load/1. A listed file is a path or {:github, repo, ref, path}, and what it does not give is read from its name.

Whether a sampled instrument takes an option.

The takes of the key and strength a note or :own_note at vel plays, with the rate it plays them at, or {:error, message}.

Functions

describe(name)

The note, strength and take a file's name carries, each only when it carries one.

load(sampled)

Reads the instrument's files into its keys, or returns {:error, message} naming the folder or the file.

new(folder)

The instrument whose recordings are in the files of folder, a folder of a GitHub repository as {:github, repo, ref, folder}, or listed as {file, note: note, strength: strength, take: take}; its files are read by load/1. A listed file is a path or {:github, repo, ref, path}, and what it does not give is read from its name.

option?(option)

Whether a sampled instrument takes an option.

pick(sampled, note, vel)

The takes of the key and strength a note or :own_note at vel plays, with the rate it plays them at, or {:error, message}.