WASHINGTON>> Those melancholy tunes sung by humpback whales may really be a sign of loneliness.

Scientists who tracked humpback whales in Australia noticed that fewer whales wailed to find mates as their population grew.

“Humpback whale song is loud and travels far in the ocean,” said marine biologist Rebecca Dunlop, who has studied humpback whales that breed near the Great Barrier Reef for more than two decades.

As whale numbers dramatically rebounded after the end of commercial whaling — one of the world’s great conservation success stories — she noticed something unexpected.

“It was getting more difficult to actually find singers,” said Dunlop, who is based at the University of Queensland in Brisbane. “When there were fewer of them, there was a lot of singing — now that there are lots of them, no need to be singing so much.”

Scientists first began to hear and study the elaborate songs of humpback whales in the 1970s, thanks to new underwater microphones. Only male whales sing, and the tunes are thought to play a role in attracting mates and asserting dominance.

Eastern Australia’s humpback whales were facing regional extinction in the 1960s, with only about 200 whales left. But numbers grew and reached 27,000 whales by 2015 — approaching estimated pre-whaling levels.

As the density of whales increased, their courtship changed. Although two in 10 males were singers in 2004, a decade later that ratio had dropped to just one in 10, Dunlop and colleagues report Thursday in the journal Nature Communications Biology.

Dunlop speculates that singing played an outsize role in attracting mates when populations were severely depleted.

“It was hard just to find other whales in the area, because there weren’t many,” she said.

When whales live in denser populations, a male looking for a mate also has to ward off the competition, and singing may tip off other suitors, she explained.

“As animal populations recover, they change their behavior — they have different constraints,” said marine biologist Boris Worm of Canada’s Dalhousie University, who was not involved in the study.

To be sure, the seas are still noisy. Many humpbacks woo with a combination of singing and physical jostling, the Australia researchers report.

“Such a big increase in animals over the time they were studying gave them a unique opportunity to get insights about changes in behavior,” said Simon Ingram, a University of Plymouth marine biologist in England, who was not involved in the study.

Ingram said that although humpback whales must have been singers long before whaling depleted their numbers, the new study highlights just how essential their elaborate and beautiful songs were to their survival and recovery.