The requirements I need to meet are as follows:
- The controller must support a minimum of two Roland pads
- The controller must be able to replicate the soundset of the Alesis Samplepad it will be replacing
- It must be easy to add new sounds
- It must be simple to use
- It must be robust
Hardware
I have researched a few options in order to help establish the best way to achieve the requirements.
My initial instinct was to build a Pi-based solution and use an analog Zero pHat I have to attach the pad inputs, using python to read the pads and play audio files, however I feel that the need to safely shut it down wouldn't meet the simplicity or robust requirements in my eyes.
After some further searching for a Microcontroller-based answer to the problem I stumbled across the DFRduino M0 board by DFRobot. The board looked perfect; An ARM Cortex M0 board, complete with an IIS chip onboard for handling audio processing. The board is less than $10 too!
After looking further into this board I found the perfect companion shield for the board: Audio Shield For DFRduino M0. Complete with Micro SD card slot, line out and recording features and a small onboard amp, this board wpuld have given me the functionality I need to achieve all of the above targets and give plenty of features for future development.
However, after plenty of testing it became clear I'd need to add an extra requirement - polyphony. The board handled the job great, but sound clips would be cut short or delayed when a second, quick trigger happened. This wouldn't be suitable for a live environment, so I once again rethought my plan, and settle on using a handful of Dfrobot DFplayer mini mp3 modules; triggering these and mixing the outputs into one single output would give the polyphonic output requirement and for a relatively cheap price.
Another welcome advantage to using the DFplayer mini modules is modularity; it will be easy to add further pads to the setup without to much extra work - just add one of these with a 10k potentiometer on the outputs with 1k resistors to allow it to be mixed with the others.
In the future I'd like to explore the possibility of modular PCBs with a backplane.
In addition to these modules I will also include an i2c 16x2 LCD screen and a rotary encoder for menu and navigation control. Add in a handful of 1/4" jack sockets and an enclosure and this should give us a complete unit.
Software
I have a rough idea on how I am going to tackle the code of this project:
Sample sounds will be uploaded to the MicroSD Cards on the modules, and the order in which the files are written to the card dictates the file number to call (first file on is file 1 etc).
The rotary encoder and lcd will allow the setting of the volume of the output and also the number of the group of sounds to be triggered - switching between the two will be done by pressing the encoder button.
The main loop of the code will check the pad pins (A0-A5) and check for a reading; if > 0 then a hit has been registered. The play command will send the currently selected group number and the reading of the analog pin to the DFplayer module associated for that pad.
The Reading will be mapped against 100 and used to dictate the percentage of the main volume that the sound should be played, allowing velocity of the hit to be reflected in playback. The group number and pad name will be combined to give the name of the file that should be triggered from the SD card.