While pregnant with my first child, I heard unsolicited advice typical of that showered upon expectant mothers.
"Don't eat spicy food," and, "Avoid garlic, especially when you're breast-feeding." But as a spicy food-lover I was sceptical, and reluctant to take heed. Human cuisines vary all over the world. Surely babies born to mothers in some of the world's spice capitals must learn to get used to breast milk with more flavoursome notes?
It was pure speculation on my part, but my personal experiment – played out with an unscientific sample size of just one – offered some support. My tiny experimental subject expressed his prenatally-learned love for Thai curry and garlic-spiced breast milk by way of contented guzzling, then guzzling some more.
Some more rigorous scientific research also supports the idea that babies learn taste preferences before they are born. In fact, prenatal learning is not limited to taste. Nor is it limited to humans. What is emerging from the experiments is evidence that all sorts of animal species great and small learn about the world before entering it by paying attention to the tastes, smells, sounds – and even sights – available pre-birth.
So can a zest for garlic be learned prenatally? Peter Hepper of the University of Belfast decided to find out. He and colleagues tested children born of mothers that often versus never consumed garlic during late pregnancy.
Flavours might bypass the mouth and pass directly into the foetus's blood through its mother's blood
His study involved just 33 children, but his results hint that a learned prenatal preference for garlic was maintained even years later, as seen in a willingness of kids born to garlic-consuming mothers to eat garlic-flavoured potatoes when they were aged eight or nine.
How do human babies taste food in the uterus? There are several possible routes to flavoured womb service.
One idea, explains Hepper, is that flavours pass into the amniotic fluid, so when the foetus starts to swallow – which it does from about the tenth week of development – "it will experience the flavours as they come through".
Flavours might also bypass the mouth and pass directly into the foetus's blood through its mother's blood. This might be particularly true of garlic, which can linger in our systems for hours after a meal – explaining why people close by can smell the stuff on us even the next day.
It is not just strong flavours like garlic that can influence foetal tastes. The same may be true for subtle flavours too.
In an experiment at Pennsylvania's Monell Chemical Senses Center (and sponsored by a baby food company), researchers gauged babies' reaction to plain versus carrot-flavoured cereal. Some of the babies' mothers had spent the last trimester of pregnancy and first months of breast-feeding drinking carrot juice and water, while other mothers had stuck to water alone.
It makes sense to be programmed to respond to our primary caregiver
Based on the extent to which the five- to six-month-old babies grimaced at their plain versus carrot-flavoured cereal, the researchers concluded that a keenness for carrots can be learned prenatally from their carrot-infused amniotic fluid, or postnatally from the carrot-flavoured milk they drink.
This might all seem a bit trivial, but it is really not. In mammals in general, taste and smell seem to be important triggers that babies look for before initiating suckling.
"When the baby is put to the breast, it experiences the same flavour that it's been sucking for the last 30-odd weeks before birth, so it's quite accepting of milk," says Hepper. "If it's a different flavour, it's perhaps more problematic."
Unsurprisingly, then, prenatal flavour learning is widespread across mammals. It is seen in rabbits, rats, dogs and cats, for instance.
It may have evolved because it is important in steering us towards safe foods, and in offspring recognition of their mother. "It makes sense," says Hepper, "to be programmed to respond to our primary caregiver, the one who is programmed to care for us."
These prenatally-primed systems of mother-child recognition may be especially important in the unfortunate species that are exploited by freeloading members of another species – cuckoos, for instance – who have no intention of caring for their own young.
The fairy wren is one of the targets of the Horsfield's Bronze-cuckoo. This cuckoo will lay an egg in a fairy wren's nest given the chance – but prenatal learning might help the fairy wren work out that it has been duped.
Could mums be calling to their chicks while they were still inside their eggs?
As for how this fairy wren behaviour was discovered, "it was a bit of an accident", says Diane Colombelli-Négrel of Flinders University in Adelaide, Australia.
During a study on predators, she was recording sounds from the nests of superb fairy wrens (Malurus cyaneus) round the clock. Later, when reviewing the recordings, she noticed that females were producing special calls during incubation. This seemed odd for a mother bird sitting on eggs, which would be expected to keep quiet to avoid attracting the attentions of a predator.
Intrigued, Colombelli-Négrel compared the mother's incubation calls with the "feed me, feed me" begging calls her chicks made once they had hatched. Comparing one to the other, she was struck by the similarity.
Could mums be calling to their chicks while they were still inside their eggs, to teach them a signature "feed me" call they could use after hatching?
In order to test that idea – and show that the mother-like chick calls were not simply some genetic programme with nothing to do with in-egg learning – Colombelli-Négrel and collaborators conducted a cross-fostering experiment.
They swapped eggs between nests so they could see if chicks learned calls that more closely resembled their biological or foster mother. The chick calls showed a greater similarity to those of the bird that incubated them, not their genetic mother, providing evidence for inside-the-egg song learning.
If you don't produce the password, the parents will feed you less
As Colombelli-Négrel's co-author Mark Hauber at Hunter College, New York, explains, the researchers also measured heart rate changes of developing birds inside the egg to explore whether they can learn to distinguish between different types of sound. This confirmed, says Hauber, that "the embryo learns while inside the egg, before hatching".
Next they wanted to know if parents could distinguish subtle differences in chick calls.
They tested parental responses to playbacks at the nest of begging calls from their own chicks, chicks from other nests, and calls from the Horsfield's bronze-cuckoo chicks. This cuckoo species sometimes plunks its own eggs into fairy wren nests to be unwittingly adopted – a disastrous event for the fairy wrens, since the cuckoo chick that hatches will turf out all of its nest-mates, sentencing them to death, in order to rule the roost.
The parents were not easily fooled. They responded more strongly, bringing more food in response to calls from their own chicks. So fairy wrens, for now, appear to have gained the upper hand in their arms race with the cuckoos by teaching their unhatched chicks a vocal password.
"The password allows you to live," says Hauber. "If you don't produce the password, the parents will feed you less," or desert the nest entirely to start again.
Recent work by Colombelli-Négrel, Hauber and colleagues suggests that closely related red-backed fairy wrens show prenatal vocal learning too. The researchers now find themselves wondering just how widespread this early learning really is.
They are not the first to wonder. Research by Gilbert Gottlieb beginning in the 1970s showed that prenatal sound learning also occurs in ducklings.
More recent work, by Christopher Harshaw and Robert Lickliter at Indiana University, demonstrated, with an ugly-duckling-style experiment, that young northern bobwhites prefer the call of Japanese quail rather than that of their own species if they are played Japanese quail sounds while their eggs are in an incubator.
But apart from a handful of examples like these, the possibility that embryos pay attention to, and learn from, the sounds they hear has not yet been widely explored.
One thing [newborns] are doing, because they better do it if they want to survive, is suck
In one species though, sound exposure before birth has been studied, and debated, extensively. Are early sound preferences innate, or learned? In humans it seems to be a combination of both.
At New York University, psychologist Athena Vouloumanos is interested in how early in development humans start learning language.
It is tricky to test language learning in foetuses, she explains. Instead, people tend to focus on newborns, and control for their prenatal exposure to see how it affects infants once they are born.
Vouloumanos has studied how newborn babies respond to human speech versus non-speech sounds.
Newborns spend a lot of their time asleep, "but one thing they are doing, because they better do it if they want to survive, is suck". So her team used babies' sucking responses to distinguish between prenatally-learned versus innate preferences for certain sounds.
English-hearing babies will suck more to hear English than to hear French
They used pacifiers (dummies) embedded with pressure sensors specially designed to measure how vigorously babies sucked. In response to babies sucking really hard on the sterilised, non-nutritive dummies, they get to hear sounds, explains Vouloumanos. "The more they suck, the more they hear the sounds, in a positive feedback cycle," she says.
By changing up which sounds babies get to hear, she found that they suck more and more to hear the speech sounds. Their research showed that a newborn's preference for speech versus non-speech sounds [click on these embedded links to hear the sounds] is likely innate, not learned.
But it has also been demonstrated, for example, that newborn babies recognise and prefer to listen to sounds of their parents' language, something that clearly must be learned.
"English-hearing babies will suck more to hear English than to hear French," says Vouloumanos, and "French babies will suck more to hear French than to hear Russian." They recognise their native language, and not only when it is spoken by their mothers but also when other speakers use it too.
As for babies with unilingual versus bilingual mothers, Vouloumanos's colleague Janet Werker at the University of British Columbia discovered that babies with bilingual exposure to English and Tagalog sucked equally for both of their native tongues.
What about music? Could foetuses learn melodies while they are still in the womb?
In a Finnish experiment, one group of pregnant mothers listened to a melody – a tape of "Twinkle Twinkle Little Star" – almost every day in their late pregnancy. A second group did not listen to the melody. After the babies were born, researchers tested all babies' responses to subtle but deliberate melodic changes or "mistakes" in the familiar tune.
It is tricky to test language learning in foetuses
"The babies are of course sleeping," says Minna Huotilainen at the University of Helsinki, who directed the study. "But we are recording the electroencephalogram, a continuous signal from different parts of the brain."
For both the correct and incorrect notes, the brains of babies prenatally exposed to the melody had a stronger response than the unexposed babies, suggesting they had learned and remembered the melody during the foetal period.
One important implication of this discovery of very early sound learning is the need to pay careful attention to the sound environment for babies born pre-term.
When there is a lot of machine noise in the neonatal hospital environment, babies will learn those sounds, possibly at the expense of speech sounds. "This may contribute to later language learning problems," says Huotilainen.
I'm not at all sure if it's a good idea to use those
Huotilainen is currently studying prematurely born babies receiving "kangaroo care" (worn by mothers in pouches) in groups that hear silence, speech, or soft lullabies, to see if certain environments might help them to develop their language faster.
Huotilainen's former graduate student Eino Partanen, collaborator on the prenatally-learned music study, is also hoping to find out how, what and when we learn sounds, "and what kinds of developmental deficits we can start to ameliorate in early infancy," he says.
But purposely modifying the sounds a developing foetus hears is something Huotilainen is cautious about. She is sceptical of the value of "foetal stimulators": devices marketed to mothers that play music directly to their unborn babies, some attached on the belly, others through vaginal loudspeakers. "I'm not at all sure if it's a good idea to use those," she says.
The tastes, smells and sounds that surround animals during their prenatal development are not the only senses they can learn from.
At four weeks before hatching, cuttlefish can learn from touch
In cuttlefish, which hatch from eggs and then fend for themselves as youngsters, Ludovic Dickel has been studying how learning in the egg can extend to the sights cuttlefish see before they hatch.
Cuttlefish have a behavioural repertoire that is "one of the richest in the animal kingdom at hatching, a dream for a behavioural biologist," he says. His collaborative research has shown that as soon as the visual system of the cuttlefish is functional, about three weeks before hatching, they can learn from what they see – the equivalent of a human womb with a view.
In one experiment, Dickel and colleagues exposed some embryonic cuttlefish to images of crabs but none of the chemicals crabs release that might betray their smell or taste. These cuttlefish, upon hatching, had a greater preference for eating the tasty crustaceans than their peers who had not been exposed to visual cues before hatching.
Even earlier, at four weeks before hatching, Dickel's team have discovered that cuttlefish can learn from touch and from chemical cues like the odour of a predator, the European sea bass.
They are bathed in chemicals that contain a lot of information about their environment
That smell of fear, and the ability to learn from it, occurs in salamanders and frogs too.
Learning about the safety of the environment you are about to hatch into may be very important for these amphibians. Many, like the ringed salamander (Ambystoma annulatum), develop in ephemeral and often predator-rich environments in which 90-99% of the young will be killed before they can metamorphose from tadpoles into adults.
That, says Alicia Mathis at Missouri State University, is why responding to what you learned before you hatched may just save your life. "There is tremendous pressure on them to be able to survive," says Mathis, and "they are bathed in chemicals that contain a lot of information about their environment", including what other species are in the pond.
In some years, the ponds may be pretty safe, making it worthwhile to get active in the open and search for food. "However in other years, there may be lots and lots of predators around," including cannibalistic salamanders of your own species, says Mathis.
What we learn before entering the world may give us more of a head-start than once thought
So, if babies can predict the level of predation risk when they hatch and behave accordingly, they have a better chance of survival.
It is an early chemistry lesson that Mathis is now putting to clever use in one endangered species, the hellbender salamander.
To help bolster its numbers this amphibian is being bred in captivity. So by "teaching" youngsters the kinds of things they need to be afraid of in the real world, she may be able to increase their chances of survival upon release into the wild.
This sort of captive breeding followed by release is often called head-starting. Science is revealing that what we learn before entering the world may give us more of a head-start than once thought.
Lesley Evans Ogden is on Twitter @ljevanso
Join over five million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.
If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.