I often tell my students that developing your memory is very much like exercising a muscle. It's not a knack; it's something that you do week in, week out. Indeed, most of my routine for memorising a piece is very simple: I practise it like fury. Often, pianists find it easier to remember a very fast and physically challenging virtuoso piece, because there's so much practice involved. Slower and more minimalist music takes a different type of memory.
Bach's Goldberg Variations is a good example of something especially difficult to memorise, because it's contrapuntal and highly complex, but also very virtuosic, and it lasts an hour. If I was going to play that, I'd be preparing it months in advance, practising for five to eight hours a day at a deep, calm and practical level. I'd play slowly, and attend to the things I know are complicated. It's like being an athlete training for the Olympics.
When you're younger, often what you're playing is less complex, and you tend to remember pieces quite naturally. Young pianists are often very quick and rely a lot on their muscle memory – like the kind we all use typing. This is dangerous, however; if you're nervous or tired or distracted on stage, it's the first thing to go. That's why you have to build up an intellectual memory as well; it's a question of having the piece at a very deep level. The night before a concert, pianists often run the entire performance through in their heads, not sitting at the piano.
Everybody has moments of forgetting. They are rare, but it's a natural part of being a musician. Having a blank moment when you're very young is absolutely appalling. The skill is to know the piece so well that you can improvise for a split second. With experience, you learn how to be calm and self-sufficient – and, as long as you improvise in the style of the piece, no one notices a thing.
• Joanna MacGregor is a concert pianist and head of piano studies at the Royal Academy of Music