Close
0%
0%

DIY SamplePad Controller (MkI)

A unit to allow sample audio files be triggered and played by Roland drum pads

Public Chat
Similar projects worth following
While working on my MIDI Drum Module project I was asked to explore making a smaller standalone module to allow the use of a small number of pads to augment an acoustic drum kit.

The drummer in question currently uses an Alesis Samplepad alongside his kit; it offers 4 pads, and an SD Card slot to load sounds onto the device. It has a small screen for displaying sample information, and a few buttons/knobs for sample adjustment.

What I propose to assemble will allow for 3xdouble trigger pads to be used to trigger onboard samples, much in the same way as the Alesis device.

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.

  • 1 × Arduino Mega Chosen for it's plentiful Analog pins. Could easily be a smaller arduino with analog expanders
  • 4 × DFRduino MP3Player Each handling sound playing for each pad
  • 1 × Panelmount DC barrel socket to pass power to the Arduino
  • 1 × Enclosure - TBC Big enough to hold your boards and allow for mounting jacks, screen, encoder, pots & power
  • 4 × Micro SD Card For storing dem sweet sounds! 1 per MP3Player board. Small capacities will do.

View all 11 components

  • Moving on

    Craig Hissett07/09/2020 at 23:15 0 comments

    Pre-lockdown, I managed to get this version of the controller out together and, while it worked, it wasn't as usable as I wanted it to be.

    Recently I've been using Pure Data to create patches for another project, and it has now given me a new angle from which to approach this project.

    I will recycle the Arduino Mega code to read the inputs, but instead of using those to fire off serial commands to various mp3 modules I will send an array of the values to a Pure Data patch via serial.

    In my testing I have been able to load some sample wavs and trigger them from the Arduino data, which is awesome! Next up is to try and use that passed value as the velocity of each hit.

    Once I'm happy with that side of things I will look to provide data going back to the Arduino to display on an LCD screen, and look to incorporate some options for switching banks of wav files.

    Finally, once I'm happy with this on my laptop I will migrate it to a Pi with a Justboom amp/DAC hat. I'm also going to try running it on an old windows 8 tablet to get use out of some things gathering dust. If I manage I will ditch the LCD screen and incorporate a GUI in the Pure Data patch.

  • Code | Rough, but almost ready

    Craig Hissett08/30/2019 at 00:20 2 comments

    'Done Compiling'

    Two beautiful words I love to see after attacking the Arduino IDE for a little while:

    I've added some missing functions to the code, and now have something I'd be happy to test the hardware once assembled.

    The code will:

    Read analog inputs

    Allow volume and bank control from encoder

    Show on screen volume and bank data

    Trigger sounds on the sound modules

    In future revisions I will work on adding EEPROM into the code to save settings, arrays to save various settings for each pad input (volume, target sound module to start) to save into EEPROM, and update the menu to show more levels. Perhaps pressing and holding the button then allows the user to switch to a pad select mode (scrolling will move the pages between each pad) then clicking will allow to move between settings for the pad, with a further click allowing to select the value to be edited. One last click would save the changed setting, whereas holding would go back to the main menu.

    In addition to this I will almost certainly include a series of Serial commands to allow for the settings to be updated via serial.

  • New Github Repo

    Craig Hissett08/27/2019 at 00:09 0 comments

    I've added a new Github Repo the the links of this page. 

    So far the code contains a simple menu, sets up the 8 analog inputs, sets up the 4 DFPlayer minis.

    Next step is to add code to read pads and trigger sounds (I have that in another project somewhere), add EEPROM functionality to save each analog pin's sound and Player target, then improve the menu.

  • Software Possibilities

    Craig Hissett08/23/2019 at 00:43 0 comments

    I've just been updating the project details to reflect my change of plan towards multiple sound modules firnthis project.

    Following this decision I have realised it has opened up the possibility of more feature in the software.

    The first is individual mapping for the pads: rather than dictating a sound bank number across all of lads i could allow the user to assign different numbers to each pad. I could also allow the player to edit the routing of the pads, and chose which DFplayer module is triggered by the pad.

    In order to achieve this I am going to create an array for each analog pin which will be saved to EEPROM. The pad will have the analog pin number, the dfplayer's tx pin number, file number.

    I can add to the screen menu to allow the encoder button to cycle through the pads when clicked, and pressing and holding would enter 'edit mode'. I'd also like to write a function to allow for updating of the settings via serial, so I can write a companion python app with a GUI for easy editing.

    If anyone has any good examples or experience with arrays and EEPROM stiff please leave a comment :)

  • Almost ready to build!

    Craig Hissett08/21/2019 at 16:19 0 comments

    Today I have taken delivery of the lovely little enclosure that is going to house this project, along with the 10k stereo pots required to control outputs of the sound modules in the DIY mixer part of my plan. Once the stereo jack sockets arrive I'll be building this unit, testing it, then giving it to our drummer for feedback in order to fine tune the code.

    The Arduino will be reading the pad inputs and the volume/sound bank encoder, as well as outputting to the LCD screen and outputting serial to the four sound modules.

    The sound modules will then play the requested sound files via a Left and Right output. In order to mix these four left and four right outputs into one main left and right out voltage dividers must be used to avoid adding too much noise to the output. My voltage dividers will be made up of 1k resistors and 10k potentiometers, which will allow variable control of the pad outputs.  In order to keep the interface clean I am using stereo pots instead of single pots to a)reduce the number of knobs on the interface and b) maintain even control of both L&R outputs of each sound module.

    Here's a shot of the enclosure and all the parts, except for the panelmount usb cable and the audio jacks:

  • Delivery!

    Craig Hissett08/06/2019 at 00:20 0 comments

    Received 5 x DFplayer mp3 boards today :)

    Over the next few days I'm going to pick up for 512mb micro sd cards for them and then build my new breadboard up.

    Code-wise for the screen and encoder nothing will change, but for the pad control I will need to initialize 4 software serial ports for the  fkur boards, and the main loop will need to loop through the analog pins and send any read hits to that pad's dedicated player.

    If it turns out that this is complete overkill i always just use two mp3 boards, queue the registered hits, poll the status of the mp3 boards and pass to the next available.

    For testing purpose I'm going to connect all of the mp3 boards outputs together with 10k resistors, but in the final case I may include potentiometers to allow the user to mix pad strength.

  • Oooooh, a polyphonic library??!!!!

    Craig Hissett08/01/2019 at 13:41 0 comments

    Stumbled across this today;

    https://github.com/TMRh20/TMRpcm

    It allows asynchronous playback, and supports multiple files being triggered at once.

    It uses Pin 9 as the speaker pin - if this is compatible with the MP3 Shield I have for the Mo-based board then that would be awesome!

  • The Quest for Polyphony

    Craig Hissett07/29/2019 at 23:21 0 comments

    Back from a family holiday, I'm really looking forward to testing out some ideas on this project.

    One thing I require is to either have polyphonic output to allow the pads to trigger simultaneous sounds, or at the very least simulate it to the human ear.

    I've written several test code scripts for the Arduino board and shield I had in mind for this, but find that I can't really get close to the effect I had in mind. More likely to be my execution rather than the board itself.

    Before I went on holiday I threw together a quick novelty project at work; an ESP8266-based webserver to allow triggering of soundclips in the office (all for the proverbial shits and giggles :-D ). This project used the DFRobot mp3 board, and it was a doddle; controlled via software serial and complete with an arduino library, the thing worked great. Also, it was really cheap!

    I'm going to order a few of these boards to test an idea - if it works, great, if not I'm sure the boards will work their way into other projects ha ha!

    The plan is to add two or more of these mp3 players into the project, with an arduino or ESP8266 reading the pads and connected to the players, and a DIY mixer to blend the outputs of the players.

    Two strategies - one would be to check whether the first board is busy playing a sound file and send the request to the next available board. The other would be just having a player per pad. There's only 4 pads so 4 players would be doable.

    If the multiple players work together then this will be great for the project. The only drawback would be the need for multiple SD cards but, once the sounds are added to them this shouldn't pose an issue.

  • Better boards for the task?

    Craig Hissett06/26/2019 at 23:56 0 comments

    So far the project is 2/3 worked out; my menu and GUI is all working, I know how to read my pads via analog pins, but in Just need to get playback working well with the M0 board.

    Tonight I have been trying to make progress on playback, using a serial input to trigger wav files to be played from the SD card, but at the minute it plays garbled sounds. I'm hoping to track down where I've gone wrong sooner rather than later, as I'd like to get this working for our drummer soon.

    I've started to have a few doubts as to whether I am going to be able to achieve the level of performance I would like to get from this board, and have wondered if i could achieve better results with a different board?

    My options:

    Pi - easy shout, this one. Wav player could be written in Pygame, can use the encoder and LCD display as planned. I'd need to pair it with a microcontroller to accommodate it's lack of Analog pins.

    PCDuino - I have an old v1 in a drawer which could work. Should be able to handle Python and Pygame plan no problem, plus has Arduino compatible pins for piezo reading.

    Intel Edison/Galileo - I have these boards gathering dust somewhere, just screaming out to be used in a project.

    I've never used them before so set up may be tricky, but their arduino compatible pins and their running of Yocto Linux could be of advantage.

    I'm open to thoughts - post a comment and let me know your views!

  • Menu Test complete

    Craig Hissett06/06/2019 at 23:49 1 comment

    Apologies for the slow updates everyone, I've been having a bit of a difficult time getting stick into projects at the moment.

    Today I have tested the setup for menu, using a Wemos Mega + WIFI board, i2c LCD, some push buttons and the dfrobot mp3player unit.

    The menu is simple, butndoes all itllnever need to do. Clicking the rotary encoder button selects either Bank or Volume on the menu  and rotating it will adjust the relevant variable.

    Next I'd like to solder up a small board with the jack sockets in it, alongside the screen and encoder. This'll keep the in case set up nice and neat.

View all 11 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates