Skip to content

GuitarPrometheus::SongStructure::Engraving

GuitarPrometheus::SongStructure::Engraving

Public Functions

Name
Engraving(MusicModels::PitchClass pitch, MusicModels::Accidental accidental, int octave, MusicModels::Duration duration, int voice, int staff, int startTick, bool isChord, bool isRest, bool isGrace, Techniques::TechniqueSet techniques ={}, Techniques::ArticulationSet articulations ={}, MusicModels::Dynamic dynamicChange =MusicModels::Dynamic::None, std::optional< std::string > instrumentRef =std::nullopt, bool tieStart =false, bool tieStop =false, PickDirection pickDirection =PickDirection::None, std::optional< int > guitarString =std::nullopt, std::optional< int > guitarFret =std::nullopt, std::optional< BendCurve > bendCurve =std::nullopt)
Construct an engraving with all fields explicit.
MusicModels::PitchClassgetPitchClass() const
The note’s pitch class as written.
MusicModels::AccidentalgetAccidental() const
Accidental as explicitly written, or Accidental::None if absent.
intgetOctave() const
Octave (middle C = octave 4).
const MusicModels::Duration &getDuration() const
Engraved duration symbol + dots + tuplet ratio.
intgetDurationTicks(int divisions) const
Resolves the duration to ticks given the score’s divisions.
intgetMidiNoteNumber(const MusicModels::KeySignature & key) const
Resolves this note to a MIDI note number (60 = middle C).
intgetVoice() const
MusicXML voice number.
intgetStaff() const
1-based staff index.
intgetStartTick() const
Tick offset from the start of the part.
boolisChord() const
True iff this note sounds simultaneously with the previous note in the same voice.
boolisRest() const
True iff this is a rest, not a sounding note.
boolisGrace() const
True iff this is a grace note (does not advance the cursor).
const Techniques::TechniqueSet &getTechniques() const
Per-note techniques attached to this engraving (palm mute, let-ring, tap, etc.).
const Techniques::ArticulationSet &getArticulations() const
Note-shape articulations attached to this engraving (staccato, accent, grace, …).
MusicModels::DynamicgetDynamicChange() const
Dynamic change anchored at this note’s position, or Dynamic::None if no marking applies here.
const std::optional< std::string > &getInstrumentRef() const
MusicXML <instrument id="…"> reference, if present.
boolisTieStart() const
True iff this note opens a tie (<tied type="start">).
boolisTieStop() const
True iff this note closes a tie (<tied type="stop">).
PickDirectiongetPickDirection() const
const std::optional< int > &getGuitarString() const
1-based tab string number this note is fingered on, when the source format carries tab data.
const std::optional< int > &getGuitarFret() const
0-based fret number on getGuitarString().
const std::optional< BendCurve > &getBendCurve() const
Bend curve attached to this note, when the source format carries one.

Public Functions Documentation

function Engraving

Engraving(
MusicModels::PitchClass pitch,
MusicModels::Accidental accidental,
int octave,
MusicModels::Duration duration,
int voice,
int staff,
int startTick,
bool isChord,
bool isRest,
bool isGrace,
Techniques::TechniqueSet techniques ={},
Techniques::ArticulationSet articulations ={},
MusicModels::Dynamic dynamicChange =MusicModels::Dynamic::None,
std::optional< std::string > instrumentRef =std::nullopt,
bool tieStart =false,
bool tieStop =false,
PickDirection pickDirection =PickDirection::None,
std::optional< int > guitarString =std::nullopt,
std::optional< int > guitarFret =std::nullopt,
std::optional< BendCurve > bendCurve =std::nullopt
)

Construct an engraving with all fields explicit.

