One-shot Sampler


One-shot is a free, minimalist one-shot sample player triggered by MIDI notes. It is a Pd (Puredata) patch so it will run on Mac, Windows and Linux. It is useful for triggering a folder of sound effects from a MIDI keyboard within a minimum of setup. Includes safety features such as adjustable debounce and "all notes off".

Samples are stored in a folder named samples. They are mapped to MIDI notes in a text file called keymap.txt and settings are stored in settings.txt. Since One-shot is configured using only text files, the GUI is not required. In fact, this makes it rather well suited to running on a single-board screen-less computer such as a Raspberry Pi, if only Pd 0.48 would run on such a computer (currently, Pd 0.47 is the latest version of Pd that is available for the Raspberry Pi).

One-shot preloads samples into RAM on startup for responsive triggering.



Download One-shot from the One-shot GitHub page.


First download and install Pd if you don't already have it. Then download and unzip the One-shot files from the One-shot GitHub page.

  1. Place samples in "samples" folder (no spaces in sample file names).
  2. Map MIDI notes to specific samples in the "keymap.txt" file.
  3. Adjust options in "settings.txt" file.
  4. Load Pd and setup audio and MIDI ("Media" menu -> "Audio Settings...", then "Media" menu -> "MIDI Settings..."); and confirm audio and MIDI works ("Media" menu -> "Test Audio and MIDI...").
  5. Open patch (file called One-shot x.x.pd) in Pd (File menu -> "Open").
  6. The "Ready" toggle box will become ticked when everything has loaded okay. If it doesn't (it may take a while if you have several long samples), check the Pd window for error messages ("Window" menu -> "Pd").

If you update "keymap.txt" or "settings.txt", or change any samples whilst One-shot is running, click "Reload" or restart the patch.


keymap.txt defines the mapping between incoming MIDI notes and samples.

Each line has two elements separated by a space: MIDI note number (middle c = 60) and sample file name. The sample file name must not include any spaces. The sample file will be played when the corresponding note on message for that number is received.

Example keymap.txt contents:

60 pings1.aiff
62 pings2.aiff
64 pings3.aiff
65 pings4.aiff
67 stereo_a.wav


Each line contains a setting name and a setting value separated by a space.

Example settings.txt file contents:

all_off_key 59
fade_dur 250
midi_channel 0
velocity_sensitive 0
debounce 0
same_key_twice 1
voice_stealing 0
Setting Value Description
all_off_key Note number All notes are faded out in fade_dur duration (see below) when this note is received.
fade_dur Duration in milliseconds Fade out time after all_off_key has been received.
midi_channel MIDI channel number 0 - 16 Channel 1 to 16 or 0 = all channels received.
velocity_sensitive 1 = yes, 0 = no Enable/disable velocity sensitivity.
debounce Debounce duration in milliseconds Avoid double-triggers within debounce duration, 0 = debounce off.
same_key_twice 1 = yes, 0 = no Allow/disallow the same key to trigger its sample twice in succession.
voice_stealing 1 = on, 0 = off If all voices are busy, allow/disallow new MIDI notes to steal voices.


To Do

Wish List


One-shot is copyright 2017, 2018 Jonathan Green.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see