Alexander David James Grant, 18, appeared before Judge Michael Turner in the Dunedin District Court on Wednesday. (File photo)

A judge has discharged a drink-driving student after he was left stunned by a song he had composed.

Alexander David James Grant, 18, appeared before Judge Michael Turner in the Dunedin District Court on Wednesday.

He was facing a charge of drink driving following a police stop on Dunedin's George St on August 7.

Grant, who was then a first-year student, recorded a breath alcohol reading of 1077 micrograms of alcohol per litre of breath.

READ MORE:

* Christchurch man sent to rehab programme after incredibly dangerous driving

* Former alcohol rehab boss jailed on drink-driving charges

* Department of Corrections staff rack up speeding fines

He impressed when he appeared before the judge last year, and was given a chance to write a musical score before coming up for sentencing.

That score had to involve his experience as part of the Right Track programme – a driving related programme focused on young at-risk drivers and offenders.

And he did. In just three days he produced a song based on his experience, which was played through a Bluetooth speaker in the court.

Grant told the court the song was a reflection on his choice that evening, when he decided to drive some university friends to get food.

"You have exceeded my expectations," the judge said, after listening to the track, which included the lyric, "make a choice to rise above it all".

It was "very, very impressive", he said.

Grant was a first-time offender, had learned from his experience, and pleaded guilty back in August, the judge said.

Judge Turner noted his range of talents, particularly in music, and noted that the song was much like a letter of apology.

He hoped it would be heard and shared widely, and used by the Right Track programme.

Grant had claimed no copyright on the song, the court heard.

Counsel Cate Andersen argued his case was an appropriate one for a discharge without conviction, and Judge Turner agreed, although stressing he was not minimising drink-driving.

It would be wrong to mark Grant's record with a conviction, with Judge Turner in no doubt it was a one-off error of judgment.

​"I look forward to listening to more music from you in due course."​