mx.samples: like mr.coffee or mr.radar, but for instrument samples.
us as a keyboard instrument or in another script. mx.samples provides an accessible way to utilize the vast trove of free instrument sample libraries. for instance, you can load in a piano that has been sampled on multiple dynamics and variations and key releases.
the core of the script + supercollider engine handles the voices and the instruments. you can have unlimited samples on disk because samples are loaded dynamically - only loading into memory when needed (max 200 samples can be loaded though). no latency on loading because it will load in the background (and use the closest pitched sample in the meantime).
my motivation for this script was to have a really nice sounding piano on the norns. also i wanted to be able to have a library of samples that works well with tmi (see studies/study1.lua
and demo above) but can also be used for future projects in the idea galaxy.
a massive thank you to @zebra for helping me post-process the UofI piano samples - there is a great script available to "de-pop" samples that had glitches in recording, thanks to that work. also this project wouldn't be possible without the generosity of the folks submitting their samples to be used freely at pianobook.co.uk and at the University of Iowa Electronic Music department.
- norns
- midi controller OR use in a script
mx.samples can be used as a keyboard (selecting sound+parameters via menus) or as a library (selecting sound+parameters via code).
you can use mx.samples as a keyboard. just plugin your midi keyboard, open the script and choose a sample. samples are available to download (processed by me, you can process your own too - see below).
there are a bunch of effects (filters / delay) and options (tuning, down-sampling, playing releases, velocity scaling) available from the parameters menu PARAMETERS -> MX.SAMPLES
.
"warming" up the keyboard: the very first note you play will not "play" (known bug) because it is loading the sample. every subsequent new note will re-pitch the loaded sample or it will load in a sample for that note to be used the next time (so no latency from load). this means that you can get the best sound by playing the notes you want to play once before you play them.
you can use mx.samples as a lua library for your project (see demo above). the api is pretty simple to include this into another script if you want a bunch of different voices. (another goal here - to use with tmi). instruments are loaded dynamically so you can add as many as you want.
see study1.lua for an example that uses tmi to do the sequencing.
basically the syntax would be:
mxsamples=include("mx.samples/lib/mx.samples")
engine.name="MxSamples"
skeys=mxsamples:new()
-- play an instrument
skeys:on({name="ghost piano",midi=60,velocity=120})
skeys:on({name="box violin",midi=42,velocity=120})
-- turn them off
skeys:off({name="ghost piano",midi=60})
skeys:off({name="box violin",midi=42})
the parameters can be added into the on
function as well:
skeys:on({
name="ghost piano",midi=60,velocity=120,
attack=1,
release=3,
-- every parameter in the menu is available here
})
this script will allow you to download samples that i've already processed. in theory you can use any kontakt / vst sample pack if you have access to the raw audio.
in the samples/
folder there is a utility script convert_samples.py
that will try to convert raw audio sample sets. ideal candidates have filenames that include:
- a note value (a3, f#4)
- if there are multiple dynamic levels, a dynamics value (pp, mf, f)
sample packs with different file naming conventions may need some manual processing (or script changes) to be processed. in particular, check whether the sample pack contains different versions that should be separated before running the script. for example, there might be both a "clean" version and a "distorted" version bundled together.
usage is python convert_samples.py $SAMPLE_FOLDER $OUTPUT_FOLDER
.
the current samples are from the following sources, which are free and do not restrict to distributing them for this purpose:
- The University of Iowa Musical Instrument Samples database which "may be downloaded and used for any projects, without restrictions".
- the pianobook which states that "There are NO restrictions on their use (except selling them on as your own samples)"
;install https://github.com/schollz/mx.samples