#This is difficult because you can mix durations e.g. 16th and 8th in the same beam.
#This syncopation 16 8 16 has the 8th in the middle. If any of the 16th beams connects to the left or right side this would be indistinguishable from a 16th note.
#It is also difficult because it is on the boundary of subBeamGroups
ifnotlastItem==beamGroup[-1]:
connectorLength=lastItem["completeDuration"]
eliflastItem==beamGroup[-1]:
connectorLength=0
resultBeamGroups.append((firstItem["tickindex"],lastItem["tickindex"]+connectorLength,abs(firstItem["flag"]),beamPosition,direction))#tick-start, tick-end, duration-type, position as staffline. Extra simple for the GUI.