On a freezing February night in 2006, an ailing Luciano Pavarotti rose from his wheelchair at the opening of the Turin Winter Olympics to give a resounding rendition of the aria Nessun Dorma, his final public performance before he died of cancer last September.

Details have emerged of how the opera singer was unsure of his weakening voice and faked the live appearance in front of a TV audience of millions, using video trickery, careful lipsynching and a compliant orchestra that pre-recorded its backing days earlier.

"Pavarotti's great career therefore ended with a virtual performance, something sad but inevitable," said Leone Magiera, the star's longtime pianist and conductor, who has revealed the ploy in a book. "It would have been too dangerous for him, because of his physical condition, to risk a live performance before a global audience."

Magiera said that the trick took days to set up. "First I recorded a number of versions of the orchestra playing the aria, then [I] took the tapes to the small studio at Pavarotti's house in Modena," he said.

"He selected the right version before I directed him alone as he sang along, while being recorded."

In the book, Pavarotti Visto da Vicino, or Pavarotti Seen from up Close, Magiera says: "He found the force to repeat it until he was completely satisfied. Then he collapsed on his wheelchair and closed his eyes, exhausted."

Less than a week later, just before the Olympics ceremony, Pavarotti was filmed on stage miming to the recordings as the orchestra pretended to play behind him.

On the big night, that video was played for TV audiences along with the pre-recorded music, while crowds in the stadium heard the music and saw conductor, singer and orchestra faking it for a second time.

"The orchestra pretended to play for the audience, I pretended to conduct and Luciano pretended to sing. The effect was wonderful," Magiera wrote in the book.

The effect was good enough for one fan who wrote on YouTube after watching the video: "Knowing when to cut off that final high note to match a tape would be next to impossible ... It's live, it's him."

Looking back, Magiera said he preferred to recall another performance given by Pavarotti in the 1990s, this time to a deserted opera house in the Amazon jungle. Built in 1896 for rubber barons, the opulent Amazon Theatre featured in the film Fitzcarraldo.

"He was determined to sing at the old opera house in Manaus, where he was convinced Caruso had once sung," he said.

"We went up there by boat, located a piano but found the theatre out of use. Nevertheless, we went in and he sang two arias from Tosca, E lucevan le stelle and Recondita armonia to an audience of about five."

Magiera's memoir details Pavarotti's struggle to work, even as he succumbed to pancreatic cancer. While giving lessons to young singers, he would drift off, whereupon his Peruvian assistant would ring him on his mobile phone. Jerked awake, Pavarotti "would immediately make a more or less relevant observation about the performance he had only partly listened to".

At the end, even his legendary appetite deserted him, Magiera writes. When he could not eat the plate of rigatoni he had asked for, "he looked at me with a sad smile and said 'That's a bad sign for me if I prefer mashed potato to macheroni'."