Skip to content

Commit

Permalink
works now, but needs to be prettified
Browse files Browse the repository at this point in the history
  • Loading branch information
Jellevanderwerff committed Dec 13, 2024
1 parent 03a90ae commit ca2a778
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions thebeat/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,18 +773,18 @@ def _get_abjad_ties(self, durations):
notes.append(note)
# if note doesn't fit the bar
else:
# try to divide the note up into smaller bits
for division in (2, 4, 8):
# if now it fits in the bar
if (note / division) + bar_fullness <= 1:
# we split up the original note into a small bit, and the rest (e.g. 1/4 and 3/4)
split_notes = [note / division, note - (note / division)]
# We need to remember which notes to tie later
notes += split_notes
ties_at.append(i)
bar_fullness += sum(split_notes)
bar_fullness -= full_bar
break
remains = note
status = False
while status is False or remains > full_bar:
possibilities = [remains / division for division in range(2, 10)] # TODO consider range
left_side = [poss for poss in possibilities if (poss + bar_fullness) == full_bar and poss.numerator == 1][0]
remains = note - left_side
split_notes = [left_side, remains]
notes += split_notes
ties_at.append(i)
bar_fullness += sum(split_notes)
bar_fullness -= full_bar
status = True

# if bar is full set bar_fullness to zero
if bar_fullness % full_bar == 0:
Expand Down

0 comments on commit ca2a778

Please sign in to comment.