{"id":318,"date":"2020-01-26T12:47:30","date_gmt":"2020-01-26T11:47:30","guid":{"rendered":"http:\/\/www.hman-projects.de\/?p=318"},"modified":"2020-01-27T20:32:17","modified_gmt":"2020-01-27T19:32:17","slug":"samplerbox-hardware-with-raspberry-pi","status":"publish","type":"post","link":"https:\/\/www.hman-projects.de\/?p=318","title":{"rendered":"Samplerbox Hardware with Raspberry PI"},"content":{"rendered":"<p>The Project Samplerbox is still activ. (2020-01-26)<br \/>I used the image and instruction from <a style=\"font-size: inherit;\" href=\"http:\/\/homspace.xs4all.nl\/homspace\/samplerbox\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/homspace.xs4all.nl\/homspace\/samplerbox\/index.html<\/a><\/p>\n<p>I have tried to use earlier versions in last years but it does not work as expected with my older Raspi 1.<br \/>I bought a Raspberry 3+\u00a0 to test samplerbox with it. For now it works fine with the last image from Hans!<\/p>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"640\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/View_USB-rotated.jpg\" alt=\"\" class=\"wp-image-333\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/View_USB-rotated.jpg 480w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/View_USB-225x300.jpg 225w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><figcaption>Samplerbox-rearside, <br>3 Buttons, 1 LCD, 4 USB-Ports, the ethernet-Port is hidden in the case.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3744.jpg\" alt=\"\" class=\"wp-image-332\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3744.jpg 640w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3744-300x225.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><figcaption>Side-View, with Left Audio Out, Right Audio-Out, MIDI<\/figcaption><\/figure>\n\n\n\n<p>Bill of material to build a Samplerbox:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Raspberry Pi 3+ ( perhaps newer works too)<\/li><li>Powersupply, 5V, 2.5 Amps or more<\/li><li>SD-Card<\/li><li>generic USB-Sound-Card &#8211; or DAC-Board PCM5102<\/li><li>USB-Stick to store Samples<\/li><li>Case for the Raspberry Pi<\/li><li>Optional:<ul><li>MIDI-Board (DIN-Socket, 1x10k, 1x1k, 1x 220Ohm Resistor, 6N138 Optocoupler, 1 Diode)<\/li><li>USB-MIDI-Keyboard or MIDI-Keyboard with DIN-MIDI if the MIDI-Board is build<\/li><li>LCD Display 16&#215;2 HD44780 (16 Pins)<\/li><li>3 Buttons<\/li><li>Status-LEDs: 2 LEDs &amp; 220Ohm Resistor<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>I didn\u00b4t buy a lot because I had already most things in stock. I used &#8222;Guttagliss&#8220; &#8211; 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.<\/p>\n\n\n\n<p>I created 3 circuit, first circuit to connect to all GPIO-Pins of the Raspberry PI and provides space for the PCM5102-Board. <\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>My Result, &#8211; the view inside with the Circuits ( the MIDI-Circuit was added later)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"640\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3727-rotated.jpg\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3727-rotated.jpg 480w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3727-225x300.jpg 225w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><figcaption>, 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.<br>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 &#8211; jacks.  <\/figcaption><\/figure>\n\n\n\n<div class=\"wp-block-media-text alignwide\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"240\" height=\"320\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3728-rotated.jpg\" alt=\"\" class=\"wp-image-335\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3728-rotated.jpg 240w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3728-225x300.jpg 225w\" sizes=\"(max-width: 240px) 100vw, 240px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\"><img loading=\"lazy\" decoding=\"async\" width=\"250\" height=\"333\" class=\"wp-image-336\" style=\"width: 250px;\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3729-rotated.jpg\" alt=\"\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3729-rotated.jpg 240w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3729-225x300.jpg 225w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/p>\n\n\n\n<p>Backpanel of the case with some features for aircondition. The white and black stripes at the corner are &#8222;inside&#8220; and are used to fix the screws from the side.<\/p>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"240\" height=\"320\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3730-rotated.jpg\" alt=\"\" data-id=\"337\" data-link=\"http:\/\/www.hman-projects.de\/?attachment_id=337\" class=\"wp-image-337\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3730-rotated.jpg 240w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3730-225x300.jpg 225w\" sizes=\"(max-width: 240px) 100vw, 240px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"240\" height=\"320\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3723-rotated.jpg\" alt=\"\" data-id=\"338\" data-full-url=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3723-rotated.jpg\" data-link=\"http:\/\/www.hman-projects.de\/?attachment_id=338\" class=\"wp-image-338\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3723-rotated.jpg 240w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3723-225x300.jpg 225w\" sizes=\"(max-width: 240px) 100vw, 240px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/Connections_SBOX.001.png\" alt=\"\" class=\"wp-image-323\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/Connections_SBOX.001.png 1024w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/Connections_SBOX.001-300x225.png 300w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/Connections_SBOX.001-768x576.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Wiring of the PCM-, LCD- and MIDI-Board with the Raspberry-Pi-GPIOs<\/figcaption><\/figure>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>The MIDI-Circuit was tested with an LED, because I had to order the 6N138 and wanted to avoid any mistake.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3735-rotated.jpg\" alt=\"\" class=\"wp-image-330\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3735-rotated.jpg 640w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3735-300x225.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><figcaption>Test MIDI-Circuit with LED first<\/figcaption><\/figure>\n\n\n\n<p>Finally after testing, I was able to connect all cables.<br>Powersupply, Audio, MIDI-Keyboard, USB-Stick with samples, USB-Keyboard, <br><img loading=\"lazy\" decoding=\"async\" width=\"350\" height=\"467\" class=\"wp-image-331\" style=\"width: 350px;\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3741-rotated.jpg\" alt=\"\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3741-rotated.jpg 480w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3741-225x300.jpg 225w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/p>\n\n\n\n<p>How does it sound? &#8211; exactly as the samples are. On the USB-Stick, for every instrument or &#8222;patch&#8220;, you need a folder which starts with a number.<br>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.<\/p>\n\n\n\n<p>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.<br>For short samples &#8211; 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"826\" height=\"642\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/image-1.png\" alt=\"\" class=\"wp-image-340\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/image-1.png 826w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/image-1-300x233.png 300w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/image-1-768x597.png 768w\" sizes=\"(max-width: 826px) 100vw, 826px\" \/><\/figure>\n\n\n\n<p>The content of a definition.txt looks a bit like &#8222;code&#8220; but is very &#8222;simple&#8220; to declare for &#8222;simple&#8220; instruments. Lets view the &#8222;code&#8220;.<br>To avaid load distorsion, I lower the gain for this instrument to 80% &#8211; 0.8.<br>%%velmode=accurate is more or less a standard which has to be defined.<br>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.<br>By default, the notation could be used as the notenames but only normal notes or sharp notes. As an alternative, &#8222;%notenumber&#8220; 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.<br>There are a lot more options available for the definition.txt which are described well in the internet.<\/p>\n\n\n\n<p><code>%%gain=0.8<br> %%velmode=accurate<br>* %notename %velocity.wav<\/code><\/p>\n\n\n\n<p>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:<br><code>kick.wav, %midinote=36<\/code><\/p>\n\n\n\n<p>The Options per Sound are:<br>%notename<br>%midinote<br>%velocity<\/p>\n\n\n\n<p>More Details are documented here, but this documents <strong>don\u00b4t<\/strong> cover the version from HANS by 100%!!<br><a href=\"https:\/\/samplerbox.readthedocs.io\/en\/latest\/Sample_Sets\/\">samplerbox.readthedocs.io\/en\/latest\/Sample_Sets\/<\/a><\/p>\n\n\n\n<p>The Software-Image from Hans covers special files on the SD-Card! &#8211; \/boot\/config.txt and \/boot\/samplerbox\/configuration.txt and some more&#8230;<br>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)<br>(The configuration-files are readable on the SD-Card on MAC and probably windows.)<\/p>\n\n\n\n<p>Raspi3+ in config.txt I changed this:<\/p>\n\n\n\n<p>enable_uart=1<br>dtoverlay=pi3-miniuart-bt<br>dtoverlay=midi-uart0<\/p>\n\n\n\n<p>and removed from config.txt<br>init_uart_clock=2441406,<br>init_uart_baud=38400 in config.txt and<\/p>\n\n\n\n<p>and remove this in cmdline.txt<br>bcm2708.uart_clock=3000000<\/p>\n\n\n\n<p>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: <a href=\"http:\/\/homspace.xs4all.nl\/homspace\/samplerbox\/SBconfig.html\">http:\/\/homspace.xs4all.nl\/homspace\/samplerbox\/SBconfig.html<\/a><\/p>\n\n\n\n<p>What could You do better than I did?<br>&#8211; 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.<br>&#8211; create a stiffer case and a bigger circuit-board for the MIDI-Port. A MIDI-Port, shaking loosely inside the case wouldn\u00b4t be &#8222;pro&#8220;,<br>&#8211; Try to use the OLED-SPI-Display-Option, &#8211; my 16&#215;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. &#8211; but sometimes it works!?<br>&#8211; Don\u00b4t 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.<br>&#8211; Test Your setup on a breadboard first<br>&#8211; Connect the LCD only with Data-Pins Data4-Data7, &#8211; the 8Bit-Mode is not supported by the version from HANS.<\/p>\n\n\n\n<p>What I would do with the samplerbox?<br>I already own a Akai MPC2500, &#8211; 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.<br>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 &#8222;recorder&#8220;.<br>I would like to use the Samplerbox as a small expander with Samples which I recorded or to provide drum-loops.<br>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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"http:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3745.jpg\" alt=\"\" class=\"wp-image-349\" srcset=\"https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3745.jpg 640w, https:\/\/www.hman-projects.de\/wp-content\/uploads\/2020\/01\/IMG_3745-300x225.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>Things, which are not that good:<br>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.<br>The forum(s) is not splittet into different subjects. Most forum-posts are asking for help or saying that the sound is crappy &#8211; 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.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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+\u00a0 to test samplerbox with it. For now it works fine with the last image from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-318","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=\/wp\/v2\/posts\/318"}],"collection":[{"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=318"}],"version-history":[{"count":20,"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=\/wp\/v2\/posts\/318\/revisions"}],"predecessor-version":[{"id":356,"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=\/wp\/v2\/posts\/318\/revisions\/356"}],"wp:attachment":[{"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hman-projects.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}