RedShark News - Video technology news and analysis

How to make a virtual piano

Written by David Shapton | May 4, 2016 12:00:00 AM
Piano graphic by www.shutterstock.com

A virtual instrument may approach the quality of the real thing, but in the case of digitally modeled pianos, there are enormous obstacles to creating a truly faithful reproduction.

Think of a piano. You play a note and get a tone which fades away gradually. That's a true statement in one sense, but absolutely wrong in another, because a piano note is almost infinitely more complex than that statement would seem to imply. In fact, it's probably a better description of the sound of a doorbell. Here's why a piano is more complex.

First, piano keyboards aren't switches. They certainly don't have many degrees of freedom, but you can play them hard, soft or every stage in between and, between the loudest and softest note on a piano, there's a vast number of intermediate qualities of tone.

Overwhelming complexity

The most important thing to consider here is that a piano is a complex object. It's not a simple sine or square wave generator. In fact, it's one of the hardest instruments to model digitally.

What do we mean by digital modelling? It's completely analogous to making a computer model of an airplane or a racing car. The computer model is designed to behave like a real one, responding realistically to external inputs. A computer model of a saxophone would sound different to a sampled instrument, because it would generate tones based on how it was played. If you blow really hard, it might shoot up an octave. And you can do things with a model that you can't do with a sampled instrument: sliding realistically between the notes, for example.

But pianos have been stubbornly difficult to model, most likely because they're incredibly complex objects.

If you think about a xylophone, that would be relatively easy to model. You'd have to figure out how each note of the xylophone would react to being hit by a hard or soft hammer. Again, that's fairly easy, because the bars of a xylophone are simple shapes and would vibrate in modes that would be simple to calculate. With a piano, it's harder, for two main reasons. First, the higher up the keyboard you go, the more strings are used per note. These won't be tuned exactly, so the multiple, slightly different frequencies they produce they will 'beat' with each other. You have to take all this into account. Second, the strings are fastened to an iron frame and the frame itself vibrates when a note is hit, making all the other notes vibrate (although they're usually dampened, but aren't if the sustain pedal is pressed).

As certain notes are sounded, other notes will vibrate sympathetically. Still others will vibrate, even if they're not harmonically related to the original stuck note, simply because the impact of the hammer will be transmitted across the frame.

And finally, the sound from the notes and the frame of the piano will be transmitted through the wooden frame, which will itself vibrate.

There is absolutely no limit to the depth of nuance that could be modelled. Even the best model has to max out somewhere.

Shortcomings and Improvements

When you consider all of the above, it's easy to see why a sampled piano is never going to be perfect. It's because each sampled note will also record the entire set of resonances from the piano at the time the note was struck. That's fine, if you only ever play one note – it is a recording, after all. But if you play multiple sampled notes, you will also be playing back multiple sets of resonances. That doesn't happen with a real piano, because when you play multiple notes on a real instrument, the piano resonates uniquely to that combination of notes.

Piano samplers that create notes through pitch shifting an original note will sound even worse, because not only is the note shifted, but all the resonances are, too. It's as if the piano gets bigger or smaller, depending on whether you're shifting the note up or down. This is exactly the same issue as you get when you speed up or slow down a human voice.

But modelled pianos are getting better. Pianoteq has a very convincing modelled piano product.

Graphic by Shutterstock