Two new features: 16x2 screen support with I2C and randomizing samples

David Hilowitz posted Nov 14 '16, 23:41:


I've made a fork of Samplerbox that adds two new features:

  1. Support for randomizing samples
  2. Support for 16x2 display's via I2C.

You can find the fork here:

Randomizing samples

You can now have multiple versions of the same sample. In order to specify an alternate version of the same sample, you number them and specify the %seq keyword. For example, let's say you have a sample set that contains three versions of A3 as follows:


You would specify a definition.txt that looks like this:


Each time the note A1 is hit, SamplerBox will choose randomly between the different A1 samples (making sure not to repeat any two consecutively).

16x2 Display with backpack

This code works with Hitachi HD44780 16x2 displays with PCF8574 backpack. These are super cheap ($6.00, including shipping) on eBay. In order to get this to work, you have to set the bus address in the I2C_16x2DISPLAY_ADDR variable of The address differs depending on which version of the backpack you have: If you have the PCF8574T, the default I2C bus address is 0x27. If you have the PCF8574AT the default I2C bus address is 0x3F.

A handy set of utilities called I2CTools are used to probe the I2C bus. These can be installed with:

    sudo apt-get install i2c-tools

You can figure out the bus address for your device by doing this:

    sudo i2cdetect -r 0

Reference about these displays:

AlexM posted Nov 14 '16, 23:56:

Hey David - these are two very useful additions! The sample randomizing works like the NNXT device in Reason which makes me happy :) and I'm going to order a backpack right now!

David Hilowitz posted Nov 29 '16, 19:27:

I've just updated the codebase for this. Fixes a few small bugs. Also, it now displays when a sample is still loading.

AlexM posted Dec 1 '16, 10:33:

Hey David - I just merged your feature into my development:
(I've split my files up into modules because I've added too many features to be manageable in one file)

I'll do some further testing over the weekend. Very cool feature!

AlexT posted May 4 '17, 20:41:

Hello David,
I implemented your code for the 16x2 Display and it works fine except for the time while samples are loading it shows a very distorted screen which can only be read with some fantasy;) Did you had the same Problem?
Secondly do you know a way how i can use the second line of the display to show the playing sample?

Greetings Alex


  (not published)
  I want to post as guest