Coding for Whales: The algorithm that studies whale song

The program used computer tools to collect data on whale reproduction, behavior, and migration patterns to analyze their songs.
The students used a programming language to convert whale sounds into numerical series that are reinterpreted digitally. (Photo: Getty Images)

During the winter, thousands of whales travel from the northern Pacific Ocean to the south, where some settle off the coast of Guerrero. The aim of this migration is to reproduce in warmer waters.

Since 2014, international organization Whales of Guerrero has been working to conserve them alongside members of the fishing community of Barra de Potosí and scientists from different universities. For almost a decade, they have been studying the whales’ behavior and recording their songs using special underwater microphones.

In January 2023, students from Tec de Monterrey’s Mathematics and Data Science Engineering program of the School of Engineering and Sciences joined the “Coding for the Whales” project and were able to create an algorithm to analyze these audios, which will allow biologists to observe the patterns of their song.

“Their song can be detected automatically; we have programs for that. We’ve created a system (algorithm) for them to detect the presence of whales, which can identify when they’re singing and the year they were recorded. Although they sing the same long song each year, they alter a small part at the end,” says Juan Salvador Garza Ledesma, leader of the project and director of the Mathematics and Data Science program.

Data science and whales

The team’s goal was to translate all the sound recordings the organization has accumulated over nine years into data, since you can hear not only the songs in the sea but also the movements of the whales. This is in addition to the fact that their song is mixed with the sound of boats or other animals.

“Not everything is audible, some are just signals. With (the programming language) Python, we convert them into numerical series that can be reinterpreted digitally. There’s a lot of noise, things we are not interested in. It’s cleaned up and a mathematical object is generated,” explains Garza Ledesma, who is a mathematics specialist.

The algorithms are able to recognize a whale because its song has certain patterns. Then, with the help of biologists who interpret the sounds, it is possible to know what the intention is: whether to make sounds as courtship or simply to play.

“The biologists are the ones trying to interpret the data from what they haven’t been able to hear because these are long audios. They correlate it with what they already know, such as teaching something to a baby, fighting, or running away from orcas,” he says.

According to Garza Ledesma, such projects are useful for students to learn how to use their
knowledge of data science in a practical way, as part of an environmental initiative.

Related news
Related videos
Play Video

Did you like this content? Share it!​