Newborn babies can remember melodies played to them while they were in the womb, according to a study.

Scientists found that the brains of babies who heard a specific melody just before birth reacted more strongly to the tune immediately after they were born and at four months.

In the study involving 24 women in the final few months of pregnancy, half were asked to play Twinkle Twinkle Little Star to their foetuses for five days a week. The scientists then played the tune to the babies after they were born and measured their brain activity using electroencephalography.

Their results, published in the journal PLoS One, showed that the babies who were played the song in the womb had a stronger electrical response in their brain to the song after birth, when compared with a control group of babies.

"Even though our earlier research indicated that foetuses could learn minor details of speech, we did not know how long they could retain the information," said Eino Partanen, at the cognitive brain research unit of the University of Helsinki. "These results show that babies are capable of learning at a very young age, and that the effects of the learning remain apparent in the brain for a long time."

The difference between the two groups was only apparent when the original music was played, rather than a version with changed notes.

The scientists speculate that unpleasant or noisy sounds heard in the womb might have adverse effects: "It seems plausible that the adverse pre-natal sound environment may also have long-lasting detrimental effects. Such environments may be, for example, noisy workplaces and, in the case of pre-term infants, neonatal intensive care units."