Represents a musical part (instrument or voice) in a score, containing measures, staves, and notes.
More...
|
| | Part (const std::string &partName, const int numStaves=1, const bool isPitched=true, const int divisionsPerQuarterNote=256) |
| | Constructs a Part with a given name, number of staves, pitch type, and rhythmic division. More...
|
| |
|
| ~Part () |
| | Destructor.
|
| |
|
void | clear () |
| | Removes all measures and resets the part.
|
| |
| int | getPartIndex () const |
| | Returns the index of the part in the score. More...
|
| |
| void | setPartIndex (int partIdx) |
| | Sets the index of the part in the score. More...
|
| |
| const std::string & | getName () const |
| | Returns the full name of the part. More...
|
| |
| const std::string & | getShortName () const |
| | Returns the short name (abbreviation) of the part. More...
|
| |
| void | addMidiUnpitched (const int midiUnpitched) |
| | Adds a MIDI number for an unpitched percussion instrument. More...
|
| |
| void | append (const std::variant< Note, Chord > &obj, const int position=-1, const int staveId=0) |
| | Appends a Note or Chord (variant) to the part at a given position and staff. More...
|
| |
| void | append (const std::vector< std::variant< Note, Chord > > &objs, const int position=-1, const int staveId=0) |
| | Appends multiple Note or Chord variants to the part at a given position and staff. More...
|
| |
| void | addMeasure (const int numMeasures) |
| | Adds a specified number of measures to the part. More...
|
| |
| void | removeMeasure (const int measureStart, const int measureEnd) |
| | Removes a range of measures from the part. More...
|
| |
| Measure & | getMeasure (const int measureId) |
| | Returns a reference to a measure by its index. More...
|
| |
| const Measure & | getMeasure (const int measureId) const |
| | Returns a const reference to a measure by its index. More...
|
| |
| const std::vector< Measure > | getMeasures () const |
| | Returns a vector of all measures in the part. More...
|
| |
| int | getNumMeasures () const |
| | Returns the number of measures in the part. More...
|
| |
| void | setNumStaves (const int numStaves) |
| | Sets the number of staves for the part. More...
|
| |
| void | setIsPitched (const bool isPitched=true) |
| | Sets whether the part is pitched (true) or unpitched (false). More...
|
| |
| void | setStaffLines (const int staffLines=5) |
| | Sets the number of staff lines for the part. More...
|
| |
| void | addStaves (const int numStaves=1) |
| | Adds additional staves to the part. More...
|
| |
| void | removeStave (const int staveId) |
| | Removes a staff from the part by its index. More...
|
| |
| int | getNumStaves () const |
| | Returns the number of staves in the part. More...
|
| |
| std::vector< int > | getMidiUnpitched () const |
| | Returns the MIDI numbers for unpitched percussion instruments. More...
|
| |
| bool | isPitched () const |
| | Returns true if the part is pitched (not percussion). More...
|
| |
| int | getStaffLines () const |
| | Returns the number of staff lines. More...
|
| |
| int | getNumNotes (const int staveId=-1) |
| | Returns the number of notes in the part (optionally for a specific staff). More...
|
| |
| int | getNumNotesOn (const int staveId=-1) |
| | Returns the number of sounding notes (note on) in the part (optionally for a specific staff). More...
|
| |
| int | getNumNotesOff (const int staveId=-1) |
| | Returns the number of rest notes (note off) in the part (optionally for a specific staff). More...
|
| |
| void | setShortName (const std::string &shortName) |
| | Sets the short name (abbreviation) for the part. More...
|
| |
|
void | info () const |
| | Prints summary information about the part to the log.
|
| |
| const std::string | toXML (const int instrumentId=1, const int identSize=2) const |
| | Serializes the part to MusicXML format. More...
|
| |
| std::string | toJSON () const |
| | Serializes the part to JSON format. More...
|
| |
Represents a musical part (instrument or voice) in a score, containing measures, staves, and notes.
The Part class provides methods for managing measures, staves, notes, and chords, as well as for querying and modifying part-level metadata. It supports MusicXML serialization and is designed for music analysis and computational musicology.