Close
0%
0%

eXaDrums

Electronic drums for Linux

Public Chat
Similar projects worth following
Electronic drums, especially good ones, aren't cheap. The drum module is usually the most expensive bit, and for good reason: it's the heart of the system. Although it's tempting to buy your own piezos and make your own drums in order to save a little bit of money, making a good drum module is very difficult.
The goal project is to use a Raspberry Pi to make a drum module. As far as the software goes, it is written in C++ and uses Gtkmm to display a nice graphical user interface (GUI) on a Raspberry Pi official 7" touchscreen. The hardware consists of some accelerometers or piezos connected to an analog to digital converter (ADC).
It's also possible to use eXaDrums as any other musical instrument, check out my other project: eXaMusic.

Presentation

Electronic drum modules process the data provided by the drum triggers in order to generate sounds in real time. It's quite challenging to make a good drum module, as it needs to process all the triggers' signals, synthesize the sounds, and play them within a few milliseconds. To achieve such results, the software has to be both flexible and fast. When I started to write the source code in C++, I opted for the Raspberry Pi B in order to run the software. That led to RaspiDrums.

At first, I just wanted to make sure that the Raspberry Pi B was powerful enough to be a decent drum module. That's why the hardware had to be as simple as possible (MCP3204, and accelerometers evaluation boards as drum triggers), and the software headless in order to run in real-time. RaspiDrums showed good results, and demonstrated a latency lower than 10ms.

A few days before that result, the Raspberry Pi's official touchscreen was released, and the very cool thing about it is that it doesn't use the GPIO at all, so, it doesn't interfere with the ADC chip (which uses the SPI bus). Thus, I started to work on a GUI for RaspiDrums, using Gtkmm (a C++ wrapper for Gtk). Although I didn't publish my work, the results were quite good, even with the slow CPU of the Raspberry Pi B+. It was clear in my mind that RaspiDrums was going to become eXaDrums, which is just a fork of the former. So, a few days before the official release of the Raspberry Pi 2, I created the eXaDrums project. Knowing that the Raspberry Pi 2 was way more powerful that the B+ gave me hope for the project, and I decided to get one, and test eXaDrums with Ubuntu MATE.

eXaDrums

Photograph of the system: Raspberry Pi 3B + 7" touchscreen, USB soundcard, and ADXL377 accelerometer. The GUI is shown on the screen.

How to play drums with eXaDrums!

There is a script to install eXaDrums automatically on your Linux OS, all you need is to follow the instructions listed here.

Once everything is installed and configured, you can have fun and play drums, or you can train and improve your skills by using the built-in metronome.

Install_eXaDrums2.zip

This is the new script that installs eXaDrums from Github.

Zip Archive - 1.45 kB - 07/27/2017 at 21:12

Download

Install_eXaDrums.zip

This script install eXaDrums from Github.

compress - 1.45 kB - 10/18/2016 at 18:39

Download

bcm2835-1.50_patch.zip

Bcm2835 library + installation script and patch (required by eXaDrums).

compress - 247.21 kB - 10/15/2016 at 15:41

Download

  • 1 × Raspberry Pi 2B or 3B [£33.984]
  • 1 × 8GB SD card [£7.50] For the Raspberry Pi
  • 1 × Raspberry Pi 7" Touchscreen [£57.588] The official one.
  • 1 × RasPiO Analog Zero [£9.99] http://rasp.io/analogzero/
  • 1 × USB Soundcard (Startech ICUSBAUDIO2D) [£28.128]

