Soundplant + 2 Bareconductive Boards = 24 Input Digital Instrument
by Aaron Artrip in Circuits > Arduino
513 Views, 0 Favorites, 0 Comments
Soundplant + 2 Bareconductive Boards = 24 Input Digital Instrument
This project is a documentation for a work project through my job at CEISMC (Center of Education Integrating Science, Mathematics, and Computing). CEISMC is an education wing of Georgia Tech in Atlanta, GA. The program I am involved in is "GoSteam." You can learn more about the program here: https://www.ceismc.gatech.edu/
This 24 input digital instrument will be used with Soundplant (download link below). We will code this instrument using Arduino (download link below). We will be 'fooling' the computer into reading the Bareconductive boards as regular typing keyboards. Anytime you touch a sensor in the Bareconductive board, it will send a 'keystroke' to Soundplant and will play the assigned sample. Here is a link that explains how the Bareconductive Touch Boards use capacitive touch to send signals.
Why are we using Bareconductive Touch Boards instead of two keyboards?
This project is part of a socially distanced enrichment project for an elementary school music teacher. In normal circumstances, the children will trade and share instruments. Unfortunately, we can no longer do this because of COVID-19. This instrument will be used with the children's individual conductive shapes (cardboard wrapped in aluminum foil).
Supplies
1. Two (2) - Bareconductive Touch Boards (this will give you 24 inputs total)
2. Arduino software pre installed **you must install this PRIOR installing the Touchboard Library**
If you don't already have this installed, here is a link to their website. Its free, but consider donating :)
3. Touchboard Library (from Bareconductive)
This will provide a library for Arduino to pull pre made codes for the Bareconductive Boards (very helpful).
4. Soundplant - This software turns your computer keyboard into a sound trigger device.
5. A selection of 24 samples of your choice. www.freesound.org and www.archive.org are great places to start for looking for royalty free sounds.
Preparing the Code for BOTH Bareconductive Boards
The first step we are going to take is preparing BOTH Bareconductive boards for sending 'keystrokes' to Soundplant. This will require us to make TWO seperate arduino .ino files (.ino is the native Arduino file format).
First, open Arduino. Once loaded, go to File -> Sketchbook -> Touch Board Examples -> HID_Keyboard.
Once this is open, we are going to go ahead and 'Save As' and label this 'Soundplant_BCTB_1of2'
Then lets 'Save As' again and label this new file 'Soundplant_BCTB_2of2' So now we have two (2) files: Soundplant_BCTB_1of2.ino and Soundplant_BCTB_2of2.ino
Soundplant_BCTB_1of2.ino PREP
In Soundplant_BCTB_1of2, under // keyboard behaviour constants we are going to change two constants.
1. The first constant we will change is const bool HOLD_KEY = true; we are going to change 'true' to 'false'
By changing this to 'false', it will send a single (on/off) keystroke to Soundplant. This will help keep the performance of this digital instrument a little bit more organic and react like a traditional acoustic instrument.
2. The second constant we will change is const char KEY_MAP[12] = {'J', 'U', 'H', 'Y', 'G', 'T', 'F', 'D', 'E', 'S', 'W', 'A'}; These letters can be anything you want. For this project we are going to change them to {'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S'};
****Please note that each letter must have a SINGLE floating quote before AND after each CAPITAL letter, followed by a comma. Ex: { 'A', 'B', 'C', ...}****
This will assign Electrodes E0-E11 on the Bareconductive Touch Board1 of 2.
Soundplant_BCTB_2of2.ino PREP
In Soundplant_BCTB_2of2, under // keyboard behaviour constants we are going to change two constants.
1. The first constant we will change is const bool HOLD_KEY = true; we are going to change 'true' to 'false'
By changing this to 'false', it will send a single (on/off) keystroke to Soundplant. This will help keep the performance of this digital instrument a little bit more organic and react like a traditional acoustic instrument.
2. The second constant we will change is const char KEY_MAP[12] = {'J', 'U', 'H', 'Y', 'G', 'T', 'F', 'D', 'E', 'S', 'W', 'A'}; These letters can be anything you want. For this project we are going to change them to {'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B'};
****Please note that each letter must have a SINGLE floating quote before AND after each CAPITAL letter, followed by a comma. Ex: { 'A', 'B', 'C', ...}****
This organization was to keep the samples organized on ONLY the letter keys of the keyboard to keep things simple.
This will assign Electrodes E0-E11 on the Bareconductive Touch Board 2 of 2.
Setting Up Arduino Software to Read the Touchboards
In order to send the .ino file to the Touch Boards, we first have to make sure the Arduino software is reading the boards correctly.
Plug in your board directly into the computer, and not through a USB hub, this might cause the Arduino software to not read the boards at all. Flip the power switch on the Touchboard to ON.
Go to Tools -> Boards -> Bareconductive Boards -> Bareconductive Touch Board
***Make sure to select Bareconductive Board, NOT Barecondutive Board USB MIDI***
Go to Tools -> Port -> /dev/cu.usbmodem(XXXX) (XXXX will be different for everyone)
Downloading the Code to the Touch Boards
This process is the same for both boards, just with different files for each board.
Once the board is connected, and is being read properly, lets load .ino file Soundplant_BCTB_1of2 onto the first touch board.
Up the left hand corner of the window are two circles:
One with a check mark and one with arrow. The check mark is used to verify the code for any errors. Hit this button first. If there are no errors it will say 'done compiling' in the bottom left of the window.
The other button is Upload. Hit this button and you will see 'Uploading...' at the bottom, and you will see 4 LED's on the touch board flash (L, Tx, Rx). If all is well, then they will blink for a few seconds, and then go off.
Before we get to the Soundplant software, touch a few of the electrodes on the Touchboard and you should see the LED's light up. Success!!
Once the first one works, repeat the process with the second Touch Board by uploading Soundplant_BCTB_2of2 onto the second Touch Board. You will need to make sure you select the correct board and port for the second one as well.
Placing Samples Into Soundplant
Okay here is the fun part! We are going to bring in prepared samples into the Soundplant software to start to layout our KEYMAP. This KEYMAP is what we will load to make sure all the samples are loaded each time we open the software.
Since our code was set up to work on only the keys determined in the const char KEY_MAP[12] constant, we are going to start with the letter 'Q.'
You can simply drag and drop the samples into the Soundplant, directly onto the key of your choice. For this examples, we're using 'Q' to start.
When you drag the sample into Q, you will see it becomes highlighted with a purple glow around the key. This is important to notice because we will be applying certain settings to each key so we want to make sure we have the correct one highlighted.
Under the 'KEYMODE' area we are going the select 'restart' instead of 'sustain.' Placing this in restart mode will restart the sample and only play ONE instance of the sample. In Sustain mode, every keystroke will add another instance of the sample to the playlist on the far right side of the Soundplant window. Setting this to restart will help keep processing load down on your computers CPU.
Once you have set up your first sample to these settings above, just rinse and repeat for the rest of your 23 samples!
Saving Your KEYMAP With Sounds
Once you have prepped all your samples, you are going to want to save the 'keymap with sounds'. This is import that you don't just save keymap, but you save 'keymap with sounds'. This will make sure all the sounds you've curated show up when you open the keymap later on.
Look for the little speaker next to the Save Icon (the floppy disk for us older folks) and click it.
This will prompt you to name a folder after your project title. Choose your title and click 'Save Folder'
Once it's saved, you will see a folder that includes the keymap AND the samples you've curated.
Now when you are ready to open this set of samples again, just simply double click the .keymap file INSIDE your new folder and it will load the keymap AND the samples!
Congrats!