Arduino + piezo sensors to make grand piano to a midi-controller?

Hello,

I'm planning on a project transforming an old grand piano to a midi controller. Initial plan was to use optical midi strip under the keys, called PNO Scan by QRS. But this has some flaws. First, the movement of the keys are detected instead of the hammers. Hammers striking the strings is the one making the sound on a piano and not so the key movement. Keys can be played with so many variating ways in different situations. Second, only one triggering point can be programmed, but there are actually several in a real grand piano action, especially if defined in key movement and not hammer movement. Addition, the sensors are reported to be a little inaccurate sometimes and may give false velocities on certain circumstances.

I thought to take this project a step further, and make own sensor system. It would use piezo sensors the detect the force of the hammer strikes and transfer it to a midi signal with corresponding velocity. Another sensor would be in the dampers. It could be only on/of-type, though sophisticated keyboards gives velocity also for note-off command (usually measured from key movement). Addition to these, the sustain and soft pedals would have sensors with triggering points.

When the dampers is lifted, and piezo sensor gets strike, a note-on midi signal will be sent with corresponding velocity. When damper is back at rest, a note-off signal is sent. Pedal sensors detects position of levers, and have triggering points programmed (this will enable half-pedaling instead of on/off only).

Here are some questions:

  1. The piezo sensors
  2. What type of sensor, if any, would be suitable?
  3. Can handle the force range the hammers may produce? (not sure yet how much, maybe ~ 0-100 N?)
  4. Can accurately (127 different velocities can be defined) give voltage to certain amount of impact? Same reading to same impact every time?
  5. Will last in use without gradually changin readings because wearing out?
  6. Is there something more suitable than piezo? Please note: the price of the sensor will be multiplied with 88 since there are 88 keys!

  7. Arduino

  8. What type of Arduino, if any, is suitable for this?

  9. 88 piezo sensors + ~70 damper sensors (high notes doesnt have dampers) + 2 sensors for pedals

  10. Number of input ports might be a problem, is there any ways to extend these?

  11. Will latency be problem? Latency should be less than 5 ms from hammer strike to midi out signal, because the later processes also have their latency before sound is heard, and it would not be playable anymore.

  12. How about "polyphony"? Will the Arduino get jammed calculating velocities in fast playing?

The price of the PNO Scan strip shipped is 681,00 euros, so that could as well be considered the budget of the project. But if individual sensor's price goes high, the price will be enormous because there are 88 keys.

Now the funny part is that I'm totally a newbie, when it comes to Arduino, electronics or programming. But don't let that bother, for me it makes this even more interesting, yet there are hell a lot to learn to make this work ;)

Best regards, Tuomas

ask Yahama's engeneers! If I should build something like what your'e wishing for, it would cost me a 100 times the costof a prebuilt, pro synth..

Or another similar figure of speech.

However you might imagine it, there is no way to alter the playing of a piano note other than by altering the velocity of the keystroke, so the "PNO Scan" does not - in itself - have such "flaws" but performs the task perfectly adequately.

I point this out not from any affection for the device, which I have not previously come across, but as a matter of simple pragmatism.

As knut_ny points out, you would be lucky to replicate the PNO Scan for the price, let alone improve on it. Most basic synthetic piano keyboards simply use a pair of contacts (such as a simple changeover) to assess velocity. Such contacts could be polled by single Arduino inputs using selective control of the internal pullups.

Well, I could as well buy a CD that has piano playing recorded to it. Then I wouldn't even need to practice the piano playing, how convenient! Seriously, I thought this forum is full of people who thinks outside the box and want to make the impossible to possible, even with the risk of failure.

Actually, even replicating the PNO scan is not difficult or costly, one guy just made his own and I don't think the parts costs a lot more than 100 dollars. But I won't do the effort if there is no improvement.

Paul__B: However you might imagine it, there is no way to alter the playing of a piano note other than by altering the velocity of the keystroke, so the "PNO Scan" does not - in itself - have such "flaws" but performs the task perfectly adequately.

