A maths teacher who persistently hears music playing in her head has teamed up with scientists to learn more about the condition.

Sylvia, 69, has suffered from the rare condition of musical hallucinations for the last decade after she started to go deaf about 20 years ago.

At first she developed severe tinnitus but this lead on to what has been called "the ipod in her head" and due to her musical knowledge she was soon able to notate what she was hearing.

"I did everything I could to get rid of them but they persisted, always in a minor key and therefore a bit depressing," she said.

"Eventually the number of notes increased until they seemed to be parts of tunes. One day I recognised something and, once I had done so, more and more phrases from classical music appeared in my brain."

Some pieces of music that Sylvia was hearing included Gilbert and Sullivan's HMS Pinafore and music by Bach. She also found that by playing music herself, she was able to alter the music in her hallucinations.

Along with Sylvia, who declined to give her surname, scientists have now been able to identify the areas of the brain that are affected during the hallucinations.

Dr Sukhbinder Kumar, from Newcastle University and lead author of the paper, said: ''We found that a network of brain areas, that are usually involved in processing of melodies and retrieval of memory of music, were particularly active during hallucinations of music in the absence of any sound or music being played externally.

"This also explains why listening to an external piece of music suppresses hallucinations. When external music is playing the signal entering her brain is much stronger and more reliable, which constrains the aberrant communication going on in the brain areas during hallucinations."

It is hoped the study, which also involved experts from University College London, may lead to better treatment in the future for those that suffer from the condition.