def generate_splits(args, tr_set, audio_extension):
    for (i, s) in enumerate(tr_set):
        if os.path.isdir(os.path.join(args.input_path, s.lower())):
            s = s.lower()
        elif os.path.isdir(os.path.join(args.input_path, s.upper())):
            s = s.upper()
        else:
            assert NotImplementedError
        print('')
        todo = list(Path(os.path.join(args.input_path, s)).rglob(('*' + audio_extension)))
        print(f'Preprocessing data in: {s}, {len(todo)} audio files found.')
        print('Splitting audio to shorter length...', flush=True)
        Parallel(n_jobs=args.n_jobs)((delayed(split_and_save)(str(file), s, args) for file in tqdm(todo)))
    print('All done, saved at', args.output_path, 'exit.')
def generate_splits(args, tr_set, audio_extension):
    for (i, s) in enumerate(tr_set):
        if os.path.isdir(os.path.join(args.input_path, s.lower())):
            s = s.lower()
        elif os.path.isdir(os.path.join(args.input_path, s.upper())):
            s = s.upper()
        else:
            assert NotImplementedError
        print()
        todo = list(Path(os.path.join(args.input_path, s)).rglob(('*' + audio_extension)))
        print(f'Preprocessing data in: {s}, {len(todo)} audio files found.')
        print('Splitting audio to shorter length...', flush=True)
        Parallel(n_jobs=args.n_jobs)((delayed(split_and_save)(str(file), s, args) for file in tqdm(todo)))
    print('All done, saved at', args.output_path, 'exit.')