Random Sampler


Current Version: 2.5.1 View Changelog

JK's Random Sampler provides an easy and compact way to add variety to patches that use sampled audio. Load up to 8 sound files into the sample window, then send an impulse to the trigger input to randomly choose and play any one of the loaded sounds. For further variation, controls are provided to adjust the randomness of the six sound parameters that change each time the sound is triggered.

JK's Random Sampler was created as a solution to the need for quick randomization of samples within a compact interface. It was originally intended as an easy way to add variation to drum sequences, but like with most things modular, its uses are whatever you make them. There's no reason you can't load any sort of sound into the device, using it for melodies, textures, or whatever else you might like. Alternately, try loading a few different drum sounds to turn the module into a simple (though perhaps brainless) random drum sequencer. You could even flirt with the dark side and trigger at audio rate to turn this thing into a dirty granular noise generator where the controls affect the flavor of the dirt (yum).

NEW Demo video for Version 2.0!

OLD Demo video


Sample Window

Left-click anywhere in the window to open the file browser. Choose a sound file (.wav, .ogg, .mp3, or .aif) and it will load into the next empty sample slot (highlighted slot has no effect on this). Dragging and dropping a sound file into the window yields the same result. NOTE: If the highlighted sample has an invalid path (see below) then the chosen file will replace this sample (the current path name will be displayed in the file chooser title as a potentially helpful reminder).

Left-click + Ctrl, when highlighting a loaded sample, to replace that sample with the one listed next in the same directory.

Left-click + Ctrl + Shift, when highlighting a loaded sample, to replace that sample with the one listed previously in the same directory.

Left-click + Alt anywhere in the window to load a random sound file from the last used directory.

Left-click + Alt + Shift, when highlighting a loaded sample, to load a random sound from the same directory as the highlighted sample. (Potentially useful for when you have samples loaded from different folders.)

Right-click to open the drop down menu.

Right-click + Ctrl to remove the selected sample/path from the sample window.

Right-click + Ctrl + Shift anywhere in the window to remove all samples/paths from the sample window.

Right-click + Alt to preview the selected sample. NOTE: This overrides normal module playback for the duration of the previewing sample. You can also right-click + Alt again to stop the preview immediately.

Drop Down Menu

Copy samples will copy the list of sample path names in the current module to a clipboard, and Paste samples will append the path names stored in the clipboard to then end of the sample list (or as many as can fit, if less spaces are available). This also works between separate instances of the Random Sampler. NOTE: This functionality only copies and transfers path names, not actual sample data, and performs sample loading on new files.

Save mode: path name is selected by default. This keeps loaded sounds on disk, and reloads them each time the module is loaded based on the path names saved with the module.

Save mode: sample data offers the option to save the loaded audio data with the module itself in presets and patches. This allows for transferring patches between systems without worrying about having the correct sound files.

Key combo quick reference brings up a helpful reminder showing all valid mouse and key combinations for the sample window.

File info displays a message box containing basic information about the selected sample.

Further Notes on the Sample Window

In data mode, invalid path names are preceded by an asterisk (*) as a reminder. Remember, the data is still stored internally, so the sample will still play as normal, but none of the path-based functionality (copy/paste, load next, load random, etc) will work.

In path mode invalid paths are preceded by "???" to indicate that the path is invalid, and nothing will play since nothing could be loaded. However, the path name will be held for your convenience until replaced or deleted (note that if left, these essentially empty slots can still be triggered, but will naturally result in silence).

Parameter Section

Six aspects of playback are available for random variation or CV input.

  • Volume (Vol): A multiplier for the overall loudness of playback. Maximum range: 0% (silent) to 150% (boost by half).

  • Decay: A percentage of the length of the sound (minus start offset) to use as the length of a linear decay envelope. Maximum range: 0.1% (extremely short) to 100% (no decay).

  • Start: An offset, as a percentage of total length, of where to start playback of the sound. Maximum range: 0% (start of the sound) to 99% (nearly the end).

    • In the menu button accessible at the bottom right of the module, the first submenu offers a choice between using default fully random offset ("none") or instead that value quantized to set number of divisions (4, 8, or 16). Among other uses, this option provides a quick and easy way to chop beats and and other loops. Note: the quantization happens as the last step in the process, after all randomization settings have been applied and offset value calculated.

  • Pitch: A shift in semitones by which to resample the sound using cubic interpolation. Maximum range: -24 semitones to +24 semitones.

    • In the menu button accessible at the bottom right of the module, the second submenu offers a choice of either the default random range operation or standard realtime V/Oct control. Note 1: the V/Oct option completely overrides the random settings, giving complete control of pitch to the control voltage. Note 2: the V/Oct option is only available when a jack is connected, and the mode will reset to the default random range mode if the jack is disconnected.

  • High Pass Frequency (HP): Frequency value for a 4-pole high pass filter. Maximum range: 0 Hz to 9000 Hz.

  • Low Pass Frequency (LP): Frequency value for a 4-pole low pass filter. Maximum range: 100 Hz to 20000 Hz.

Parameter Controls

For each of the six parameters there is a set of controls and an input jack. On triggering a sound, if there is no cable attached to the parameter's jack, a value is generated for the parameter based on the control settings.

The left white knob is the minimum allowed value, while the right white knob is the maximum allowed value. These define the active range of the parameter values. NOTE: If you only use these two knobs, the module should function exactly as it did in its previous version, simply choosing a random value within the set range.

The blue knob is the "center" value, and the black knob is a "stickiness" setting. Stickiness is a percentage of how likely the parameter value with be set to the center value rather than a random value. At 0%, you have a fully random parameter, while at 100% the center knob acts as a direct control of the parameter with no variation.

The toggles refer to the chosen randomness distribution. U stands for a uniform distribution, which means any value in the set range has an equal chance of occurring. N stands for a normal distribution (or Gaussian, if you want to sound smarter). In non-math terms, a normal distribution means values tend to cluster more around a middle value (the "mean") and occur less frequently the farther away you get (which, depending on your intentions, can be more musically useful). When set to normal distribution, the center knob also defines the mean.

Attaching cables to any CV input jack changes how that parameter chooses its value on trigger. Min and max instead define the range of values that a 0 to 5 V input signal gets mapped to (outside values will wrap, i.e. 7 V becomes 2 V, -2 V becomes 3 V). Stickiness will now refer to the likelihood of the value actually being set to the CV value - turn it to 100% for fully non-random CV control or 0% to completely ignore the CV input and choose based on the settings as above, though with the CV value used as the center value. The actual center knob has no purpose when a jack is connected.

Also, note that min, max, and center knobs are self-correcting, in that minimum <= center <= maximum is always maintained.

(Have a look at the third image if you need a better idea of how the controls work.)

Bottom Section

  • Trigger In: Accepts any input. Will trigger sample playback when input rises from 2.5 or less to above 2.5 Volts. Typically triggered with a clock signal, sequencer gate output, or LFO.

  • Sample: Overrides random sample choice and instead chooses the sample based on CV input voltage at the time it receives a trigger. Expected input range is 0 to 5 V (though values outside this range are wrapped). The input value is then mapped evenly across however many samples are loaded at the time.

  • Left and Right Outs: Sends audio output in standard -5V, 5V range. For usability with mixed use of mono and stereo samples, mono samples are automatically output to both left and right channels.

  • Option Menu: Settings for start offset quantization (explained above) and pitch mode (explained above). Note that the tooltip will report the current state of each of these settings.

Top Controls

  • Attack: The knob in the top left corner controls a short attack envelope applied to each sample upon triggering. Can be set anywhere from 0 to 500 ms.

  • Release: The knob in the top right corner controls a short release envelope applied to a sample when it is stopped by another the triggering of another sample. Can also be set from 0 to 500 ms.

  • For these fades, there is an internal 8 voice-polyphony to allow for generally smoother transitions between overlapping samples.

Further Notes on Functionality

Once triggered, sounds will play to the end, with only a few exceptions. If another sound is triggered, the current sound will enter its release phase, and stop in 0 to 500 ms. If decay time is shorter than sample length, the sound will stop when its output level reaches zero at the end of its decay envelope. Removing a sound from the sample window while it is playing will also stop its playback.

Reset and Randomize affect only controls, not the sample window. Variations also only apply to control settings; loaded samples will not change. Both patches and presets will save loaded samples.

As a final reminder, remember that by default only the sample paths are actually saved, rather than the audio data itself - this can be changed in the right-click menu.


Version 2.5.1

  • Fixed alignment of window text and highlighters.

Version 2.5

  • new right-click drop-down menu for sample window:

    • copy sample list to clipboard

    • paste sample list from clipboard (appends to end of existing list assuming there is room)

      • note that this also works between separate instances of the sampler module

      • also note that this only works with for valid path names, internal audio data is not copy/pasted

    • save mode option (data vs path) moved to this menu

    • quick reference: a message box showing all valid mouse and key combinations for sample manipulation

    • file info: shows a message box with basic information for the selected sample

  • changes to old left-click and right-click behavior to accommodate the new dropdown menu (again, also available in right click menu's quick reference)

    • left click:

      • load new file from chooser (or replace bad path file - see below)

      • CTRL: load next sample in folder

      • CTRL + SHIFT: load previous sample in folder

      • ALT: load random sample from last used folder

      • ALT +SHIFT: load random sample from selected sample's folder

    • right click:

      • drop-down menu

      • CTRL: delete selected sample/path

      • CTRL + SHIFT: delete all

      • ALT: preview selected sample (temporarily overrides normal playback - wait until end of file or click again to stop preview)

  • sample path display updates:

    • In 'data mode,' invalid path names are now preceded by an asterisk as a reminder. Remember, the data is stored internally, so the sample will still play as normal, but none of the path-based functionality (load next, load random, etc) will work.

    • In 'path mode,' invalid paths are preceded by '???' to indicate that the path is invalid and nothing will play, but the path name will be held for your convenience until replaced or deleted (note that if left, these essentially empty slots can still be triggered, but will naturally result in silence)

    • Sample/path replacement: While normally a left-click brings up a file chooser to add a sample to the list, if the highlighted sample's path is invalid, this will instead bring up a chooser allowing the user to REPLACE the current sample/path with one chosen from the file system (note that the current path name will be displayed in the file chooser title as a potentially helpful reminder).

  • adjustable attack and release with actual (limited) polyphony!

    • top left declick button is now an attack envelope (fade in) knob ranging from 0 to 500 ms

    • top right delclick button is now a release envelope (fade out) knob ranging from 0 to 500 ms

    • previous versions used a hacky method of declicking sudden level changes on a retrigger, but now we have actual internal 8 voice polyphony for some nice smooth fades between triggered sounds

Version 2.2

  • NEW: Button on bottom right of module opens a menu with new settings. (Current settings viewable in tooltip.)

    • Start offset divisions: Random value can be quantized to none (default), 4, 8, or 16 equal time divisions.

    • Pitch mode: Select between default random pitch operation ("range") and v/oct pitch control.

    • Save mode: Choose to save path names of samples or save sample data with the module.

  • NEW: Two new sample window mouse/key functions:

    • Right-click + Alt: load previous sample in same directory

    • Right-click + Ctrl: load next sample in same directory

  • FIX: Fixed bug where 5V input to Sample jack caused processing issues.

  • FIX: Fixed related bug where sample input CV was not wrapping to expected sample slot.

  • FIX: Fixed issue where multiple files would fail but only the last message box would appear. Message box now lists all files that failed to load or whose paths are no longer valid (for those stored internally).

  • Small adjustments to end declick function. Should sound better in most cases.

Version 2.0

  • new CV in to optionally control which sample plays

  • new CV ins to optionally control each parameter

  • randomness controls: center value, "stickiness," and distribution (see description/documentation for details)

  • declick start toggle (2 ms attack/fade in)

  • declick end toggle (5 ms fade out/crossfade)

  • pitch range extended from -24 to 24 semitones

  • currently playing sample is now highlighted

  • fixed crash: now shows error message if attempting to load file with non-standard file name characters

  • name changed to "JK's Random Sampler"

  • internal tweaks, fixes, and adjustments

Version 1.0

  • initial release

Post any comments, questions, concerns, feature requests, or bug reports on the forum or send an email here. And finally, have fun with it!