diff --git a/src/pitch.ts b/src/pitch.ts index 7fde8df5..8282049e 100644 --- a/src/pitch.ts +++ b/src/pitch.ts @@ -894,7 +894,9 @@ export class Pitch extends prebase.ProtoM21Object { this.accidental = new Accidental('natural'); } this.accidental.displayStatus = true; - + // not exactly equivalent with https://github.com/cuthbertLab/music21/pull/1299 + // because m21j does not track chordAttached + // Thus, some potential for subsequent same pitch class to lack a cautionary natural // other cases: already natural in past usage, do not need // natural again (and not in key sig) } else { diff --git a/src/stream.ts b/src/stream.ts index d994da65..c2f0bc0b 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -26,6 +26,7 @@ import { Music21Exception } from './exceptions21'; import { debug } from './debug'; import * as base from './base'; +import { Chord } from './chord'; import * as clef from './clef'; import * as common from './common'; import * as derivation from './derivation'; @@ -47,7 +48,6 @@ import * as iterator from './stream/iterator'; import * as makeNotation from './stream/makeNotation'; // for typing only -import type { Chord } from './chord'; import type { KeySignature } from './key'; export { filters }; @@ -1815,9 +1815,10 @@ export class Stream extends base.Music21Object { if (tie !== undefined && tie.type !== 'stop') { tiePitchSet.add(p.nameWithOctave); } - } else if (e.classes.includes('Chord')) { - const chordNotes = (e as Chord).notes; + } else if (e instanceof Chord) { + const chordNotes = e.notes; const seenPitchNames: Set = new Set(); + pitchPast.push(...e.pitches); for (const n of chordNotes) { const p = n.pitch; const lastNoteWasTied: boolean = tiePitchSet.has(p.nameWithOctave); @@ -1841,7 +1842,6 @@ export class Stream extends base.Music21Object { for (const pName of seenPitchNames) { tiePitchSet.add(pName); } - pitchPast.push(...(e as Chord).pitches); } else { tiePitchSet.clear(); } diff --git a/tests/moduleTests/stream.ts b/tests/moduleTests/stream.ts index 05652d0b..ed455a4f 100644 --- a/tests/moduleTests/stream.ts +++ b/tests/moduleTests/stream.ts @@ -554,6 +554,14 @@ export default function tests() { assert.ok(n2.pitch.accidental.displayStatus); // different note }); + test('music21.stream.Stream makeAccidentals augmented unison in chord', assert => { + const m = new music21.stream.Measure(); + const c = new music21.chord.Chord('G# G'); + m.append(c); + m.makeAccidentals({inPlace: true}); + assert.ok(c.pitches[0].accidental.displayStatus); // G comes first + }); + test('music21.stream.Stream makeBeams with stemDirection', assert => { const n1 = new music21.note.Note('C5', 0.5); n1.stemDirection = 'up';