Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/alphatab/src/importer/GpifParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2581,6 +2581,9 @@ export class GpifParser {
switch (c.localName) {
case 'Accidental':
switch (c.innerText) {
case '':
note.accidentalMode = NoteAccidentalMode.ForceNatural;
break;
case 'x':
note.accidentalMode = NoteAccidentalMode.ForceDoubleSharp;
break;
Expand Down
3 changes: 2 additions & 1 deletion packages/alphatab/src/importer/MusicXmlImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ class TrackInfo {
// no display pitch defined?
musicXmlStaffSteps = 4; // middle of bar
} else {
musicXmlStaffSteps = AccidentalHelper.calculateNoteSteps(bar.keySignature, bar.clef, noteValue);
const spelling = ModelUtils.resolveSpelling(bar.keySignature, noteValue, NoteAccidentalMode.Default);
musicXmlStaffSteps = AccidentalHelper.calculateNoteSteps(bar.clef, spelling);
}

// to translate this into the "staffLine" semantics we need to subtract additionally the steps "missing" from the absent lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { Fingers } from '@coderline/alphatab/model/Fingers';
import { GolpeType } from '@coderline/alphatab/model/GolpeType';
import { GraceType } from '@coderline/alphatab/model/GraceType';
import { HarmonicType } from '@coderline/alphatab/model/HarmonicType';
import { KeySignature } from '@coderline/alphatab/model/KeySignature';
import { KeySignatureType } from '@coderline/alphatab/model/KeySignatureType';
import { Lyrics } from '@coderline/alphatab/model/Lyrics';
import { BeamingRules, type MasterBar } from '@coderline/alphatab/model/MasterBar';
Expand Down Expand Up @@ -3318,7 +3319,13 @@ export class AlphaTex1LanguageHandler implements IAlphaTexLanguageImportHandler
Atnf.prop(properties, 'slur', Atnf.identValue(slurId));
}

if (note.accidentalMode !== NoteAccidentalMode.Default) {
// NOTE: it would be better to check via accidentalhelper what accidentals we really need to force
const skipAccidental =
note.accidentalMode === NoteAccidentalMode.Default ||
(note.beat.voice.bar.keySignature === KeySignature.C &&
note.accidentalMode === NoteAccidentalMode.ForceNatural);

if (!skipAccidental) {
Atnf.prop(
properties,
'acc',
Expand Down
Loading
Loading