Midi Mellotron(controlling motorspeed with midikeyboard)

Hi!
I have an old midikeyboard(25 keys) and I want to control the speed of a motor with it.
I want to have 25 "fixed" speeds, one on every key.
How do I solve this?

A MIDI keyboard sends a different MIDI message for each note so you read those messages and use them to control the motor.

Reading the messages is easy enough and there are libraries and lots of example projects available to get you started.

Exactly how you control the motor is going to depend on what sort of motor it is, what it's driving and how accurate the fixed speeds need to be. If you want them accurate enough to create musical notes as in a Mellotron then you're probably going to need an encoder on the motor.

Steve