Shop OBEX P1 Docs P2 Docs Learn Events
technologies to detect mallet-hits including the dynamic — Parallax Forums

technologies to detect mallet-hits including the dynamic

StefanL38StefanL38 Posts: 2,292
edited 2016-09-27 08:34 in General Discussion
Hi Everybody,

I have some kind of a dream that is spinning in my head for a long time.
What I would like to do is using something similar to a xylophone to play music.

The special thing about it is to detect the hit of the mallet electronically including how "fast" or "hard" the hit is.
As data how loud a classical xylophone or metallophone would respond to the hit.

I want to use this to create different kinds of sound via MIDI. So the device gets a hit on a certain xylophone-bar
and then the µC (Propeller-Chip) creates a MIDI-signal with the according frequency and volume.

But I have no idea what kind of technology could be used as the detector that can also detect the effort that is inside
the hit of the mallet at low cost.

Of course some kind of piezo-detectors etc. could be used but I guess they are too expensive.

The main goal behind all of this is to create a musical instrument that can be played as easy as a real xylophone with
two mallets but can create any kind of sound through the electronic detection of the hits.

In E-pianos two switches which turn on at different points when the piano-key is on its way down
deliver info about the volume but on xylophone-bars a move of 10mm through a hit by mallets
would be bad of you want to play fast.

Does somebody know the technology used in electronic drum-kits?

I like developing with electronics but in this case my main goal is making the music.
So if somebody knows of devices that can be bought of the shelf at a price of around $50
I would not have to develop it myself.

best regards

Stefan

