denigma 4.0.0
Loading...
Searching...
No Matches
articulations.h
1/*
2 * Copyright (C) 2026, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include <optional>
25#include <string>
26#include <variant>
27#include <vector>
28
29#include "denigma/classify/classifier_common.h"
30#include "musx/musx.h"
31#include "musx/util/Arpeggio.h"
32
33namespace denigma {
34
37namespace classify {
38
39namespace articulation {
40
44{
47 enum class Type {
48 Accent,
49 BrassDoit,
50 BrassFalloff,
51 BrassPlop,
52 BrassScoop,
53 SoftAccent,
54 Spiccato,
55 Staccatissimo,
56 Staccato,
57 Stress,
58 StrongAccent,
59 Tenuto,
60 Unstress
61 };
62
67};
68
72{
74 std::vector<ArticulationMark> marks;
75};
76
80{
83 enum class Type {
84 BrassBend,
85 BrassFlip,
86 BrassHalfMuted,
87 BrassLift,
88 BrassOpen,
89 BrassSmear,
90 BrassStopped,
91 BuzzPizzicato,
92 Fingernails,
93 LeftHandPizzicato,
94 SnapPizzicato,
95 ThumbPosition,
96 UpBow,
97 DownBow,
98 StringHarmonic
99 };
100
105};
106
110{
113 enum class Qualifier {
114 Closed,
115 HalfLeft,
116 HalfRight,
117 Open
118 };
119
124};
125
129{
132 enum class Type {
133 Damp,
134 DampAll
135 };
136
141};
142
146{
149 enum class Type {
150 On,
151 Off
152 };
153
158};
159
168{
171 enum class Hand {
172 Other,
173 Right,
174 Left
175 };
176
179 enum class RankCount {
180 Other,
181 Two,
182 Three,
183 Four
184 };
185
188 enum class InstrumentType {
189 Other,
190 Piccolo,
191 Clarinet,
192 Bassoon,
193 Oboe,
194 Violin,
195 ImitationMusette,
196 AuthenticMusette,
197 Organ,
198 Harmonium,
199 Bandoneon,
200 Accordion
201 };
202
205 enum class DotPosition {
206 Other,
207 Top,
208 UpperMiddle,
209 Middle,
210 LowerMiddle,
211 Bottom
212 };
213
216 struct Dot
217 {
220 };
221
229 std::vector<Dot> dots;
231 std::vector<std::string> glyphNames;
232};
233
237{
240 enum class Style {
241 Measured,
242 Unmeasured
243 };
244
248 int marks{};
251};
252
256{
259 enum class Shape {
260 Normal,
261 Angled,
262 DoubleAngled,
263 Square,
264 DoubleSquare,
265 HalfCurve,
266 DoubleDot,
267 Curlew
268 };
269
272 enum class Duration {
273 Auto,
274 VeryShort,
275 Short,
276 Long,
277 VeryLong
278 };
279
286};
287
291{
294 enum class Type {
295 Unspecified,
296 Comma,
297 Tick,
298 Upbow,
299 Salzedo
300 };
301
306};
307
311{
314 enum class Type {
315 Normal,
316 Curved,
317 Short,
318 Thick,
319 Chant,
320 SingleStroke
321 };
322
327};
328
332{
335 enum class Type {
336 VerticalSegment,
337 Normal,
338 Up,
339 Down
340 };
341
348 std::optional<musx::util::ArpeggioSpanCandidate> candidate;
349};
350
354{
357 enum class Accidental {
358 Unspecified,
359 Flat,
360 Natural,
361 Sharp
362 };
363
366 enum class Type {
367 InvertedMordent,
368 InvertedTurn,
369 Mordent,
370 Shake,
371 Trill,
372 Turn
373 };
374
378 {
382 musx::dom::VerticalPlacement placement{};
383 };
384
390 std::vector<AccidentalMark> accidentals;
391};
392
400
404{
407 enum class Side {
408 Left,
409 Right
410 };
411
415 musx::dom::NoteInfoPtr note;
418};
419
423{
426 enum class Category {
427 Articulation,
428 PerformanceTechnique
429 };
430
435};
436
437} // namespace articulation
438
444
448{
452 musx::dom::VerticalPlacement placement{musx::dom::VerticalPlacement::NotApplicable};
454 std::optional<std::string> glyphName;
455
457 explicit operator bool() const noexcept { return !std::holds_alternative<std::monostate>(value); }
458
460 template <typename T>
461 const T* as() const noexcept
462 {
463 return std::get_if<T>(&value);
464 }
465
467 template <typename T>
468 bool is() const noexcept
469 {
470 return std::holds_alternative<T>(value);
471 }
472};
473
476 const musx::dom::MusxInstance<musx::dom::details::ArticulationAssign>& assignment, const musx::dom::EntryInfoPtr& entryInfo);
478ArticulationClassification classifyArticulationSymbol(const musx::dom::MusxInstance<musx::dom::FontInfo>& fontInfo, char32_t symbol);
479
480} // namespace classify
481} // namespace denigma
ArticulationClassification classifyArticulationSymbol(const musx::dom::MusxInstance< musx::dom::FontInfo > &fontInfo, char32_t symbol)
Classifies an articulation symbol from a font and character code.
ArticulationClassification classifyArticulation(const musx::dom::MusxInstance< musx::dom::details::ArticulationAssign > &assignment, const musx::dom::EntryInfoPtr &entryInfo)
Classifies an articulation assignment for an entry.
std::variant< std::monostate, articulation::ArticulationMarks, articulation::TechniqueMark, articulation::HarmonMute, articulation::PluckedDamp, articulation::StringMute, articulation::Tremolo, articulation::Fermata, articulation::BreathMark, articulation::Caesura, articulation::Arpeggio, articulation::Ornament, articulation::AccordionRegistration, articulation::VerticalEntryBracket, articulation::Parenthesis, PseudoTie, articulation::OtherMark > ArticulationValue
Variant payload for articulation classification.
Definition articulations.h:443
Core public API for the Denigma conversion libraries.
Definition articulations.h:33
Result returned by articulation classification.
Definition articulations.h:448
const T * as() const noexcept
Returns the classified payload as T, or nullptr when it has another type.
Definition articulations.h:461
ArticulationValue value
Classified articulation payload, or std::monostate when no articulation was recognized.
Definition articulations.h:450
bool is() const noexcept
Returns true when the classified payload has type T.
Definition articulations.h:468
musx::dom::VerticalPlacement placement
Resolved placement of the assigned articulation, when classified from an assignment.
Definition articulations.h:452
std::optional< std::string > glyphName
SMuFL glyph name associated with the recognized symbol, when available.
Definition articulations.h:454
Visual style encoded by the source glyph variant.
Definition classifier_common.h:32
A source shape used as a stand-in for a laissez-vibrer tie or tie end.
Definition classifier_common.h:48
One registration dot decoded from the precomposed glyph.
Definition articulations.h:217
DotPosition position
Logical position decoded from the precomposed glyph.
Definition articulations.h:219
A precomposed SMuFL accordion-registration glyph found in Finale notation.
Definition articulations.h:168
DotPosition
Logical vertical position of a registration dot, from top to bottom.
Definition articulations.h:205
RankCount rankCount
Number of ranks encoded by the source glyph family.
Definition articulations.h:225
std::vector< Dot > dots
Registration dots, preserving multiplicity.
Definition articulations.h:229
InstrumentType instrumentType
Named instrument or reed preset, when the source glyph identifies one.
Definition articulations.h:227
Hand
Hand designation encoded by the registration diagram.
Definition articulations.h:171
InstrumentType
Named accordion instrument or reed preset encoded by a glyph.
Definition articulations.h:188
std::vector< std::string > glyphNames
Canonical SMuFL name for the recognized registration glyph, as a single-element sequence.
Definition articulations.h:231
RankCount
Number of reed ranks in the registration diagram.
Definition articulations.h:179
Hand hand
Hand encoded by the source glyph family.
Definition articulations.h:223
Classification for arpeggio articulation marks.
Definition articulations.h:332
Type
Arpeggio type.
Definition articulations.h:335
Type type
Classified arpeggio type.
Definition articulations.h:343
std::optional< musx::util::ArpeggioSpanCandidate > candidate
The vertical span the arpeggio covers, or nullopt when no span resolved or the classification came fr...
Definition articulations.h:348
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:345
Classification for one articulation mark represented by a musx articulation symbol.
Definition articulations.h:44
Type
Articulation mark type recognized by the classifier.
Definition articulations.h:47
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:66
Type type
Articulation mark type.
Definition articulations.h:64
Classification for one or more articulation marks represented by a musx articulation symbol.
Definition articulations.h:72
std::vector< ArticulationMark > marks
One or more articulation marks represented by the source symbol.
Definition articulations.h:74
Classification for breath marks.
Definition articulations.h:291
Type
Breath mark type.
Definition articulations.h:294
Type type
Classified breath mark type.
Definition articulations.h:303
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:305
Classification for caesura articulation marks.
Definition articulations.h:311
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:326
Type
Caesura type.
Definition articulations.h:314
Type type
Classified caesura type.
Definition articulations.h:324
Classification for fermata articulation marks.
Definition articulations.h:256
Shape shape
Visual fermata shape.
Definition articulations.h:281
Shape
Visual fermata shape.
Definition articulations.h:259
Duration duration
Playback-duration class.
Definition articulations.h:283
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:285
Duration
Finale playback-duration class associated with the fermata.
Definition articulations.h:272
Classification for one note-attached Harmon mute technique symbol with qualifier state.
Definition articulations.h:110
Qualifier
Distinguishes the displayed stem / closed state of the Harmon mute symbol.
Definition articulations.h:113
Qualifier qualifier
Harmon mute qualifier encoded by the source glyph.
Definition articulations.h:121
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:123
Accidental sign attached to an ornament.
Definition articulations.h:378
Accidental accidental
Accidental sign shown with the ornament.
Definition articulations.h:380
musx::dom::VerticalPlacement placement
Placement of the accidental relative to the ornament sign.
Definition articulations.h:382
Classification for ornament articulation marks.
Definition articulations.h:354
Type type
Classified ornament type.
Definition articulations.h:386
std::vector< AccidentalMark > accidentals
Accidentals attached to the ornament sign.
Definition articulations.h:390
Accidental
Accidentals attached to an ornament sign.
Definition articulations.h:357
Type
Ornament types recognized by the classifier.
Definition articulations.h:366
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:388
Classification for recognized articulation symbols that have no more specific Denigma classification.
Definition articulations.h:423
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:434
Category
Broad notation category for preserving a known but unclassified mark.
Definition articulations.h:426
Category category
Broad notation category for the mark.
Definition articulations.h:432
Classification for a single notehead parenthesis mark attached to one side of a note.
Definition articulations.h:404
Side
Which side of the note the parenthesis mark appears on.
Definition articulations.h:407
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:417
Side side
Side of the note the parenthesis mark is on.
Definition articulations.h:413
musx::dom::NoteInfoPtr note
The note this parenthesis is associated with, per ArticulationAssign::calcAssociatedNote....
Definition articulations.h:415
Classification for a plucked-string damping symbol.
Definition articulations.h:129
Type type
Damping scope encoded by the source glyph.
Definition articulations.h:138
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:140
Type
Distinguishes damping selected strings from damping all strings.
Definition articulations.h:132
Classification for a string mute on/off symbol.
Definition articulations.h:146
Type type
Mute state encoded by the source glyph.
Definition articulations.h:155
Type
Whether the source symbol applies or removes the string mute.
Definition articulations.h:149
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:157
Classification for one note-attached technique mark represented by a musx articulation symbol.
Definition articulations.h:80
Type type
Technique mark type.
Definition articulations.h:102
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:104
Type
Technique mark type recognized by the classifier.
Definition articulations.h:83
Classification for tremolo articulation marks.
Definition articulations.h:237
int marks
Number of tremolo strokes.
Definition articulations.h:248
Style style
Tremolo style.
Definition articulations.h:246
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:250
Style
Distinguishes measured from unmeasured tremolo marks.
Definition articulations.h:240
Classification for Finale vertical entry bracket shapes.
Definition articulations.h:396
GlyphStyle glyphStyle
Visual style encoded by the source glyph variant.
Definition articulations.h:398