Samplerbox Hardware with Raspberry PI

The Project Samplerbox is still activ. (2020-01-26)
I used the image and instruction from http://homspace.xs4all.nl/homspace/samplerbox/index.html

I have tried to use earlier versions in last years but it does not work as expected with my older Raspi 1.
I bought a Raspberry 3+  to test samplerbox with it. For now it works fine with the last image from Hans!

Samplerbox-rearside,
3 Buttons, 1 LCD, 4 USB-Ports, the ethernet-Port is hidden in the case.
Side-View, with Left Audio Out, Right Audio-Out, MIDI

Bill of material to build a Samplerbox:

  • Raspberry Pi 3+ ( perhaps newer works too)
  • Powersupply, 5V, 2.5 Amps or more
  • SD-Card
  • generic USB-Sound-Card – or DAC-Board PCM5102
  • USB-Stick to store Samples
  • Case for the Raspberry Pi
  • Optional:
    • MIDI-Board (DIN-Socket, 1x10k, 1x1k, 1x 220Ohm Resistor, 6N138 Optocoupler, 1 Diode)
    • USB-MIDI-Keyboard or MIDI-Keyboard with DIN-MIDI if the MIDI-Board is build
    • LCD Display 16×2 HD44780 (16 Pins)
    • 3 Buttons
    • Status-LEDs: 2 LEDs & 220Ohm Resistor

I didn´t buy a lot because I had already most things in stock. I used „Guttagliss“ – Hobbycolor plates to build a case and painted it with spray paint. Hobbycolor looks like plastic but is some more flexible and very easy to cut with a knife, could be glued, bend with the heatgun and painted. In the top of the case, I have cutted the holes for the LCD and the 3 Buttons. Finally I used a transparent acrylic-plate to cover to top. Finally, inside the case I used some layers of Hobbycolor-pieces to create some support structures to be able to fix the different circuit with woodscrews.

I created 3 circuit, first circuit to connect to all GPIO-Pins of the Raspberry PI and provides space for the PCM5102-Board.

Second a Circuit to hold the 3 Buttons and which has the width of the LCD. Both, button-board and LCD is mounted with four 3mm Screws and some layers of nuts to get the right distance to the top of the holes in the case.

Third circuit, and the last, is the MIDI-Converter, which transforms classical MIDI into 3.3Volts serial data. This board is the smallest and I have used a small circuit-board which is too small in my case because it has to be mounted very well and fixed with the case. The big DIN-Plug causes some force and this has to be managed with screws between DIN-Plug and the case.

If you would only test the software, the minimum would be Raspberry PI, a USB-Sound-Device which is compliant as Sounddevice for Linux and a USB-Keyboard. There is already one sound on the SD-Image.

My Result, – the view inside with the Circuits ( the MIDI-Circuit was added later)

, the background is the inside the case and is the backside of the top plate. The green Circuit is the LCD-Board. The board at the bottom is the board for the buttons.
The upper board connects to the Raspberry Pi and on its backside, there is the PCM5102-DAC and all the wired. The upper Breadboard is fixed by 4 screws. The 2 jacks on the right-side are the Audio-Output 1/4 inch, 6.3mm – jacks.

Backpanel of the case with some features for aircondition. The white and black stripes at the corner are „inside“ and are used to fix the screws from the side.

Wiring of the PCM-, LCD- and MIDI-Board with the Raspberry-Pi-GPIOs

The wiring through the Audio-Jacks is made with plastic jacks which connect the tip- and ring-contact to an outpoing pin if no plug is inserted in the jacks. That way, the upper jack is stereo if nothing is connected to the right-side-jack. The right-side-jack is a mono-jack, the left-side-jack is a stereo jack.

The MIDI-Circuit was tested with an LED, because I had to order the 6N138 and wanted to avoid any mistake.

Test MIDI-Circuit with LED first

Finally after testing, I was able to connect all cables.
Powersupply, Audio, MIDI-Keyboard, USB-Stick with samples, USB-Keyboard,

How does it sound? – exactly as the samples are. On the USB-Stick, for every instrument or „patch“, you need a folder which starts with a number.
Inside each folder, you have to store all needed samples for the patch and a definition.txt which declares the structure, placing of the samples etc.

The wave-files could contain Loop-Points to be able to play an area of the sample in a loop as long as you presses the key on the keyboard.
For short samples – or most string- or drum-instruments, it sounds more realistic to use a long sounding sample which simple fades out. After releasing the key, samplerbox will release these samples in a few milliseconds which mostly sounds natural.

