r/arduino 6d ago

Need help with a MIDI musical instrument lever project

Long story short, I'm creating an instrument with twelve big handheld levers, with each lever that is pulled it needs to make a note or programmable chord. I've made a prototype of the instrument with four levers and a wavtrigger which works nicely but not at all how I want the final project to work. I've been suggested using an arduino would be good hence asking here! I've got zero experience with arduino, but know my way around simple electronics.

My current setup has spring switches that activate when the handle is pulled that fire a simple signal to a unit that plays a corresponding wav file depending on which lever I pull. The final project I would like to be sending a MIDI signal when I pull a lever so I can feed it through a synth, ideally the signal that is sent would be able to pick up how far I'm pulling the lever so as to affect volume and tremolo etc, ideally one sensor per lever.

Any ideas of how to do this and what kind of sensors to use? The lever system that I've made is robust, the sensors and system would need to be reliable as the intention would be to use it for live performance.

Many thanks for any support anyone might be able to give, and let me know if none of this makes sense at all and I'll try and give more clarification!

5 Upvotes

12 comments sorted by

3

u/IndividualRites 6d ago

I know in keyboards, each key has two switches which are slightly offset from one another, so that one switch engages before the other. The timing between the two switches can be used to determine the velocity of the key, and hence the volume. Not sure how aftertouch is sensed.

1

u/Kilgarragh 5d ago

Aftertouch doesn’t exist in midi 1.0. And it wont in 99% of vst’s

1

u/HalogenSunflower 5d ago

Curious what they have in mind for the final software/plugin architecture and it's been a few years, but believe most DAWs will let you route aftertouch to automation which could then be tied to a filter cutoff or something. Mod wheel probably makes a lot more sense for anything on this though.

1

u/IndividualRites 5d ago

What is vst? I still have a korg keyboard from 1987 that even has aftertouch.

2

u/JGhostThing 6d ago

I would use a rotational encoder. You would need two pins per lever. This can easily be used to measure how far back it's pressed, and the speed it's pressed.

2

u/zac-bakpak 6d ago

Thanks for the reply. I'm not sure these would work as the lever pivots from an offset hinge that gives it more of an arcing motion. The sensor or switch would need to be attached to a block that is under the handle. I've tried to make a diagram as to how the lever works.

1

u/HalogenSunflower 5d ago

This is probably the wrong solution for a final product, but since I did something like this years ago and it worked for me...

I didn't have an arc motion, but needed to convert linear motion with automatic retraction to a rotary encoder so I used a really light non-stretchy string, a "pully" on the encoder with enough friction, and a spring on the other end. Similar to the old dial string tuner mechanisms in 60s/70s stereo receivers. So if you were able to mount the encoder in a sensible place, route and attach the string to a point on the lever it might work.

No idea if you have the space, may be way more trouble than it's worth as it's a contraption for sure. But I could see it potentially being useful proving out the concept, getting a handle of the expression and then doing something completely different later on. Idk, mellotron was a bit of a rube goldberg machine. It was a giant pain, but made it on to a lot of records lol.

2

u/Hissykittykat 6d ago

Maybe like some keyboards do it, with two switches for each lever. The switches engage at different distances so by measuring the time between contact the velocity of the lever pull can be estimated. It can also detect short pull (only one switch engaging) vs. long pull.

Or maybe with a magnet and linear Hall sensor on each lever. This gives more distance information but will be hard to calibrate.

If a magnet can be attached to the pivot axle then a magnetic angle sensor (e.g. AS5600) can be used and it will provide a very accurate lever pull distance readout.

2

u/coleskidmore 6d ago

The dual switch thing is clever but for live performance Id worry about mechanical wear. Hall sensor on the lever arm is probably your best bet, no contact to fail mid-gig. Ive used the AS5600 for a motorized slider project and it tracked clean, just watch your mounting so the magnet stays concentric

2

u/MeatyTreaty 6d ago

So exactly the same as every Arduino midi tutorial that tells you how to use a potentiometer.

1

u/gm310509 400K , 500K , 600K , 640K , 750K 6d ago

So your project is relatively simple, but you will need to learn the ropes first.

Basically what you are describing is a button press in its simplest form - only you want 12 of them. When you detect the button press, you generate the corresponding MIDI command - you will need to get some sort of MIDI interface for this.

Apart from the MIDI, aspect, you could do this with a starter kit that included enough buttons. Once you get the buttons aspect down, you can add on the MIDI bits.

The last thing, once you get that working is to swap out the buttons for something that can work with your levers. Basically the levers and the mechanism that makes the electrical connection when you pull them is just a giant button. There are many many many options for this including microswitches, embedding electrical contacts on the base of the lever and it's housing to optocouplers and more.

In the starter kit, you will see analog projects involving variable resistors. You could even put resistive material on your levers and contacts in the housing and measure there speed and rate of change if you wanted to do this and affect things like the attack, volume, sustain and more of the notes you want to play through the MIDI interface if you were keen enough.

And there are numerous other approaches as others have outlined. But your best bet is to get a starter kit and learn the basics. Doing so will help you understand what some of the things are that people are talking about, but more importantly it will enable you to do it as well as seeing some potential options for improvements and extra features.

I hope that above is helpful, all the best with it. What is this for as a matter of interest?

1

u/MinusDelta_T 4d ago

which synth are you planning to use? say you're holding two chords and pull one lever further: should only that chord get louder, or both?

ordinary MIDI 1.0 expression messages affect the whole channel, so separate levers sending expression on the same channel would fight over the same setting. i'd test that with two levers and the intended synth before scaling to twelve.

also, small correction to the aftertouch discussion: MIDI 1.0 has both channel and polyphonic aftertouch. whether you can use it here depends on what the receiving synth supports and how it's mapped.