I think the best thing is to ask them to warm up with something basic like a scale, and let them work their way up as their comfort level increases. I knew some people who were particularly pleasant and easy going, so they were able to relax people suffering from performance anxiety.
There are interviewers who treat coding interviews as a high pressure, adversarial exercise, though. On the other hand, those sorts of people are rarely a joy to work with.
Performing a piece of music in a high-pressure situation is exactly a professional musician's job, so an audition is quite appropriate. Another analogy could be to ask a professional composer to play one of his pieces on piano rather than listening to a competent orchestra perform it--you're using one thing as a proxy for another. Many composers would ace it--they're great players. Some aren't, though, so you'll hire only composers who happen to be great performers. It's a dumb analogy in another way, though: you only need to know whether you can work with a composer, their work should stand on its own. I suppose if we engineering types all wrote code that went into public repositories the same might be true of us, and we wouldn't be asked to perform like trained monkeys.
There are interviewers who treat coding interviews as a high pressure, adversarial exercise, though. On the other hand, those sorts of people are rarely a joy to work with.