The content of a definition.txt looks a bit like „code“ but is very „simple“ to declare for „simple“ instruments. Lets view the „code“.
To avaid load distorsion, I lower the gain for this instrument to 80% – 0.8.
%%velmode=accurate is more or less a standard which has to be defined.
The last line of my definition is something like a Regular Expression but much more easier. * covers all content in flexible length. %notename has to be something like C4, c4 or c#4 or C#4 but NOT Gb3 or G.
By default, the notation could be used as the notenames but only normal notes or sharp notes. As an alternative, „%notenumber“ could be used which is simply the MIDI-Notenumber, C4=60. %velocity could be used to provide a %velocity-Number to define WAV-Files when keys are hitted faster/stronger for loader notes and other WAV-Files for quite notes.
There are a lot more options available for the definition.txt which are described well in the internet.

%%gain=0.8
%%velmode=accurate
* %notename %velocity.wav

The definitions are made mostly for key-ranges without a specified border of the range. If you would like to define something for a specific key, that could be done with specific variables in the code:
kick.wav, %midinote=36

The Options per Sound are:
%notename
%midinote
%velocity

More Details are documented here, but this documents don´t cover the version from HANS by 100%!!
samplerbox.readthedocs.io/en/latest/Sample_Sets/

The Software-Image from Hans covers special files on the SD-Card! – /boot/config.txt and /boot/samplerbox/configuration.txt and some more…
These files provide the ability to define the used GPIO-Ports and are used to enabled the Serial-MIDI-Port. ( BT would be moved to miniuart to make the real UART available for the MIDI-Port via midi-uart0)
(The configuration-files are readable on the SD-Card on MAC and probably windows.)

Raspi3+ in config.txt I changed this:

enable_uart=1
dtoverlay=pi3-miniuart-bt
dtoverlay=midi-uart0

and removed from config.txt
init_uart_clock=2441406,
init_uart_baud=38400 in config.txt and

and remove this in cmdline.txt
bcm2708.uart_clock=3000000

MIDI-Controllers could be used to control all the effects or the select the patches. I am using an older Novation Launchkey MINI MK2 which does not provide Program-Change command. Therefore, I used the Controller-Configuration from HANS to remap 2 buttons on the launchkey to do so and a POT on the Launchkey to control the volume. All Configuration-Files are described here: http://homspace.xs4all.nl/homspace/samplerbox/SBconfig.html

What could You do better than I did?
– Try to push all connections to only 2 sides of the case. I have created connections on the left side for audio and MIDI and the Power-Plug is on the right side and USB-Ports on the top . That way, the Samplerbox takes too much place on my desk.
– create a stiffer case and a bigger circuit-board for the MIDI-Port. A MIDI-Port, shaking loosely inside the case wouldn´t be „pro“,
– Try to use the OLED-SPI-Display-Option, – my 16×2 LCD does not work well and shows agyptian characters when the Raspberry Pi is cold. My LCD is specified for 5 Volts but the data-pins of the Raspi provide 3.3Volts, this could be the problem. – but sometimes it works!?
– Don´t use litz-wires for the connection between the circuits. I had to rethink and rebuild the circuits and the case and had many issues with wires which created shorts or were simply disconnected.
– Test Your setup on a breadboard first
– Connect the LCD only with Data-Pins Data4-Data7, – the 8Bit-Mode is not supported by the version from HANS.

What I would do with the samplerbox?
I already own a Akai MPC2500, – which plays drumsounds well but not keyboard-sounds mapped to a keyboard. I own a Novation-Circuit too which has limited polyphony and I am thinking about to create 2 small samplerboxes to extend the MPC and the Circuit.
I already sampled a few instruments by using the MPC 2.0 Software (version 2.6 with the autosampler) and created samples of my mandolins and mandola by using garageband as the „recorder“.
I would like to use the Samplerbox as a small expander with Samples which I recorded or to provide drum-loops.
A further step would be a Arduino as a MIDI-Merger and Sequencer between the MIDI-Board and the Samplerbox. A Arduino-Nano or ESP32 could do that perhaps.

Things, which are not that good:
The documentation is not covering all different versions of Samplerbox. The Effectsettings are global and are not saved in the definition.txt for a single patch. But to be fair, all these effects are a great step forward for samplerbox.
The forum(s) is not splittet into different subjects. Most forum-posts are asking for help or saying that the sound is crappy – they only need the hint to lower the gain in definition.txt. That way, samplerbox-users are not in a real discussion in the forum.


Posted

in

by

Tags: