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.

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: 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.

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

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