Parameters:

  • pitch The pitch class (C..B). Use any value if isRest.
  • accidental Explicit accidental, or None to inherit from the key.
  • octave Octave (4 = the octave starting at middle C).
  • duration Engraved duration (NoteValue + dots + tuplet ratio).
  • voice MusicXML voice number this note belongs to.
  • staff Staff index (1-based).
  • startTick Tick position relative to the start of the part.
  • isChord True if this note sounds simultaneously with the previous note in the same voice.
  • isRest True if this is a rest, not a sounding note.
  • isGrace True if this is a grace note (zero duration on the timeline).
  • techniques Per-note technique set (palm mute, tap, harmonic, etc.).
  • articulations Note-shape articulations (staccato, accent, grace, …).
  • dynamicChange Dynamic mark anchored at this note, or Dynamic::None for no change.
  • instrumentRef MusicXML <instrument id="…"> reference naming the <score-instrument> that sounds this note. Populated for drum notes (each piece of a kit is a separate score-instrument); absent for pitched parts.
  • tieStart True if this note carries a <tied type="start">. The next same-pitch note in the same part should be a tieStop continuation; the injector merges them into a single MIDI NoteOn.
  • tieStop True if this note carries a <tied type="stop">. Both flags can be set on the same note when it sits in the middle of a tie chain (A → B → C, B has both).
  • pickDirection Up / Down / None — when known, used by the keyswitch injector for pick-direction-aware variants.
  • guitarString 1-based tab string number (1 = highest pitched string), if known. Native .gp/.gpx imports populate this directly; MusicXML imports populate it from any embedded <?GP <string>N</string>?> processing instruction. std::nullopt when the source format doesn’t carry tab data.
  • guitarFret 0-based fret number on the string identified by guitarString. Same source- format constraints as guitarString.
  • bendCurve Optional bend curve attached to this note. Populated by the GP parser from the BendOriginValue / BendMiddleValue / BendDestinationValue properties; MusicXML sources don’t carry enough info to reconstruct one yet. The MIDI writer currently routes bends through the Bend keyswitch and ignores the curve.

function getPitchClass

MusicModels::PitchClass getPitchClass() const

The note’s pitch class as written.

function getAccidental

MusicModels::Accidental getAccidental() const

Accidental as explicitly written, or Accidental::None if absent.

function getOctave

int getOctave() const

Octave (middle C = octave 4).

function getDuration

const MusicModels::Duration & getDuration() const

Engraved duration symbol + dots + tuplet ratio.

function getDurationTicks

int getDurationTicks(
int divisions
) const

Resolves the duration to ticks given the score’s divisions.

function getMidiNoteNumber

int getMidiNoteNumber(
const MusicModels::KeySignature & key
) const

Resolves this note to a MIDI note number (60 = middle C).

If getAccidental() is Accidental::None, the active key signature supplies the accidental. Otherwise the explicit accidental wins.

function getVoice

int getVoice() const

MusicXML voice number.

function getStaff

int getStaff() const

1-based staff index.

function getStartTick

int getStartTick() const

Tick offset from the start of the part.

function isChord

bool isChord() const

True iff this note sounds simultaneously with the previous note in the same voice.

function isRest

bool isRest() const

True iff this is a rest, not a sounding note.

function isGrace

bool isGrace() const

True iff this is a grace note (does not advance the cursor).

function getTechniques

const Techniques::TechniqueSet & getTechniques() const

Per-note techniques attached to this engraving (palm mute, let-ring, tap, etc.).

function getArticulations

const Techniques::ArticulationSet & getArticulations() const

Note-shape articulations attached to this engraving (staccato, accent, grace, …).

function getDynamicChange

MusicModels::Dynamic getDynamicChange() const

Dynamic change anchored at this note’s position, or Dynamic::None if no marking applies here.

When set, the effective dynamic from this note onward is updated.

function getInstrumentRef

const std::optional< std::string > & getInstrumentRef() const

MusicXML <instrument id="…"> reference, if present.

For drum parts this names the <score-instrument> (e.g. “P5-I8” → “Kick (hit)”) that voices this note. Absent for pitched parts.

function isTieStart

bool isTieStart() const

True iff this note opens a tie (<tied type="start">).

The next same-pitch note in the same part is its continuation.

function isTieStop

bool isTieStop() const

True iff this note closes a tie (<tied type="stop">).

It’s a continuation of the prior same-pitch note’s sound, not a re-articulation.

function getPickDirection

PickDirection getPickDirection() const

function getGuitarString

const std::optional< int > & getGuitarString() const

1-based tab string number this note is fingered on, when the source format carries tab data.

Returns std::nullopt for MusicXML imports without embedded GP processing instructions and for any note whose source declared no string.

function getGuitarFret

const std::optional< int > & getGuitarFret() const

0-based fret number on getGuitarString().

Same nullability semantics as getGuitarString().

function getBendCurve

const std::optional< BendCurve > & getBendCurve() const

Bend curve attached to this note, when the source format carries one.

GP <Properties> exposes seven bend value / offset fields per note; the GP parser (Phase 22) consolidates them into the canonical BendCurve::points list. MusicXML sources currently produce a single-point curve from <bend><bend-alter> when present.


Updated on 2026-05-29 at 07:39:52 +0000