Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How AI Found a Sperm Whale Sound Alphabet

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

AI helped scientists discover that sperm whale clicks form a structured "alphabet" by using machine learning to detect repeating patterns in thousands of recorded codas (rhythmic click sequences). This guide explains the step-by-step process researchers used, from recording sounds to training a neural network, and what you need to know if you want to replicate or understand the method.

What You'll Need

  • Access to sperm whale acoustic recordings (public datasets like those from the Dominica Sperm Whale Project or Project CETI).
  • Audio processing software (e.g., Python with librosa, or Praat) to visualize and extract click sequences.
  • A machine learning framework (TensorFlow, PyTorch, or scikit-learn) to build and train a pattern-recognition model.
  • Basic knowledge of Python programming and signal processing (FFT, spectrograms).
  • A computer with a GPU (optional but speeds up training).

Step-by-Step

  1. Collect and organize recordings: Gather long-term acoustic recordings from hydrophones (underwater microphones) deployed near sperm whale habitats. Label each recording with metadata: date, time, location, and group ID if known.
  2. Isolate individual codas: Use a click detector algorithm (e.g., energy threshold or template matching) to find each click in the audio. Then group consecutive clicks into codas—typically 3 to 40 clicks with regular inter-click intervals. Save each coda as a separate audio clip or as a sequence of click timestamps.
  3. Convert clicks to a machine-readable format: For each coda, extract features: the number of clicks, the inter-click intervals (ICIs), and the frequency spectrum of each click. Represent each coda as a vector of numbers (e.g., a sequence of ICIs) that a computer can process.
  4. Preprocess and normalize data: Remove background noise using band-pass filtering (typically 1–20 kHz for sperm whale clicks). Normalize the amplitude and time-align codas so that variations in recording volume or speed don't distort the pattern.
  5. Train an unsupervised clustering model: Use an algorithm like k-means or a self-organizing map to group similar coda patterns without predefined labels. This reveals natural categories—the "letters" of the alphabet. For example, codas with the same rhythm and tempo cluster together.
  6. Apply a neural network for sequence analysis: Feed the coda sequences into a recurrent neural network (RNN) or a transformer model (like BERT adapted for audio) to learn the rules of how codas combine. The model learns to predict the next coda in a sequence, which exposes a grammar—just like letters form words and sentences.
  7. Validate the discovered alphabet: Check if the clusters are consistent across different whales and days. Use statistical tests (e.g., chi-square) to confirm that certain codas appear more often together than by chance. Cross-reference with behavioral observations (e.g., feeding vs. socializing) to see if the "alphabet" conveys meaning.
  8. Publish and share the method: Document the exact preprocessing steps, model architecture, and code (open-source on GitHub). This allows other researchers to test the alphabet on new recordings and refine it.

Common Mistakes

  • Overfitting to noise: If you don't filter out boat noise or other marine sounds, the AI might learn patterns in the noise rather than the whale clicks. Always clean the audio before feature extraction.
  • Ignoring context: Codas are not isolated—they occur in exchanges between whales. Analyzing single codas without considering the preceding and following ones misses the grammar. Always feed sequences, not single codas, into the model.
  • Using too few recordings: A small dataset (e.g., 100 codas) will produce unreliable clusters. You need thousands of codas from multiple individuals to find consistent patterns.
  • Assuming a human-like alphabet: The "alphabet" may not map to letters or words as humans know them. It could be more like a set of rhythmic motifs. Avoid forcing a linguistic interpretation.
  • Not validating with independent data: If you test the model on the same data you trained on, it will look perfect. Always hold out a separate test set (e.g., recordings from a different year) to verify the alphabet generalizes.

Tips

  • Start with public datasets: The Dominica Sperm Whale Project has open-access recordings. This saves you months of fieldwork.
  • Use pretrained audio models: Instead of building from scratch, fine-tune a model like wav2vec 2.0 that already understands acoustic features. This works well for small datasets.
  • Visualize your clusters: Use t-SNE or UMAP to plot the codas in 2D. If you see distinct blobs, that's a good sign your alphabet is real.
  • Collaborate with marine biologists: They can tell you which behaviors correspond to which codas, helping you interpret the alphabet's meaning.
  • Document every preprocessing step: Small changes in filtering or click detection can drastically change the clusters. Keep a version log.

Troubleshooting

  • Model finds only one cluster: This usually means your features are not discriminative. Try adding more features (e.g., click frequency, duration, or energy) or use a different clustering algorithm (DBSCAN instead of k-means).
  • Clusters are unstable across runs: Run the clustering multiple times with different random seeds. If the clusters change, your data is too noisy—increase the signal-to-noise ratio by stricter filtering.
  • AI predicts codas randomly: If your sequence model performs no better than chance, the coda order may be random (which is a valid finding). Or you need more context (e.g., include the time gap between codas).
  • No public code available: If you can't find existing code, implement a simple LSTM with PyTorch—there are many tutorials online. Start with a small model to avoid overfitting.
  • Recordings have too much ship noise: Use a high-pass filter at 2 kHz to remove low-frequency ship rumble. If that doesn't work, use a noise removal tool like Audacity's spectral editing.

Frequently Asked Questions

What exactly is a sperm whale "alphabet"?

It's a set of distinct coda patterns (rhythmic click sequences) that appear consistently across whales. AI found that these patterns combine in structured ways, similar to how letters combine into words, though the meaning is still unknown.

How does AI find patterns humans miss?

AI can process thousands of codas and detect statistical regularities in timing and order that are too subtle or voluminous for human ears. It doesn't "understand" meaning—it finds structure.

Is this a full language?

No. The research is preliminary. AI found an alphabet-like structure, but there's no evidence of syntax (rules for word order) or semantics (meaning). It might be more like a musical scale than a language.

Can I do this at home with my own recordings?

Yes, but you need high-quality underwater recordings and a lot of them. A simple setup with a hydrophone (like the Aquarian Audio H2a) and a recorder can work, but you'll need to collect many hours of audio to get enough codas.

What software is best for beginners?

Python with librosa for audio processing and scikit-learn for clustering is the most accessible. For deep learning, use PyTorch with a simple LSTM. Avoid building a custom GUI—command-line scripts are easier to debug.

Will this help us talk to whales?

Not yet. The alphabet is a first step, but we don't know what the codas mean. Even if we did, communication requires a shared context. It's more likely to help us understand whale social structure than to enable conversation.