View all 7 components

  • EXaDrums Version 0.1.0 Released

    Jeremy07/25/2018 at 18:40 0 comments

    A couple of days ago, I released the versions 0.1.0 of eXaDrums and libexadrums. The releases are both available on Github: eXaDrums, libexadrums.

    As you may have seen if you clicked on the previous links, there are three .deb packages that are provided for each release.
    One of the packages is for amd64 architecture, so that you can test eXaDrums on your PC.
    The other two are for Raspberry Pi: the armhf is intended to be used with the official Raspbian Stretch distribution, and the arm64 one is to be used with a 64-bit distribution and has been tested with Pi64 (Debian Stretch).

    The libexadrums package has to be installed first (sudo dpkg -i libexadrums[...].deb), and if you're running eXaDrums on Raspberry Pi with your sensors connected to the SPI interface, you need to start eXaDrums as root. You can do that by typing sudo exadrums in a terminal, or from the startup menu.

    Be aware that this is a pre-release, as error handling has not been integrated yet, so be careful when you use the software. In case you break something, you can restore the default configuration using exadrums -r. If you need more info, type exadrums --help-all.

    Cheers.

  • Debian Packages Avaiable

    Jeremy07/01/2018 at 18:20 0 comments

    So I was thinking about making eXaDrums easier to install and upgrade, and I realized it would be pretty cool to make a debian package out of it.

    It's not as hard as you might think, as all it takes is to create a debian/ folder. That folder has been added to the git repositories today, and using the following script, you can build the debian pacakges yourself:

    #!/bin/bash
    
    git clone https://github.com/SpintroniK/libeXaDrums.git &&
    git clone https://github.com/SpintroniK/eXaDrums.git &&
    cd libeXaDrums/Release && make -j3 all &&
    sudo cp libexadrums.so* /usr/lib/ &&
    cd ../../ &&
    cd eXaDrums/Release && make -j2 all &&
    cd .. &&  dpkg-buildpackage -b -uc &&
    cd ../libeXaDrums &&  dpkg-buildpackage -b -uc &&
    sudo rm /usr/lib/libexadrums.so* &&
    cd .. && lintian *.deb

    Of course in order for that to work you'll need all the dependencies that both libexadrums and exadrums require (please refer to the github readmes for that), as well as the dpkg-dev package (that provides the dpkg-builpackage utility).

    I'll be providing debian packages of exadrums and libexadrums in an official repository soon. That way upgrades will be easier than ever.

  • EXaDrums Server

    Jeremy06/01/2018 at 06:28 0 comments

    EXaDrums Server is now available on Github.

    Used together with eXaDrumsLite it allows you to use eXaDrums on a headless Raspberry Pi distribution. Although it's just a server, it has access to all the functionalities of eXaDrums. And even if only a few of them are currently implemented, I plan to make them all available so that the Android application can be used as a proper module.

    As you can see, eXaDrums Server communicates with eXaDrums Lite using Json RPC 2.0, which is quite fast to parse, and makes the server running decently on a Raspberry Pi Zero W.
    I'll keep posting logs about the Android app status, as I plan to develop it further and make it as complete as possible.

  • Record your best beats!

    Jeremy03/10/2018 at 18:25 0 comments

    It was one of the first features I thought about when I started the project: a drum beat recorder.

    Although it's now finished yet, there's now a "Record" button that lets your record drums as you play. When you stop recording, you can export what you've just played to an xml file:

    The file contains the sounds that you used to record the track as well as all the triggers parameters. It is not a sound file, it just contains all the information that's needed to generate a sound track.

    This is an important feature for eXaDrums, and you'll see another one pretty soon.

  • Performance: the best you can get?

    Jeremy02/24/2018 at 13:51 0 comments

    As I develop eXaDrums, I sometimes wonder how to improve performance without impacting reliability. In my opinion, software robustness always comes first, even at the expense of performance.

    Last time I measured the latency, I got about 8 ms. That's not too bad, as I was aiming for less than 10 ms.

    More recently I've measured latency again, but this time with a Raspberry Pi 3B and an audio DAC instead of my good old USB soundcard. I chose a JustBoom DAC, as shown on the picture:

    All I had to do was to plug it in the GPIO, and it worked straight out of the box. The good thing about the JustBoom is that it doesn't need the Spi pins, and you can stack another board on top of it. So I stacked my ADC, and that was it, eXaDrums was working as before.

    As for the configuration, I still use a trigger scan time of 2 ms, and the audio buffer was set to 1 ms.

    And just like that, without any software modification, I reduced the latency by almost 3 ms, and went down to 5 to 6 ms of latency:

    Yellow curve: trigger's voltage, blue curve: output of the DAC.

    So here we are, the latency is lower than 7 ms (that's what is usually considered as usable in a professional environment), and the sound quality is really great. Can we beat that? We'll see...

    FYI, previous tests on a Raspberry Pi 2B are here: https://hackaday.io/project/7499-raspidrums/log/25077-latency-goes-below-10ms and more recently https://hackaday.io/project/9350-exadrums/log/58025-performance-the-best-you-can-get.

  • eXaDrums Lite (2) & Rhythm Coach

    Jeremy02/12/2018 at 19:43 0 comments

    eXaDrums Lite

    I've spent more time on eXaDrums Lite, and there's now an efficient way to communicate between the Raspberry Pi Zero W and my Android Tablet. They both use JSON-RPC, which is both very lightweight and easy to parse.

    The app has evolved a bit too, as you can see:

    It controls the start and stop button as well as the metronome's tempo.

    Rhythm Coach

    The next important thing in the development of eXaDrums is the rhythm coach. As I probably already said, it will be greatly improved.

    In fact, I'd like to turn it into a proper training tool rather than just a rhythm coach. I have a plan for that, but I'll make sure it's feasible before I spoil you guys.

  • eXaDrums Lite: Android app + LM386

    Jeremy12/25/2017 at 12:42 0 comments

    I have been working on a lite version of eXaDrums for weeks, and now is the time to share the results of this experiment.

    Raspberry Pi Zero W

    First of all, eXaDrums Lite uses a Raspberry Pi Zero W and is running Raspbian Stretch Lite. As you probably guessed, there's is no graphical user interface installed on the Pi Zero. So how does it work?

    The Raspberry Pi runs libeXaDrums on a headless system. It's configured to behave as a wireless access point. An executable communicates (I will share it when it will be in a little more advanced state) with libeXaDrums and creates a socket server in order to receive messages from the user. The user sends those messages through a graphical user interface installed on an Android device that is connected to the Pi's wifi network.

    Android application

    So far, the application is very minimalist and consists of a Start/Stop and a Quit button:

    When you click on the Start button it sends a message to the Raspberry Pi, which starts the module, and gets a confirmation back. After the confirmation has been received, the button becomes a Stop button.

    Signal conditioning with a LM386

    In order to keep it compact, I've done my best to make everything fit on a RaspIO Analog Zero board. I needed something that can be connected to a standard drum pad, so I tried to use op amps to get a voltage that is compatible with the MCP3008 (0 to 3.3V).

    As it turns out, the LM386 is a very good chip for that. I've found that people often use a resistor to reduce the drum pads piezo voltages, but I also need this voltage to have a DC component of 1.65V (3.3/2 V). The LM386 takes in a voltage that can vary between -0.4V to 0.4V, amplifies it and adds a DC component to the amplified voltage. Unfortunately, because of the supply's voltage range, that DC component is 2.5V. Not a problem, we can just add another potentiometer to lower it to 1.65V.

    Thus, I ended up with the following schematic:

    where the input potentiometer is used to reduce the output voltage of the piezo sensor to fit the -0.4V to 0.4V requirement, and the output potentiometer to set the output DC component to 1.65V.

    That leads to the following design, using the prototyping area of the RaspIO Analog Zero:

    where the black lines represent connections between the pads (soldered together at the back of the board), and the red cross a cut track underneath the board (the blue wire must be disconnected from the first pin of the LM386).

    That works perfectly for a single drum as the fast response of the LM386 adds up almost no latency.

    If you wonder how that sounds like, check out this video:

    eXaDrums Lite

    So here we go, this is a first test of a minimalist and cheaper version of eXaDrums. It's also a lot easier to build, so if you want to try eXaDrums but can't be bothered with all the complexity of the complete version, you can start by building yourself an eXaDrums Lite module like this one:

    I'll keep working on the Android application and make it so that it can be used almost the same way as the full version of eXaDrums.

    Needless to say that, as far as power consumption goes, eXaDrums Lite is way more efficient. In fact, even using a USB soundcard that draws about 80mA, the module runs continuously for more than 5 hours with a 3.7V 2200mAh battery. This is about 4 or 5 times more than the complete version of eXaDrums.

  • A little teaser

    Jeremy11/05/2017 at 20:02 0 comments

    Do you want to make your own DIY drum module? I think it's fair to say eXaDrums is one of your best options. See for yourself:

    Oh yeah, it is really working that well. I made a little board to play on my Roland TD4-KP, and here we are, the result is amazing, and feels like playing with a commercial drum module.

    Still a few things to work on though... Here's a list:

    • Error handling
    • Make the mixer work in stereo
    • Work with wav sound files
    • Polish the user interface
    • ...

    Of course, I'll publish some schematics pretty soon, so that you can connect your electronic drums to your eXaDrums module.

    Oh yeah, that's right, a longer video is coming soon. It will show more things, more features, more sounds, etc.

  • Configure your audio device...

    Jeremy10/08/2017 at 18:32 0 comments

    ...without restarting eXaDrums.

    The "Mixer Config" button is working and allows you to change your audio settings, such as buffer length, sampling rate, etc.

    Below is a screenshot of the window that lets you do that:

    As you can see, all the sound cards are detected and you can choose the one you want to use.
    The best thing is that you don't even have to restart eXaDrums, you just select your sound card, set your parameters, click save and you're good to go.

    I've been working on eXaDrums for over two years now and it's all coming together nicely. I try to publish most of what I do on HaD, but I sometimes skip a few things. Just to let you know the things I've been working on lately, here's a (incomplete) list: 

    • Switched the whole project to C++14.
    • Changed the way sounds are chosen from the instrument preferences window.
    • Lots of testing (used gdb remotely to debug from the Pi over ssh) and bugs fixes.
    • Designed a board to interface eXaDrums with piezo sensors.

    The first three items can be found on Github. As for the last one, it's a bit of a tease, but I can already tell you that you can expect a demo on a real electronic drum kit at some point.

    Cheers.

  • Some updates

    Jeremy07/27/2017 at 21:28 0 comments

    Not a single day goes without me thinking about eXaDrums. Despite a few bugs to fix, the project is more and more mature, and it pleases me a lot. I have a feeling that I'll be playing drums with an eXaDrums module pretty soon!

    I'm still working on the triggers, sensors and advanced features, as well as the rhythm coach, which is already working pretty well. The hardware is about to change a bit, as I need to make the module work with piezos instead of accelerometers (less expensive, and less noise too, but less controlled output...).

    I've put a new installation script in the "Files" section, and slightly changed some of the instructions, and as far as the software goes, I'm currently focusing on error handling. It's been neglected a bit so far, but I've been working on it, and it looks it's going to be quite useful and easy to integrate. Once this and the rest of the Api are finished, I think we are going to get really close to a version 1.0.0.

View all 40 project logs

  • 1
    Step 1

    Connect the touchscreen to your Raspberry Pi

    (We assume here that you already have all the parts listed in the Components section.)

    Connect your Raspberry Pi to the official Pi touchscreen (watch this video if you need help: https://www.youtube.com/watch?v=6HvWXQsBeHk).

  • 2
    Step 2

    Install a Linux distribution on your Raspberry Pi

    Install Ubuntu MATE (here's the useful link for that: https://ubuntu-mate.org/raspberry-pi/), or Raspbian (eXaDrums works best with Xfce. If you want Xfce, download and install Raspbian Jessie Lite, and install the xfce4 package).

    Here's how I install Ubuntu MATE using the image provided on the official website (all done with my xubuntu desktop):

    1. Download the image and extract it (right click + etract). You now have a .img file.
    2. Format your SD card to a fat32 file system. I used Gparted for that (sudo apt-get install gparted).
    3. Copy the image to the SD card:
      sudo dd bs=1M if=ubuntu-mate-16.04-desktop-armhf-raspberry-pi.img of=/dev/sdb
      (you can use Gparted to verify the destination, but every time I did it, sdb was the name given to my SD card.
    4. Insert the card in your Raspberry Pi (2 or 3 recommeneded), and start it.
    5. If the image is upside down, edit the /boot/config.txt file, and add that line at the end:
      lcd_rotate=2
  • 3
    Step 3

    Install the bcm2835 C library

    Now that you have a working installation of Ubuntu MATE on your Raspberry Pi, it's time to configure and wire the analog to digital converter.

    eXaDrums relies on the Bcm2835 C library in order to access the SPI bus of the Raspberry Pi.

    To install the library, simply follow the steps on its official website. Note that if you want to run eXaDrums on your laptop, you need to patch the library. If so, I recommend you just download the library from the project page and run the script that's included.

View all 10 instructions

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