He was an extraordinary musical talent who disappeared from the public eye for more than 30 years.

Now the brilliance and mental struggles of Syd Barrett, the songwriter immortalised by his band Pink Floyd which he left in 1968, is to be explored in a new play by the Scottish author and playwright Alan Bissett.

Bissett has been commissioned by the Scottish Mental Health Arts and Film Festival to write the play about Barrett, who lived from 1946 to 2006 and who rose to prominence in the late 1960s London psychedelic scene.

With early Pink Floyd he recorded singles and wrote a significant amount of the famous rock band's first album.

However a mixture of extensive drug use, notably LSD, erratic behaviour and mental health issues led to a breakdown which ultimately led to Barrett, real name Roger Barrett, to withdraw from the music industry and public life altogether.

Pink Floyd's song Shine On You Crazy Diamond was a tribute to Barrett, as is the song Wish You Were Here.

Launched in 2007, the Scottish Mental Health Arts and Film Festival (SMHAFF) involves more than 300 events and 25,000 attendees across Scotland each October.

This year’s festival, led by the Mental Health Foundation,, will open on World Mental Health Day on 10 October, and run until 31 October.

The Barrett play is called One Thinks of It All As a Dream and will premiere at Glasgow's Oran Mor in October, before touring to the Traverse in Edinburgh and the Lemon Tree in Aberdeen.

Bissett, whose books include Boy Racers, Death of a Ladies’ Man and Pack Men, and whose plays include The Moira Monologues and The Pure, the Dead and the Brilliant, said it will not be a play about drug use but a look at a talented musician and the influences and pressures on his mind and music.

"At the centre of it is a man in pain," he said.

He added: "Syd Barrett is unique in rock n roll history, and certainly haunted Pink Floyd's music after he left.

"There's no figure quite like him - which is itself attractive to a dramatist - but I also wanted to explore his multi-faceted character.

"He was by turns charismatic, selfish, principled and vulnerable.

"The legend of 'Mad Syd' has been enshrined in rock lore, but I wanted to get past the acid-casualty cliches to try and find the man beneath, in all his complexity."

Bissett said the four-person play could contain live music or Pink Floyd recordings but "will not be a rock musical".

The festival programme also includes Eve/Adam – a partnership with the National Theatre of Scotland - which is a double bill of new shows telling the stories of transgender lives.

Eve has been created by writer and performer Jo Clifford and award-winning theatre-maker Chris Goode and Adam is directed by award-winning theatre director Cora Bissett, has a score composed by Jocelyn Pook and has been written by playwright and dramaturg Frances Poet.