Panama's katydids come in all sizes. The big one on the left is a Steirodon careovirgulatum. The little one is likely a new species for Panama. Biologist Sharon Martinson has tentatively named it Pycnopalpa sincordata.

A rain forest sings with the sounds of insects, birds, maybe a howler monkey or two. But scientists are discovering that some forest dwellers also communicate in ways humans usually can't hear — via ultrasound.

A team from Dartmouth College has recorded these signals in treetops on a pristine Panamanian island called Barro Colorado, and slowed them down to make sense of them.

The ultrasonic chatter, it turns out, is actually a complicated conversation between mating insects and the bats that aim to eat them.

The insects are katydids, cousins to locusts and grasshoppers, which make their calls by rubbing their wings together. Some types live in North America, but the variety is nothing compared to the 250 or so species that live in Panama, where some behemoths are the size of a cell phone, and others are almost microscopic.

Many look like they're in a Halloween costume, with funny looking helmet-heads or big horns.

Hungry bats find them all irresistible.

"Katydids are the potato chips of the rainforest," says Laurel Symes, a biologist at Dartmouth College. The hungry bats listen for the ultrasonic calls of the katydids, then use their own ultrasonic signals to locate the insects, much the way ships use sonar to find objects beneath the sea.

Now, you'd think katydids would just shut up and save themselves. But males have to signal. It's how they attract females.

The Dartmouth team has spotted some interesting ways that katydids evolved to find mates but also fool bats — to navigate the tricky soundscape between sex and death.

"What's cool about the katydids," says Dartmouth biologist Hannah ter Hofstede, is that "each species may have found a different way to resolve that conflict."

Katydids, she says, have a special organ in their necks, just above and between their front legs. It's just a clump of cells, "a white blob," she says. But it acts as a minibrain.

Using tiny recording electrodes inserted into the minibrain, ter Hofstede has confirmed that it responds to ultrasonic signals, either from another insect or from a bat, that the katydid hears.

But her big question was, how do katydids use their ultrasonic sensory system in the real world — in the rain forest? To figure that out, she and her team traveled to Panama and wired up a rain forest with special microphones that record ultrasound.

Their project required weeks of shooting ropes over branches, climbing into the canopy and setting up an array of high-tech gear. They accumulated hours and hours of recordings, and noted an eerie babble, most of it in the ultrasonic range. To make sense of it, they lowered the frequency — in essence, slowing the conversations down to the point where the human ear can easily hear them.

Symes decoded it for us: "So this really low, continuous sound is the sound of crickets," she explains. "But all of these short, higher pitched sounds — the things that are two pulses or one short pulse, or maybe just a really short trill of sound — most of that is katydid calls. And then the really high-pitched regular sound, is the sound of the bat flying through."

There were some surprises.

"I think what I find the most interesting about the katydids," says ter Hofstede, "is how much they have adapted to deal with these kinds of predators. So, one of the things is that they don't produce very much sound." Some species only call for mates a few times a night, the scientists noticed, which makes them less vulnerable to bats, but also lowers their chances of finding a mate.

And some species apparently recognize a bat signal and go quiet when they hear it. Others just keep calling because they live underneath leaves and are harder for bats to find.

"So the more we investigated," says ter Hofstede, "the more complicated everything gets. And these katydids are not solving the same problem in the same way. They're all solving these problems in different ways."

All this variation comes from a brain the size of a grain of rice.

"But they're capable of processing a lot of this information and basically coming to decisions," says ter Hofstede. They apparently have neural circuits, she says, "related to recognizing certain signals as being important for being a mate or being a bat."

Symes finds that sort of discernment an admirable product of natural selection.

"They live in an environment where there might be a hundred different species that make sound," she says. "And they have to find this particular sound within it."

SIEGEL: There are insects, birds, maybe a howling monkey or two. But animals in the forest make sounds that don't show up in these recordings. NPR's Christopher Joyce and audio producer Bill McQuay from the Cornell Lab of Ornithology have been following scientists who've captured those sounds, sounds they say that determine who lives and who dies.

CHRISTOPHER JOYCE, BYLINE: Katydids can be an inch-long or the size of a cellphone. Many look like they're in Halloween costume with funny looking helmet heads or big horns. They also have an extraordinary talent that intrigues biologists...

BILL MCQUAY: As well as audio producers like me. What they can do is communicate ultrasonically at frequencies we can't hear.

JOYCE: At a lab at Dartmouth College, biologist Hannah ter Hofstede can actually show us evidence of this remarkable ability. She pins a katydid under a microscope then peels away the outer exoskeleton of its neck to reveal a pulsing clump of cells.

HANNAH TER HOFSTEDE: What you can see when you look through it in the very center between the two legs, there's a white blob. And that's like a mini-brain.