It was the early 1960s. Herbie Hancock was a young, upcoming pianist in the jazz world playing at a concert for trumpet legend Miles Davis.
"The band had the audience in our pocket, so to speak, and they were on the edge of their seats, really excited," recalls Hancock, 74.
"And then right in the middle of Miles' solo, I played a chord that was really, really wrong, really bad, and I thought I destroyed everything."
Davis' reaction caught him off guard.
"Miles actually took a breath, and then he played a note that made my chord right. At first, I thought he was some magician. Later, I realised he didn't judge my chord as right or wrong, he heard it as something that had happened and he wanted to embrace it."
The big lesson that Hancock took away from the episode was one that would guide him throughout his long and fruitful career - never be judgmental.
Now one of America's most acclaimed musicians and composers, with half a century's worth of experience, he says it is perfectly okay for musicians to make mistakes when they play onstage.
"In so many cases, when we are judgmental, it affects our perspective in a very negative and distorted way. And that comes very often from us thinking that there's only one way to look at things. In fact, there is an infinite number of ways to look at things.
"Sometimes, when you have the wisdom to perceive the most valuable way of looking at a situation, or a way to perceive it so it creates value in some way, or you are able to use it to create value, you actually transform it from something that is negative to something that is positive."
He was speaking to Life! in a telephone interview ahead of his first gig here, to be held at the Esplanade Concert Hall on Tuesday.
The 14-time Grammy winner's liberal attitude towards music is evident in his vast body of work which, to date, counts 41 studio albums, 12 live albums and five soundtracks.
While he is primarily regarded as one of the most important living jazz practitioners today, he is also widely known for his forays into contemporary genres including electro, techno, hip-hop and R&B.
In fact, one of his most famous songs is 1983's Rockit from his 35th album, Future Shock. Acknowledged as the first jazz/hip-hop hybrid, the song did not just bring the technique of recordscratching into the mainstream, but it also became an anthem for breakdancers and hip-hop culture in the early 1980s.
Written together with ground-breaking bass player Bill Laswell and synth player and drum machine programmer Michael Beinhorn, Rockit was a No. 1 hit on Billboard's dance charts; and its striking video, featuring robot-like dancing sculptures, picked up five wins at the 1984 MTV Video Music Awards, including for Best Special Effects.
Hancock has not stopped his wide embrace of all forms of music. His most recent album is 2010's The Imagine Project, a compilation of covers reinterpreted by a host of collaborators from different musical backgrounds, ranging from pop singer Pink and modern soul singer John Legend to blues couple Derek Trucks and Susan Tedeschi, and Congolese group Konono N°1.
One of Hancock's newest works will be a collaboration with cross-genre electronic act Flying Lotus, acclaimed as one of this generation's most trailblazing producers.
"I've had the chance to do a couple of things with him, really far-out stuff that he's doing. I'm interested in working with new people in my next project," says Hancock, who now serves as the institute chairman of the Thelonious Monk Institute of Jazz and creative chair for jazz for the Los Angeles Philharmonic Association.
While he did not elaborate on future albums, Hancock has another release coming out that is important to him - his long-awaited memoir, Herbie Hancock: Possibilities, to be released next month.
"In the late 1990s, Quincy Jones was telling me that I have to write a book. He said, 'Your memories are gonna get shorter and shorter and you're gonna forget the names and so many things, you just start writing the book now.'
"I listened to him but I wasn't that interested at the time and I was also quite busy. It was just in recent years that I felt it was important to tell my story because I learnt so many things, had so many great teachers and have been encouraged by so many amazing people that I felt I should do it before my memories start to fade too much. They've already started to fade too much."
A child prodigy born in Chicago who was trained in classical piano, he was hand-picked by Davis to be part of his quintet in 1963 - his earliest claim to fame.
Even though he had already released his debut, Takin' Off, in 1962, Hancock, bassist Ron Carter and drummer Tony Williams were still considered newbies and had the unenviable task of living up to the much-lauded musicians in Davis' previous line-ups, which included jazz greats such as John Coltrane.
The five years he spent in the group was also the time when he learnt to develop his own style.
"Davis taught me the importance of... not being afraid to come out of your comfort zone," Hancock recalls.
To their credit, he, Carter and Williams took on their roles in Davis' groups with aplomb and today, the line-up is remembered as Davis' Second Great Quintet.
Hancock's post-Davis work includes forays into funk (1969 album Fat Albert Rotunda) as well as a jazz-rock line-up from 1969 to 1973 that delved into the avant-garde with electronic instruments and experimentation.
His work with electronic instruments such as synthesizers continued with his 1970s jazz-funk line-up, which released 1973's successful Head Hunters, an album that crossed over to the mainstream audience.
Hancock's 1980s input covered a whole variety of genres, from pop-jazz hybrids that divided critics to more traditional jazz outputs with the Marsalis brothers, trumpeter Wynton and saxophonist Branford. In 1986, he acted in and composed the soundtrack to jazz musical drama film Round Midnight, a work which earned him an Oscar for Original Music Score.
His criss-crossing between jazz and more modern genres continued in the next two decades, with some of his more prominent releases coming in the form of tributes to other music luminaries. These include 1998's Gershwin's World, jazz reinventions of the works by American greats George and Ira Gershwin; and 2007 album River: The Joni Letters, which paid tribute to his close friend Joni Mitchell and earned him Album of the Year at the 2008 Grammys, beating contemporary acts such as Foo Fighters, Amy Winehouse and Kanye West.
This spirit of reinvention will be evident at his Esplanade show. Fans who are familiar with some of his standard tunes, such as Watermelon Man from his 1962 debut album and 1964's Cantaloupe Island, can expect to hear them in a whole new light.
"We do Watermelon Man but a completely different arrangement than on any of my records. We've updated it. I've combined it with some elements of one of the songs that guitar player Lionel Loueke wrote, giving it a different flavour. We do Cantaloupe Island, but we combine that with another song called Flying that Lionel wrote, and we go back and forth and play around with that."
Hancock, who is married and has a 44-year-old daughter, adds: "I'm also doing some stuff I did back in the 1960s - people haven't heard me do that in years. In a way, it's retro, but the technology that allows me to play it live didn't exist back then. I had to do it with overdubs but now I can do it live, and that makes it fresh."
The composer, who is a practising Buddhist, does not intend to slow down anytime soon because, to him, music serves a greater purpose.
"For me, it's not just notes or chords, that's not what motivates people. It's what's behind it. What is the message? What is it that the artist wants to convey in the music?
"I'm very interested in anything that promotes bringing together people from various sides of this planet that we live on, from various viewpoints and various cultures.
"I'm interested in anything that can start bringing people together, helping them have a unified vision, that includes the happiness of everyone, that includes respect for all human beings."
Herbie Hancock's top five mainstream hits
1 FUTURE SHOCK (1983)
The first release from his electrofunk era, the album contains one of his best-known hits, Rockit, which topped the American dance charts. It popularised the music technique of record-scratching and also became an anthem for breakdancers and hip-hop fans in the early 1980s.
The video became a staple on MTV, introducing Hancock's music to a new generation of listeners.
2 RIVER: THE JONI LETTERS (2007)
His 47th album received a lot of attention in 2008 when it picked up a surprise Album of the Year accolade at the 50th Grammy Awards, besting highly touted releases by more modern acts such as Kanye West, and was the second jazz album in the history of the Grammys to pick up the award.
The tribute to his close friend, singer-songwriter Joni Mitchell, features reinterpretations of her tunes and collaborations with younger acts such as Norah Jones as well as veterans Tina Turner and Leonard Cohen.
3 THE IMAGINE PROJECT (2010)
Recorded around the world, Hancock roped in popular and chart-topping contemporary acts including Pink, John Legend and Dave Matthews, jazz veterans such as Wayne Shorter and African acts Konono N°1 and Tinariwen.
The album picked up Best Improvised Jazz Solo and Best Pop Collaboration with Vocals at the 2011 Grammys.
4 HEAD HUNTERS (1973)
One of the most acclaimed releases in the jazz funk genre, Head Hunters is one of Hancock's highest charting albums in Billboard's mainstream charts, where it peaked at No. 13.
A Billboard review from the year of its release described it as proving that "music can be fun as well as funky and still be art".
5 POSSIBILITIES (2005)
Hancock's 45th studio album introduced him to a newer generation of listeners through a long list of guest artists that include popular names John Mayer, Damien Rice and Christina Aguilera.
It was nominated at the 2006 Grammy Awards for Best Pop Collaboration with Vocals and Best Pop Instrumental Performance, but did not win.