It was fairly typical of me to imagine I could dive into the shallow end of a swimming pool and emerge unscathed – at 39, I still had a pretty devil-may-care attitude to life. I'd imagined rolling as I hit the water, barely breaking the surface. But as my head hit the tiles, I knew I'd miscalculated badly, and that the injury was serious. I shot up out of the water like a rocket, hands over my ears, convinced they were bleeding. My friends ran over to drag me out, but I was unable to stand, and although I could see they were talking to me, I couldn't hear a word.

I'd been having a pool party while visiting my mother, and once out of the emergency room, I stayed with her for the next few days. I was diagnosed with serious concussion, and was told my 35% hearing loss would remain, and gradually worsen over time, as would my memory. My eyes were black and my whole body ached like I'd been beaten up. My vision seemed blurry, too. I could see blobs moving in my peripheral vision, and had a strange sense of agitation. My fingers wouldn't stop moving and even when I concentrated I found it difficult to stop them. But by the fifth day, I felt well enough to leave my mother's and started packing to go home.

In the early evening, I went over to my friend Rick's house to say goodbye. Rick is a musician and lives in an apartment full of instruments. We were just sitting around, talking, when I felt an intense, utterly compelling need to touch his piano. I just moved over and started playing – there was no transition, it was all at once, like I'd been doing it all my life.

I'd played guitar in a couple of little rock bands when I was young but I'd never progressed beyond that on any instrument. Yet here I was, producing a fluid melody I'd never heard before. Rick stared, open-mouthed. "Derek," he said, "What's going on?" I had no answer. I just wanted to keep playing.

The "blobs" had resolved into moving black and white blocks in my mind, that seemed to flow from left to right in a wave pattern. My fingers simply followed the movement of the squares. I realised the music had been writing itself in my unconscious ever since the accident – now, at last, I was simply letting it out into the world. The sense of release was incredible, and I kept playing for hours.

Six years on, the moving shapes are still going, and I can hear the music in my head 24 hours a day. I've been analysed by neurologists, and my condition has been diagnosed as acquired savant syndrome. There are others like me who, following a head injury, develop a striking ability never before hinted at – but I'm the world's only documented acquired musical savant. I'm told the shapes I see are a form of synaesthesia – a union of the senses that allows me to literally "see" the music I'm composing.

It's as if my knock on the head unlocked something latent, or enabled me to use some part of my brain I simply couldn't access before. But I still can't read or write music conventionally, and have to rely on special software to translate what I play into scores. I've played alongside a classically trained concert pianist, who was fascinated by my technique – in some respects, I play like someone who has just started learning, in others my skills outstripped his. It can be exhausting, though. The music often keeps me up at night, and I'll sometimes wake my girlfriend by "playing" her arm in my sleep.

I'm also worse off financially. At the time of the accident, I had a corporate job with a good salary, which I quit to concentrate on my music full time. But I've never been happier, and am determined to take this gift as far as I can while I have it. A neurologist warned me that acquired savant syndrome can desert a person as quickly as it arrives, and I've resisted the anti-seizure drugs doctors have offered to slow me down and provide some respite – what if my musical abilities simply disappeared? I never take the music for granted. My children have even bought me a whitewater-rafting helmet in case I bang my head again and reverse the process.

But if it does go away, I hope I'd be able to say, "I had this beautiful thing for five, six years and I guess now I have to go back to a regular job. But it was certainly an interesting ride."

• As told to Chris Broughton

Do you have an experience to share? Email experience@theguardian.com