Making other types to fit your requirements
The image now supports up to at least 3B+.
Configuration has become easily adaptable, so there are various options without need for hacking:
I'm now using a PI3-B+ with HiFiBerry and indicator LEDs, boxed in a standard HiFiBerry metal case. So the DIY drilled down to solder extra header (mind to use "Short Feather Male Headers" as the space is limited) on the HiFiBerry and attach two LEDs from an "Adafruit LED Sequins - Multicolor Pack of 5" (they have builtin 100 Ohm resistors, so no extra components necessary). See pictures on the right for inspiration.
- PI audio
- USB Audio
- I2S audio = HiFiBerry compatible high fidelity DAC / "audio hat"
- Pimaroni Audio Pirate (I2S audio, a color LCD and 4 buttons)
- I2C 7 segment display
- HD44780 compatible LCD display's (direct GPIO like in the trial as well as
The coding for the I2C version supports a 4 line display.
- 128x64 OLED display: SSD1306 & SH1106(with buttons) via SPI
- LED indicators
- DIN cables support using DIY direct midi.
- Single-board microcontrollers like Raspberry Pi Pico and Arduino.
For such boards there are multiple options by nature :-)
- If board uses serial MIDI, they are "just midi devices".
Being at this level of DIY, you could even go for
direct connecting the serial interfaces
of the two (with optocouplers if still needed) to create an efficient one-box solution.
- If board uses USB, they may connect to samplerbox using the USB port as a mix of
midi device as well as a storage device (similar to a stick/thumb-drive containing samples).
Samplerbox can't deal with multiple usb storage devices (yet).
The bypass for now: if a the usb connected usb storage does not contain sample sets,
samplerbox assumes "no USB samples" and takes it's samples from SD storage -
in short: samples on stick are impossible.
Royal solution: enhance the microcontrollers logic (they usually have a boot selection button)
to disable the storage device behaviour when functional.
I had to remove the plastic cover from the jumper wire connectors to make them fit between header and box; space was 2 mm short on my RCA version. The XLR version will be easier in this respect as well as be more robust.
Things making a man humble: the biggest challenge was to get the LEDs solidly positioned under the heat openings, while keeping those open. Solved with a corner part of a leftover plastic wrapping pinned between two spacers and case and duct tape on strategic points.
On request I've introduced the "USE_48kHz" parameter in the configuration.txt to support 48Khz DAC's not supporting 44100Hz, see FAQ.
Commandline access and debugging
As samplerbox is a stripped but basically normal Raspberry implementation, so:
You can stop the automatic running script with
- Direct acces via USB-keyboard and display (HDMI or video) if plugged in before poweron, should always work. If it doesn't, either your SD card is corrupt, your PI is not supported (or broken, but that's rare) or the HDMI cable is poor (yes, I've tested that by coincidence).
- Remote access is possible via available network connections (see GUI usage) with ssh.
The ethernet(cable) port is default configured to receive its address from the network it connects to and will publish its hostname(samplerbox) to the dhcp/dns network device.
- SSH software for console access: PuTTY (etc..) and the linux ssh command.
- SSH software for file transfer: WinSCP, Filezilla (etc..) and the linux sftp command.
- In all cases: uid/pwd=root/root gives you access to the commandline of the linux system.
systemctl stop samplerbox
All filesystems are mounted read-only to allow blunt poweroff and removal of USB storage.
To get the partitions in update mode (use what you need):
mount -o remount,rw /
mount -o remount,rw /boot
mount /dev/mmcblk0p3 /samples
.. and if USB storage is present:
mount -o remount,rw /media
Mind that having a filesystem in RW mode requires the box to stopped with a poweroff (or reboot) command to avoid corruption.
Also mind that the samplerbox's internal clock is reset every reboot, so if you want your file time stamps to be correct, you have to set the date (using UTC time!!) with:
Starting the script by hand to see the informational and error messages:
On first invocation it can show GPIO errors you can ignore (the systemctl stop caused the GPIO to remain active). You can stop again with <ctrl-c> and any subsequent starts won't have these GPIO errors anymore as <ctrl-c> is a controlled stop.
To check your topology you can use the script testdev.sh (or just pick the necessary commands from it :-).
If you want to check what your midi device exactly sends, you can use the midimon.py program or the midimon.sh script in the /root directory
(for the script the running samplerbox should be stopped).
For more specific debugging, you can uncomment some of the print statements in the scripts (or add your own).
Sometimes it is however more useful/convenient to directly monitor the device via your PC. If you don't have a midi monitor available on there, you can use the tools mentioned above (the script only works in Linux and requires "alsa-utils" and "dialog" to be installed, both pretty standard packages). For Windows you might also use the small, free & easy Send SX when full midi dump is necessary.
If your USB stick and/or the contents don't show up in /media, you may have one of the issues described in the first dots of Some goodies.
In these goodies you may find more usefull stuff for debugging.
Enlarge the samples partition
Image on the right depicts the layout of the SD.
The exact size figures depend on both image version as well as how your OS/tool counts the bytes (1K can be 1000 or 1024).
The slack size can differ significantly as not all SDcards are equal (brand, disabled sectors etc), this is the reason for having this slack space: the image needs to fit on on any SD.
Your SD card is presumably larger than the image, but as the last used partition (samples folder)
is NTFS formatted from releases 2021 onwards, it can easily be enlarged without erasing any data.
On windows PC you can use the included diskmanager.
On linux the diskmanager varies per distribution.
As the image is MS-DOS MBR, commandline "fdisk" can do the job on Microsoft, Linux and MacOS - be it not as convenient.
Ofcourse it can be done from within samplerbox,
next instructions entered on the samplerbox commandline
will make the samples partition use the full SD capacity.
If you do this on your pc, adapt the statements to contain the correct device !!.
- Unmount the partition:
- Run fdisk:
- Check the SD's content:
Choose "p", you should see a screen like (sizes may vary):
Command (m for help): p
Disk /dev/mmcblk0: 1.9 GiB, 1977614336 bytes, 3862528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x67e24ed1
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 133119 131072 64M c W95 FAT32 (LBA)
/dev/mmcblk0p2 133120 3459071 3325952 1.6G 83 Linux
/dev/mmcblk0p3 3459072 3721215 262144 128M 7 HPFS/NTFS/exFAT
- Choose "d" and choose "3" to delete the last partition
- Choose "n" to create a new partition and make next choices:
- "p" to create a primary partition
- enter the startsector you got with the "p" command (may be the default)
- enter required size (or accept the default to use the full disk size)
- Choose "t" to change partition type and make next choices:
- accept the default partition (should be 3)
- choose "7" (HPFS/NTFS/exFAT)
- Choose "p" again to check...
- Choose "w" to write the changes to disk
- Unmount the partition:
- Expand the filesystem to the partition size
- Reboot again