Arduino MIDI Mallet Instrument

I'm a big nerd and music lover, and among the instruments I play are mallet percussion instruments, think Xylophones, Glockenspiels and Marimbas. Since I have started playing i have always wondered if it was at all possible to create an electronic version, especially in the current lockdown situation where i do not have access to my instruments.

If its possible to create 61 and 76 key electric synthesizers that instantly play multiple sounds, and often come with many knobs and switches to control the sound, is it feasible to create something similar but instead of keys you press, its keys you hit with a mallet (yes, you can buy commercial editions of these but they run in excess of $3,000 for a small one).

In terms of feasibility i'm mainly looking for two things: latency between hit and output low enough i do not notice it like an electronic keyboard, as well as ideally getting at least 4 full octaves, or 48 keys.

In my research, the best idea i have is using piezoelectric sensors to register the "knock" of the mallet, as well as get the force to control volume, then hooking them up to a keyboard matrix circuit, then to an Arduino to covert the presses to MIDI output running out of the USB port.

What are your thoughts on this idea? Is there anything you recommend? is it at all feasible or possible? Thanks!

This won’t be the answer you’re looking for, but in 1957, my Dad gave me a great idea for the high school science fair. We had a xylophone at home, and I wound up many electromagnets and chopped up some dowels to create mallets for each tone. Each mallet was pulled down by an electromagnet, and they were modulated by a rotating commutator with alternating areas of copper, which provided the equivalent of PWM for the system.

I won the science fair.

jrdoner

Basically you want to build your own malletkat? That's awesome. It actually was one of my first arduino projects, but I never finished it, must have laying it around somewhere..

Using piezo elements to capture the triggers is absolutely possible. You probably want to put a small cap over them to smooth things out a little bit, but it works. Your challenge is gonna be getting the arduino to find out which note you played, and do that fast enough. Even for my 1.5 octave version, I couldn't loop over the keys fast enough to capture dynamics in any playable way.

Ideally, you want to use interrupts. I don't think I knew what those were when I did this thing. Basically they allow you to create event-based triggers, rather than just checking every key constantly. The thing is, no board is going to allow you to create 48 triggers. Have a look here to see how many every board offers:

https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

If I would redo this project now (heck I even might if I can find it), I'd divide the keys in groups and attach them to interrupts. Then, once a group is triggered, loop over the keys to see which one was played. More interrupts = smaller groups = faster tracking.

Also check this out:

Oh and for the MIDI circuit, that's been done many times, plenty of resources on google.

Hope you have fun building this!

Awesome idea! for ease of coding and speed, if i had a board with 4 interrupts, would 12 piezos attached to each create a low enough latency for this project to work? thanks

Honestly I don't know, you will have to test. My guess would be it's too much, but it's just a guess.

Also, do you want to capture dynamics, or merely triggers at a constant MIDI velocity? In the first case, you will also need a lot of analog inputs..