Skip to content

Add replaceInstrument() or similar method to Plugin API #31201

@manolo

Description

@manolo

Your idea

Add a new method replaceInstrument(part, instrumentId) to the Plugin API Score class that allows plugins to programmatically change the instrument of a part.

This would work similarly to the "Change Instrument" dialog in Staff/Part Properties, but accessible from QML plugins.

Example usage:

var part = curScore.parts[0];
curScore.replaceInstrument(part, "bandurria");

Problem to be solved

Currently, plugins can read instrument information (instrumentId, longName, shortName) but cannot change instruments programmatically. Users need this functionality for:

  • Porting scores between different ensembles.
  • Batch processing multiple scores to standardize instrumentation
  • Automating instrument assignments based on score analysis

The only workaround is manual interaction with the Change Instrument dialog, which cannot be scripted.

Prior art

Additional context

The instrumentId parameter should match IDs from instruments.xml (e.g., "pluck.guitar.nylon-string", "wind.flutes.flute").

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityIssues particularly suitable for community contributors to work onpluginsRelated to MuseScore's QML plugin framework (NOT VST/audio plugins)

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions