Refactoring of separateTupletVoices function