Skip to content

Bug Report: Complex Pattern Token Matching Issues #5

Description

@b0id

Summary

HighTideLight's precise AST parsing and coordinate mapping system is working correctly, but reveals several algorithmic
challenges in mapping SuperDirt audio events to source code tokens for advanced TidalCycles patterns.

Current Status

  • ✅ AST parsing: Perfect precision with exact token coordinates
  • ✅ Basic patterns: Simple patterns like "bd sn hh" work correctly
  • ✅ OSC communication: Reliable data flow between Neovim and SuperCollider
  • ❌ Complex patterns: Multiple edge cases need algorithmic solutions

Issues Identified

  1. Duplicate Sound Events with Missing Indices

Pattern: d4 $ sound "cp cp cp cp cp"
Expected: Sequential highlighting of all 5 cp tokensActual: Highlights indices 0,1,3,4 but consistently skips index 2
Analysis: SuperDirt appears to not generate audio events for certain pattern positions, possibly due to voice allocation
limits or timing conflicts

  1. Multi-Parameter Instrument Patterns

Pattern: d1 $ s "superpiano" # n "[c5 e5 b4 c5 d5]"
Expected: Highlight individual notes (c5, e5, etc.) when they play
Actual: Only highlights instrument name (superpiano)Analysis: Need algorithm to map instrument+parameter combinations to
correct source tokens

  1. Positional Token Conflicts

Pattern: Multiple note tokens at same source position (chords/arpeggiation)
Issue: When multiple tokens share coordinates, current algorithm only selects one
Need: Multi-token highlighting or priority-based selection system

  1. Semantic Mapping Challenges

Issue: SuperDirt reports sound='superpiano' but actual note being played is c5
Need: Context-aware mapping that understands instrument/parameter relationships

Technical Details

  • Source maps correctly parse all tokens with precise coordinates
  • OSC communication captures all SuperDirt audio events accurately
  • Current cycle-based token selection works for simple cases
  • Missing events appear to be SuperDirt-side limitations, not parsing issues

Future Algorithm Requirements

  1. Multi-layer highlighting: Simultaneous instrument + parameter visualization
  2. Context-aware token selection: Semantic understanding of TidalCycles syntax
  3. Fallback highlighting: Show expected-but-missing events differently
  4. Priority-based mapping: Handle conflicts when multiple tokens could match
  5. Advanced pattern support: Polyrhythms, transformations, effects chains

Impact

These issues prevent accurate visualization of complex TidalCycles patterns, limiting the plugin's usefulness for
advanced live coding workflows. The foundational precision is excellent - need sophisticated matching algorithms for
production readiness.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions