def mix_sequential(cut_manifests: List[Pathlike], output_cut_manifest: Pathlike): """ Create a CutSet stored in OUTPUT_CUT_MANIFEST by iterating jointly over CUT_MANIFESTS and mixing the Cuts on the same positions. E.g. the first output cut is created from the first cuts in each input manifest. The mix is performed by summing the features from all Cuts. If the CUT_MANIFESTS have different number of Cuts, the mixing ends when the shorter manifest is depleted. """ cut_manifests = [CutSet.from_json(path) for path in cut_manifests] mixed_cut_set = CutSet.from_cuts(mix_cuts(cuts) for cuts in zip(*cut_manifests)) mixed_cut_set.to_file(output_cut_manifest)
def mix_by_recording_id(cut_manifests: List[Pathlike], output_cut_manifest: Pathlike): """ Create a CutSet stored in OUTPUT_CUT_MANIFEST by matching the Cuts from CUT_MANIFESTS by their recording IDs and mixing them together. """ all_cuts = combine(*[CutSet.from_json(path) for path in cut_manifests]) recording_id_to_cuts = groupby(lambda cut: cut.recording_id, all_cuts) mixed_cut_set = CutSet.from_cuts( mix_cuts(cuts) for recording_id, cuts in recording_id_to_cuts.items()) mixed_cut_set.to_json(output_cut_manifest)