Comments

  • kwinnkwinn Posts: 8,697
    Piezo Film Vibra Tab ( Product ID: 605-00004 ), accelerometers, and strain gauges are the first things that come to mind. They are all available from Parallax. A microphone to measure the volume from the hit along with switches/optical sensors to determine which bar was hit might also work. I’m sure other suggestions will be forthcoming.
  • AribaAriba Posts: 2,690
    edited 2016-09-27 17:17
    Piezo Sensors are really cheap, for example this here from Conrad

    You need to damp them with a resistor, then they will produce lower or higher voltage peaks depending on the force/speed you hit them.

    There are ready made 'Trigger to MIDI' converters, for example the MegaDrum as Kit or ready made.

    Andy
  • Hi kwinn,
    Hi Ariba,

    thank you for answering.

    Wow 0,27€ that's really cheap.
    If I understand right, the faster the hit, the higher the impact on the sensor the higher the voltage-output?

    Did anybody develop circuitry to measure the voltage
    on these piezo sensors with a propeller-chip?

    Guess I have to crawl the OBEX for objects and the internet for circuitry.

    best regards

    Stefan
  • AribaAriba Posts: 2,690
    edited 2016-09-27 19:23
    Here another Description

    Maybe you don't need an ADC. With some voltage offset it should be possible to get the hit speed as a number of high pulses, of which you need to count the overall high time:

    Piezo_In.png

    For sure this totally theoretical and untested, I don't even know how much voltage the sensor you buy will produce. The Poti should allow to adjust the sensitivity a bit.

    Andy
    511 x 264 - 7K
  • kwinnkwinn Posts: 8,697
    Ariba's suggestion would be ideal if it is workable, and it can easily handle multiple simultaneous mallet strikes. If you need multiple simultaneous mallet strikes and have to use an ADC things become a bit more complicated.
  • ercoerco Posts: 20,256
    +1 to the piezo disk idea. Cheap and sensitive. I used one on my "Knock Box". I didn't care about measuring amplitude but that def seems possible. My project sensed any impact, my "signal conditioner" was an LED across the piezo to tame voltage spikes.



  • Could they be matrixed? This is pin intensive even with a child's xylophone.
  • Hm they could be matrixed but then some combinations of two mallets hitting different bars would not work.

    But you are right it is pin intensive one chromatic octave means 15 pins.

    hm - maybe if shiftregisters are fast enough...
    I will do some calculations how fast shiftregisters can be.

    From a very rough estimation I would say shiftregisters are fast enough as long as you don't want to play 1/32 at 160 bpms.

    best regards

    Stefan
  • T ChapT Chap Posts: 4,223
    edited 2016-10-01 15:47
    One issue is increased latency with any piezo or vib type device especially when adding matrixing. Percussive triggers with latency can be annoying especially if you are monitoring the midi triggered audio at the same time. You can always slide the recorded notes forward after recording.
  • The vibra-tab can be connected directly to a sigma-delta ADC input on the prop, and that yields up both the analog frequency and amplitude. The tab acts as an integration capacitor, with the added feature that charge moves in and out in response to strain. The sigma-delta feedback has to respond dynamically to keep the voltage constant. The attached spin program uses a high value feedback resistor and is able to respond to low frequencies, which the demo program displays as an ascii graph on a terminal screen. The program does an auto-offset adjustment so that it can display both + and - swings linear-wise around the quiescent point. Extracting the frequency and amplitude information and converting to midi is quite another problem!

    The program also includes a circuit like the one Ariba posted above, a zero-crossing detector. Frequency yes, amplitude no.
  • A lot of the most popular drum machine pads were resistive. A few were two switch methods. Piezo would require good isolation, maybe not so easy on a xylo or other mallet based instrument. A resistive pad can be placed somewhere to accept some pressure.

    https://www.sparkfun.com/products/9376
  • Hello Tracy,

    thank you very much for your demo-code
    I did some googling about DIY drum-kits. Some of them use piezos. I understand the isolation-problem. With drum-Kits every pad could have its own stand = pretty good isolation. On something constructed in a xylophone-stile mechanical isolation is somehow challenging.
    maybe I have to give it a try how big the effect of "crosstalk" is.

    @T Chap: thank you very much for your idea to use force resitive sensors. Good option too.
    Thow the sensor costs more than a piezo-sensor.

    I have another idea how the mallet-hits could be detected: two light-barriers.
    The time between switching the two should be proportional to the strength of the hit of the mallet.

    Now as it goes into details of realisation I can see it is always the same. Pretty much development work has to be done.

    best regards

    Stefan
  • I used to use one or two of these with piezo pads attached to real drums to record the midi events into the computer simultaneously with the audio, then you could go back later and add samples to the original or replace the original audio. They worked really well and if there was a false trigger it was easy to see it and remove it.

    I am not sure yet if you are speaking about using a real instrument like a xylo and recording the midi for later triggering of midi? Or is this for live performance triggering of midi with the xylo making sound along with the midi source? Or if this is just a midi trigger ONLY device, ie the mallet hitting some pads that do not actually make sounds. It would make a big difference on design if it were just a trigger that did not make sound. I have thought about the two light solution before as well, using two detectors and one or two LEDs depending on the arrangement. On a trigger pad fake bar. The bar could have some travel up and down as it could sit on springs and allow maybe .25" travel, enough to allow a two LED switching scheme.

    For a scheme where you want the actual xylo to produce sound AND the midi source to produce sound at the same time, the latency can be a creative annoyance. Whereas, if the device is trigger only and you are only paying attention to the midi sound, you can perform with "anticipation" on the midi trigger pads to get the feel right meaning you learn to play with latency compensation, important on percussive devices much more so on other sounds.

    500 x 276 - 42K
  • kwinnkwinn Posts: 8,697
    It may be possible to determine the force on the piezo pads without using any form of adc by measuring the pulse width of the first half cycle of the waveform or by counting number of oscillations of the waveform before it decays below the pin's threshold voltage.
  • ercoerco Posts: 20,256
    Perhaps an accelerometer on each mallet and a simple switch on each note/bar of the xylophone.

  • Same as always (and I have prayed for it by others users: give an overview of what you are planning.

    I plan a device with fake-xylophone-bars that just creates midi-events.
    1 octave 16 chromatic tones maybe 25. If I have to decide between very accurate high dynamic but expensivier and "still enough for amateurs" but cheaper I decide for the cheaper path.

    Thow the latency should stay below 50 milliseconds. (don't want that android 0,3 seconds latency)

    Hm not sure which way to go. For the next weeks I have not very much time on really testing and developing.
    Just a little bit of time for some thoughts about pro and cons.

    Thank you so much so far for your comments and suggestions. If you enjoy answering
    you are welcome.

    best regards

    Stefan
  • kwinnkwinn Posts: 8,697
    erco wrote: »
    Perhaps an accelerometer on each mallet and a simple switch on each note/bar of the xylophone.

    Sounds like the simplest/best idea so far. May need to be a 3 axis unit to correct for the angle and rotation of the mallet, or perhaps the angle/rotation could be used for some effect.
  • I don't think it would work for cost but I wonder about an inductive method, where you could have threshold 1 set for about 1 inch away and threshold 2 for contact, using a two switch/time method for velocity sensing. The nice thing about some trigger that starts taking place prior to contact is to anticipate the latency as the switching is taking place prior to contact, so the switching and trigger could be timed to offset the latency effect.
  • kwinnkwinn Posts: 8,697
    One accelerometer per mallet for velocity sensing would be relatively cost effective, and an inductive bar/pad sensor would be more reliable than a switch as well as providing an early trigger signal.

    A xylopiano with round inductive pads instead of bars? Put magnets in the mallets and the accelerometers may not even be needed.
Sign In or Register to comment.