Motif detection

From lamm-mit/scienceclaw · View interactive version

Motif detection is an AI agent skill from the GitHub repository lamm-mit/scienceclaw. Extracts repeated melodic and rhythmic motifs from a music corpus using sliding-window interval encoding. Returns motifs with interval sequences, occurrence counts, and piece references.

How to use this skill

Skill file

motif-detection

Extracts repeated melodic and rhythmic motifs from a music corpus using sliding-window interval encoding. Returns motifs with interval sequences, occurrence counts, and piece references.

Usage

python3 skills/motif-detection/scripts/motif_detection.py --query "bach" --min-length 4 --min-occurrences 3

Output

{
  "query": "bach",
  "motifs": [
    {
      "motif_id": "m_0001",
      "intervals": [2, -2, 1, -1],
      "interval_str": "+2,-2,+1,-1",
      "occurrences": 14,
      "pieces": ["BWV 253", "BWV 281"],
      "genre": "baroque"
    }
  ],
  "n_motifs": 47,
  "min_length": 4,
  "min_occurrences": 3
}

Dependencies

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.