Moths tell bats they taste nasty
Moths warn bats not to eat them by telling them they're toxic
Nick Dowdy, a Ph.D candidate in biology at Wake Forest University in Winston-Salem, North Carolina, has been studying species that have developed toxicity as a defence against predators. But by itself, that's a defence that only works once a predator has already attacked.
So the moths have also developed the ability to produce warning sounds in the same frequency as the bats' echolocation, and Dowdy has shown that bats will break off their attacks when they hear the warning of nasty tastes ahead.