German researchers say babies begin to pick up the nuances of their parents' accents while still in the womb.
The researchers studied the cries of 60 healthy babies born to families speaking French and German. The French newborns cried with a rising "accent" while the German babies' cries had a falling inflection.
Writing in the journal Current Biology, they say the babies are probably trying to form a bond with their mothers by imitating them. The findings suggest that unborn babies are influenced by the sound of the first language that penetrates the womb.
It was already known that foetuses could memorise sounds from the outside world in the last three months of pregnancy and were particularly sensitive to the contour of the melody in both music and human voices.
Earlier studies had shown that infants could match vowel sounds presented to them by adult speakers, but only from 12 weeks of age.
Kathleen Wermke from the University of Wurzburg, who led the research, said: "The dramatic finding of this study is that not only are human neonates capable of producing different cry melodies, but they prefer to produce those melody patterns that are typical for the ambient language they have heard during their foetal life.
Newborns are highly motivated to imitate their mother's behaviour in order to attract her and hence to foster bonding
Kathleen Wermke, Unversity of Wurzburg "Contrary to orthodox interpretations, these data support the importance of human infants' crying for seeding language development."
Dr Wermke's team recorded and analysed the cries of 60 healthy newborns when they were three to five days old.
Their analysis revealed clear differences in the shape of the infants' cry melodies that corresponded to their mother tongue.
They say the babies need only well-co-ordinated respiratory-laryngeal systems to imitate melody contours and not the vocal control that develops later.
Dr Wermke said: "Newborns are highly motivated to imitate their mother's behaviour in order to attract her and hence to foster bonding. "Because melody contour may be the only aspect of their mother's speech that newborns are able to imitate, this might explain why we found melody contour imitation at that early age."
Debbie Mills, a reader in developmental cognitive neuroscience at Bangor University, said: "This is really interesting because it suggests that they are producing sounds they have heard in the womb and that means learning and that it is not an innate behaviour.
"Many of the early infant behaviours are almost like reflexes that go away after the first month and then come back later in a different form.
"It would be interesting to look at these babies after a month and see if their ability to follow the melodic contours of their language is still there."