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. Now I use a Raspberry Pi 3B+, and the system works very reliably with a latency that is below 8ms.

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.

  • 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 available in debian

    Jeremy11/23/2019 at 19:08 0 comments

    It's been a while, actually, a year, since I last posted a log here...

    The reason is that much work has been done on eXaDrums during that time. The GUI hasn't changed much, but the library has evolved quite a bit.

    The first very important thing is a 'virtual instrument'. On the GUI side, it is called 'Virtual Pad', and this is how it looks:

    Each instrument has its own button, so you can either use a mouse or tap your touchscreen to trigger it. If you're using a PC, you can assign shortcuts to the instruments (up to 2), so that they can be triggered by a keyboard.

    This almost minor add-on was , in my opinion, necessary to have the packages (eXadrums and libexadrums) submitted to the debian repositories.

    Both eXaDrums and libexadrums are available from debian sid (unstable) and bullseye (testing). In fact, they are also available from Ubuntu 19.10, and the next LTS release, 20.04.

    Anyway, this should simplify exadrum's installation for debian and ubuntu users.

    Hopefully, the next Raspbian release will also ship with exadrums in it's official packages!

  • eXaDrums: A Drum Module You Can Make (2)

    Jeremy11/18/2018 at 19:38 0 comments

    In the previous log (eXaDrums: A Drum Module You Can Make), I showed you how to make an eXaDrums module. However, there's one part that you can't quite make yourself: the enclosure.

    Don't worry though, I invested in a 3D printer and spent quite a bit of time modeling things on Freecad. As you can see, I'm now modeling a 3D-printable case for the module.

    You may have noticed that the Raspberry Pi touchscreen's dimensions are a bit weird... Frankly, it takes so work to get everything aligned as it should be. Beware, if you try to design something for that touchscreen, that nothing is symmetric!

    Anyhow, I've already printed two prototype parts, but I still have to design the most difficult parts. I also need to make sure that all the individual parts are smaller than 150x150mm as this is the size of my printer's bed...

    This is the last step to make a completely open-source project, software and hardware. And of course, there will be a Github repository with all the files included.

  • eXaDrums: A Drum Module You Can Make

    Jeremy09/24/2018 at 13:53 0 comments

    I've always wanted to make sure that anyone could build their own eXaDrums module. But that's easier said than done, as an additional board is required to convert the signals of the drums' sensors (piezos) into data a Raspberry Pi understands.

    I'm very happy to announce that you can now build your own eXaDrums module if you want to. In this log I'll explain you how. I'll assume that you have all the required components: Raspberry Pi, SD card, USB soundcard, power supply, etc.

    ADC Board Prototype

    A Working Raspberry Pi ADC Board

    Yes, the image that you see shows a prototype that I recently ordered from OSH Park. It fits pretty nicely in the enclosure I have, as the only modification I had to make was to cut a piece out of the back lid, and tap two holes underneath the enclosure.

    You may be wondering why the board has a DB25 connector? There is a simple reason to that: the board is intended to be used with a Roland TD-4KP drum set, which uses a DB25 connector.

    Two prototypes

    Of course, the board can be modified in order to work with other drum kits. Which brings us to the boards that I made. The one shown on the first image is actually the second board that I got from OSH Park. I ordered a first one that includes the hi-hat pedal controller input, but it doesn't fit into the enclosure, so I also got this new one, with rounded corners. Both boards are open source, and available on Github, so you can modify them to get your own custom boards.

    OSH Park Orders

    Below is a picture of one of the three boards that I received from OSH Park.

    The project is shared on OSH Park, so you can order three boards like that one for $28.15.

    Here's a brief description of the board, followed by more theoretical considerations in the next section.

    From left to right, we have:

    • A DB25 connector to be plugged into a Roland TD4-KP drum kit.
    • 8x 1MΩ potentiometers (RV1 to RV8).
    • 2x TLC2264 Low power consumption operational amplifiers (U3 and U4).
    • A series of 24 100k resistors (R1 to R24).
    • An MCP3008 ADC (U1).
    • An LMC7660 voltage inverter (U2) and its capacitors (C1 to C4).
    • The 40-pin header that goes on the Raspberry Pi.

    A Little Bit Of Theory

    Piezo sensor conditioning is a lot harder than it seems at first glance. The output voltage of a piezo sensors often varies between more than 10V and less than -10V. Mapping that kind of voltage to the input of an MCP3008, which is 0-3.3V is thus a bit of a challenge.

    Lets take it step by step. First of all, the output of the sensor has to be scaled down while being connected to a high impedance in order to make sure that its dynamics isn't altered. To achieve that, a 1MΩ is used to create a voltage divider that feeds an voltage follower (op amp), as shown below.

    This first step ensure that the input voltage V+ of the op amp is constrained between +Vcc and -Vcc (+/-5V in our case). The op amp input also guarantees a high impedance.

    Then, the output of the op amp is connected to a three-resistor voltage mapping circuit that obeys to the following equation:

    If the three resistors are the same, and Vbias = 5V, we get Vout = Vin/3 + Vbias/3 = Vin/3 + 1.67V.

    Because Vin varies between +/-Vcc=+/-5V, Vout varies between 0V and 2*5/3V = 3.33V, a voltage that is perfect for the inputs of our MCP3008.

    So now you understand...

    Read more »

  • Official Packages Repository

    Jeremy09/02/2018 at 20:13 0 comments

    If you've read the previous log, you know that I successfully build Raspbian and Debian packages for eXaDrums and libeXaDrums. They are both available on Github by the way, in the Release section.

    Because they are proper signed packages, if you wish to try them out, you'll have to add the gpg key first:

    wget -O - http://freewebmaster.fr/deb/jeremoden.asc | apt-key add - 

    Then, you just have to add the following line to your /etc/apt/sources.list:

    deb http://freewebmaster.fr/deb/ ./

    And that's it, run sudo apt update, and then you can install eXadrums as if it was part of your distribution, for instance: sudo apt install exadrums.

    After you've installed eXaDrums, you'll notice two shortcuts in your applications menu. One of them starts eXaDrums as root. This is mainly for the Raspberry Pi, if you use a SPI ADC (MCP3008 or MCP3208 for example).

    Note that you probably want to change the soundcard and sensor type, as the default values might not be adapted to your configuration.

  • 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 Available

    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.

View all 44 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

    Connect your ADC and sensors

    To wire an ADC to the SPI bus of the Raspberry Pi, you can follow those steps use the following diagram:

    FYI, that comes from my previous project RaspiDrums, and illustrates how you would connect an ADC click to a Raspberry Pi B+.

    eXaDrums has been tested with MCP ADCs: MCP3008, MCP3204, and MCP3208. Nothing stops you from writing your own Sensor class and add support for other ADCs, check the source code on Github.

View all 9 instructions

Enjoy this project?

Share

Discussions

Andi wrote 10/16/2019 at 22:13 point

Hi Jeremy,

i have the same problem as pyroclast3. Installation of libexadrums works like a charm but if i try to install exadrums i recaive the error that the "Release" folder can not be found. Do you have a tipp or could you update the repos?

Thanks

Andi

  Are you sure? yes | no

Jeremy wrote 10/17/2019 at 18:29 point

Hi Andi,

Indded, you might have the same issue as Ian.

Make sure you read the github's readmes, and use dpkg-buildpackage to install libexadrums and exadrums.

That should solve your problems, as instructions are quite easy to follow.

You'll need raspbian buster for that to work.

Jeremy

  Are you sure? yes | no

pyroclast3 wrote 08/09/2019 at 08:06 point

Hi Jeremy,

I love the look of this but I'm really struggling to install it. I'm using a Raspberry Pi 3 and following your instructions on the page. Using the ./InstalleXaDrums command fails every time though. It gets to a point where I get a folder not found message (libeXaDrums/Release)

Looking at the commands in the installation script I've a feeling there must be folders missing from the GitHub pages that are being cloned, both the libeXaDrums and eXaDrums

its extremely possible that I'm being dense but I'd appreciate your help on this as i (and the kids) would love to get his working.

Cheers

Ian

  Are you sure? yes | no

Jeremy wrote 10/17/2019 at 18:28 point

Hi Ian,

Installation instructions have changed. Please read the github's readmes, and use dpkg-buildpackage to install libexadrums and exadrums.

You'll need raspbian buster for the installation to work.

Cheers,

Jeremy

  Are you sure? yes | no

tomwtrs wrote 04/13/2019 at 11:16 point

Hey Jeremy, 

I have built an E-drum for my kids using your instructions and software, v2. It works great, so my congratulations on this project. 

Perhaps you can help me out with two issues.

First I find that the latency is audible. Perhaps this is due to my wav samples, or the trigger settings. Can you provide or recommend good samples? Or can you instruct how to optimise the settings?

I have 8 pads, wired to a breadboard. One I’d like to set up as a highhat. I have the light sensors for this, but no idea how to get the signal in the Rpi. Perhaps you can give a hint?

Thanks in advance for your reply, and thanks for the work you have put in this project. My kids and I had a great time with building and testing.

Tom

  Are you sure? yes | no

Jeremy wrote 10/17/2019 at 18:25 point

Hi Tom,

Sorry for this very late reply, I didn't see any notification of your message...

Are you using a USB soundcard? If not, that's why the latency is audible. The Raspberry Pi built-in soundcard is not very good...

If you're using a USB soundcard, make sure that it can accept small buffers. The maximum buffer size to make sure there's no audible latency is 512 samples (~10 ms, or 10,000 µs). You can set the buffer's duration in the mixer settings.

As far as the hi-hat goes, you have to create a new instrument, with the HiHat type. You only need one sound of the open hi-hat. One of the triggers has to have your sensor's id, and the other the hi-hat cymbal's id.

Hope this helps.

Jérémy

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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