I begin typing up my story about Codebreaker, a new composition about the life of brilliant mathematician Alan Turing, and then stop, fingers resting on my keys.

I am overcome by a wave of sadness for the man who famously worked at Bletchley Park during World War Two cracking messages from the Germans using the Enigma machine and who was also the father of modern computing.

Without him I may not even have a computer to type his story on. A story which ends with his genius being cut tragically short.

Just ten years after he broke a code which saved the battle of the Atlantic he was being arrested for homosexuality, then illegal, his security clearance was revoked and he made the horrendous choice to be chemically castrated as an alternative to prison.

The Maida Vale-born mathematician was only 41 when he committed suicide two years later by eating an apple covered in cyanide.

Muswell Hill’s David Temple, musical director of Hertfordshire Chorus, admits that like many he was in the dark about Turing’s story and the project almost never happened.

“My original idea was for a piece about Justin Fashanu who was the first openly gay footballer and committed suicide. Someone from the chorus suggested Turing, but I hadn’t heard of him at the time.

“It’s strange how it has become so topical.“

Later this month he will conduct 150 chorus singers and a 60-strong orchestra in a world premiere of Codebreaker at the Barbican and the event has already attracted attention from celebrities such as Stephen Fry.

But back in 2012 when he asked James McCarthy to write the piece Turing’s achievements were vastly under-recognised.

It was only when British Prime Minister Gordon Brown made an official public apology on behalf of the British government on September 10, 2009, for “the appalling way“ Turing was treated that his legacy came more fully into the public eye.

Since then there have been celebrations to mark 100 years since his birth on June 23, 1912, The Queen gave him a posthumous pardon on December 24, 2013 and a film, The Imitation Game, starring Benedict Cumberbatch, is due out this year.

But composer James McCarthy says it has not been easy to decipher the man behind Codebreaker: “He didn’t leave much behind at all so a lot of how he was feeling has been guesswork. I’m sure audiences won’t agree with everything I have done, but I used my instinct.

“It’s about his emotional life and how the war affected him, and being persecuted.“ The 34-year-old immersed himself in Turing’s life to write the piece, even cycling the routes the mathematician ran through London, and says: “It’s an amazing life. I think a lot of people will be surprised by the stuff he did apart from the work at Bletchley.

“He founded artificial intelligence as a concept and was an Olympic quality runner. And his tragic death made him an important figure in the (lesbian gay bisexual transgender) LGBT community.“

He based Codebreaker around a letter written by Oscar Wilde when he was incarcerated in Reading Prison and poems written by Wilfred Owen and Sara Teasdale.

“It starts with him falling in love with Christopher Morcom who he met at school,“ says James. “I think that was really important for the rest of his life even though Morcom died at 18, because he wrote to Morcom’s mother saying he hoped he could fulfil his potential for him and that’s what drove him to succeed.

“So it’s a love story and at the end I give them a reunion. I just couldn’t leave him in that horrible place where he died, so I gave him a bit of paradise.“

Barbican, April 26. Details: hertfordshirechorus.org.uk, barbican.org.uk