-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Your idea
The Plugin API currently provides no way to iterate through or access spanners (slurs, hairpins, ottavas, pedal lines, etc.) in a score, despite these objects existing internally in the core engine.
Problem
While working with plugins, there's no direct access to the spanners collection. This severely limits plugin capabilities for common editing tasks involving spanners.
What you CAN currently access:
- curScore.parts - all parts in the score
- curScore.staves - all staves
- curScore.pages - all pages
- curScore.systems - all systems
What you CANNOT access:
- Spanners collection (slurs, hairpins, ottavas, pedal lines, etc.)
Problem to be solved
-
Instrument adaptation: When adapting a violin part to bandurria (plucked instrument), you need to remove all slurs because bandurria cannot do legato like violin. Currently impossible to automate.
-
Orchestration tools: When copying dynamics and articulations from one instrument section to another, you cannot access or replicate hairpins and other spanners programmatically.
Current Workarounds and Why They Don't Work
- segment.annotations - Only contains dynamics, expressions, not spanners
- segment.elementAt() - Doesn't return spanners
- note.spannerFor/BackwardTrack - Only works for spanners directly attached to that specific note, misses most spanner
types - Iterating through every note hoping to find spanners - Extremely slow for large scores and misses many spanner types
Expected API
Similar to how we access other collections:
// Proposed usage
for (var i = 0; i < curScore.spanners.length; i++) {
var spanner = curScore.spanners[i];
// Example: Remove slurs from bandurria part
if (spanner.type === Element.SLUR &&
spanner.track >= bandurriaPart.startTrack &&
spanner.track < bandurriaPart.endTrack) {
removeElement(spanner);
}
}
Prior art
No response
Additional context
No response
Checklist
- This request follows the guidelines for reporting issues
- I have verified that this feature request has not been logged before, by searching the issue tracker for similar requests