In real acoustic grand piano action, the note can be played from the jack or the repetition lever. If we now move from the action to the key, we can actually find several so called "triggering points" from the key movement, that makes the hammer strike the strings, depending also from the current movement of the hammer. This means that we can press the key just 1/3 depth with enough force and play a note. Or we can lift the key just 1/3 from the bottom and then make another strike, playing a note again.

The Pno scan detects the position of the key continiously. It has one triggering point, which means the note is played when the key crosses this point, with the calculated velocity. It has also detriggering point, which is above the triggering point, and this needs to be passed before note can be played again.

Now if you think the differences between these systems, you can see that the PNO Scan cannot completely do what is happening in the real piano action. I haven't had a chance to test this product to see wether this will be a problem, and I won't without buying it first.

However,I wish you guys could put the rationality of the project aside, and concentrate to the feasibility when it comes to the piezo sensors and Arduino. I'm after this project because I find it fascinating, not because I need this desperately to work.

I don't know much about the piezo sensors yet, but if they are accurate enough to detect even sound, and they can handle some force also, makes me think that they could be able to accurately "measure" the impact of the hammers. But I'm afraid of the aspects I put in the first post. Please share your expertice! :)

Best regards, Tuomas

Tuomasa: Actually, even replicating the PNO scan is not difficult or costly, one guy just made his own and I don't think the parts costs a lot more than 100 dollars. But I won't do the effort if there is no improvement.

I haven't looked into the actual mechanism of the "PNO Scan" but if indeed you can replicate it cheaply, that would seem to be a good approach, as you can replace the objectionable triggering points with incremental velocity and acceleration algorithms to model what you have described. That much is relatively straightforward.

Your suggestion on the other hand, of using piezoelectric discs as impact sensors is certainly possible, but involves a number of practical difficulties. Common piezo discs are at least 15 mm in diameter, and I cannot quite see how you can have the hammers hit them as well as the strings, or are you going to remove the strings? The dampers would be monitored by opto-interrupters, but this again becomes involved if you propose to add this to an already functional piano mechanism.

You will need "conditioning" of the piezo discs' output and you want an analog assessment of these so you have to have 88 analog inputs - a non-trivial matter and a challenge in simultaneous processing - an Arduino is not as likely to fit the bill.

Paul__B: Your suggestion on the other hand, of using piezoelectric discs as impact sensors is certainly possible, but involves a number of practical difficulties. Common piezo discs are at least 15 mm in diameter, and I cannot quite see how you can have the hammers hit them as well as the strings, or are you going to remove the strings? The dampers would be monitored by opto-interrupters, but this again becomes involved if you propose to add this to an already functional piano mechanism.

Indeed, most of the piezos seem to be a bit too large, but I guess there would be appropriate ones also, as they seem to come in many different sizes and shapes. My plan, when using the PNO Scan, was to leave the strings but make them shorter so that the hammers can strike on them and dampers rest on them. But if done with the piezo sensors, I would remove the strings alltogether, and make new mountings for both the hammer sensor and dampers sensors. I would experiment with different materials in the mounting, to have it close to the bounce effect that the real strings produce, i.e. putting some elastic rubber behind the sensors or something similar.

Paul__B: You will need "conditioning" of the piezo discs' output and you want an analog assessment of these so you have to have 88 analog inputs - a non-trivial matter and a challenge in simultaneous processing - an Arduino is not as likely to fit the bill.

This was one of my concerns and exactly the kind of information I was looking for. For example the Arduino Mega has only 16 analog inputs. Is there any convenient way to overcome this problem, still using Arduino platform, or what kind of hardware would be suitable for my project, still being "easily" programmable?

Could anyone please advise on this multiple analog input problem?

Would it be possible to use multiplexers to overcome this? Or is there any suitable ADCs I could use in the middle and then play with the digital data only on Arduino?

Here is the summary:

  • 88 analog piezo sensors
  • 70 on/off-type switches
  • Includes algorithm based on the input sensors/switches and sends midi signal out
  • Could handle ~20 signals/sec per channel (cannot play faster than that anyway)
  • ~128 simultaneus commands, “polyphony” when playing
  • system total latency <5 ms to midi out signal

If I could define the needed hardware, I could buy the necessary parts for few keys and start experimenting. Thanks!

BR,
Tuomas