Corrected a mistake in note collection: occasionally, bars can span more than one phrase iteration, so we need to collect notes by phrase first