My SamplerBox Mod / Extended version

AlexM posted Nov 2 '16, 04:42:

Hey guys

Gee, SamplerBox has totally sent me down a serious rabbit hole! In short, I have taken Joseph's latest build, and implemented pieces from Hans and Erik, and added my own features. At the same time I have split the project into modules - my mouse's scroll wheel was getting a hectic workout!

Disclaimer: only been tested with a Raspberry Pi 3. This is also my first Python/RaspberryPi/git project, so go easy on me ;) I've learnt a tonne in the last few weeks, but I've still got a long way to go. Any feedback will be much appreciated!

This modification is very much a work in progress and is likely to be buggy - please bare with me! You will need a HD44780 LCD screen and an external USB DAC. Configurations may need to be made in and I'll work to make this less painful in the future. As I'm writing this I realise you'll need to edit to define the menu navigation controls (left, right, enter, cancel - from line 153). You can remap notes to act as these buttons. So, not quite a plug-and-play release here!


  • Voices within presets. Definable in the sample-set's definition.txt file using the new parameter %voice
  • Reverb (Freeverb)
  • Menu system. To navigate through settings
  • MIDI Mapping. Map master volume, reverb params, and voices to MIDI controls. More to come.
  • Setlist functions. Folders are now automatically detected and added to a setlist.txt file. The Reorder songs function allows you to reorder the sample-sets without affecting the actual folders.
  • System config. Currently these settings need to be edited manually via system config/config.ini. This will be managed in the menu system soon.

Manual installation instructions and a more verbose description of the above features over on my GitHub page. These are "start-from-scratch" instructions.


Where to start?! So many ideas!

ADSR (sample-level attack, decay, sustain and release), silent sample loading (quietly load the next sample-set in the setlist without disrupting playback), completed MIDI Mapping features, OLED display, volume/amp, real-time limiter, ability to access filesystem from a PC...

Erik posted Nov 2 '16, 14:38:


Did you implement my better velocity handling?
I'm not active anymore, but still follow this. Pity you did not add my backingtrack option.

things I would add:

Multiple sample loading:
Load the samples until memory is full and then unload the last sampleset that is used until there is room for the new set. This way the most used samples are always loaded. I have a nice 200MB piano, a 50MB CP80 and a 50MB Wurly (converted from sf). That would fit nicely in 1GB. Together with a few other smaller samples.

Turn off Freeverb completely (to get extra sounds)

In my version it was possible to get an overflow if you made glissandos with the sustain pedal...

Nice to have the files split up. Perhaps I'll dive in again in the future.
Good luck and have fun!

HansEhv posted Nov 3 '16, 00:06:

H Alex,
I still have to dig in the nitty gritty details, but first look: impressive & interesting!

As for the wishlist/ideas you're thinking of: my current published version has a way to solve the R in ADSR by means of the %%release parameter and also contains the accurate velocity that Erik refers to (Hi Erik, good to see you're still interested!).
The ADS is (in my opinion) a synthesizer thing which is solved in a better way by using samples .... unless using very simple ones like the saw.
It also contains solutions to control volume on the first two of the three usual control points:

  • input with gain parameter (to adjust input sensitivity to the sample level). By definition.txt as we're talking about the sample set.
  • output with the alsa mixer (to adjust output level to the input level of amplifier/stage mixer). By buttons as we're talking box-2-box interfacing.
  • and within this range: real time volume with the midi volume control. By knob/slider on your controller as we're talking about live playing.

In short time I will release a major update containing features like pitchbend, chords, panic/notesoff, midi volume control and last but not least voices (gratefully copied from
It's based on the Pi3 supporting ISO Joseph has published, so I assume it will work now on Pi3 (I own Pi2 so can't verify).
I also changed to RTMIDI2 as I'm using multiple midi sources - you may recognize this from :-) So thank you
Alsa mixer has been made optional to facilitate people "not wanting to implement all hardware".

Under the surface I also changed the logic to generate missing notes samples.
In original version this was based on the first note below. Now it's done from the nearest note. This improves quality and also ensures that notes below the lowest sample can be played. So the saw sample can go deep now.

Just telling you, to prevent spending time on thinking about features that you can copy (as you're welcome to do so) :-)

HansEhv posted Nov 3 '16, 00:10:

Sorry, lost part of a sentence: voices was copied from your idea of course :-)

AlexM posted Nov 3 '16, 09:56:

@Erik - I started with your SamplerBox2 and have kept much of its features. I plan to add backing tracks and tone control back in when I have time (I couldn't get tone control to work at first, so I just put it aside for the time being)

Multiple sample loading: yeah this is what I was thinking, although I have a feeling there'll be audio glitches while there's loading going on. Perhaps all sample-sets but the current one load slowly. Or maybe at startup you can play directly from the disk while samples are loaded into memory..? Would want to keep the startup time to a minimum

Freeverb: Unless I'm getting the wrong numbers, I don't think my Pi3 ever goes above 25% CPU usage. Still, the ability to turn off freeverb has its benefits, but probably just a lower priority right now :)


%%release: ah yes, I am aware of this - which is great! But it would be cool to have the ability to alter the release for samples within a voice, not just globally. I can think of a number of instances where this would be useful. It's not going to be useful for everyone, but to have it there would be cool.

ADS(R): yeah this is definitely a synth thing. Although, I've always found ADSR on Reason's NNXT sampler device really handy. It also means you don't have to prepare your samples too meticulously (easily preparing samples and loop points is a whole other problem for another day).

Playing below lowest sample: you beat me to it!

I look forward to your major update! I'll have a go merging it into mine. Cheers!


  (not published)
  I want to post as guest