Skip to content

voice.makeRests() fills in missing notes in tuplets incorrectly #1237

@gregchapman-dev

Description

@gregchapman-dev

music21 version

7.2.1

Problem summary

If I put a single triplet eighth-note rest at the end of a 3-quarter-note voice (leaving a starting gap of 11 triplet eighth notes) and then call makeRests, it inserts a rest with duration.tuplets = (<music21.duration.Tuplet 12/11/16th>,) instead of what I would expect: duration.tuplets = (<music21.duration.Tuplet 3/2/eighth>,). The actual duration.quarterLength is correct (11/3ql), but I don't understand that weird tuplet choice (12 actual 16th notes in the space of 11 normal 16th notes).

Steps to reproduce

from fractions import Fraction
import music21 as m21
restVoice = m21.stream.Voice()
secondNote = m21.note.Rest()
secondNote.duration = m21.duration.Duration(Fraction(1, 3))
restVoice.insert(Fraction(11, 3), secondNote)
restVoice.makeRests(inPlace=True, hideRests=True)
firstNote = restVoice.notesAndRests[0]
print('firstNote = ', firstNote)
print('firstNote tuplets = ', firstNote.duration.tuplets)
print('secondNote = ', secondNote)
print('secondNote tuplets = ', secondNote.duration.tuplets)

Expected vs. actual behavior

More information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions