(cls, item_name, ph, txt, tg_fn, wav_fn, spk_id, encoder, binarization_args)
| 235 | |
| 236 | @classmethod |
| 237 | def process_item(cls, item_name, ph, txt, tg_fn, wav_fn, spk_id, encoder, binarization_args): |
| 238 | if hparams['vocoder'] in VOCODERS: |
| 239 | wav, mel = VOCODERS[hparams['vocoder']].wav2spec(wav_fn) |
| 240 | else: |
| 241 | wav, mel = VOCODERS[hparams['vocoder'].split('.')[-1]].wav2spec(wav_fn) |
| 242 | res = { |
| 243 | 'item_name': item_name, 'txt': txt, 'ph': ph, 'mel': mel, 'wav': wav, 'wav_fn': wav_fn, |
| 244 | 'sec': len(wav) / hparams['audio_sample_rate'], 'len': mel.shape[0], 'spk_id': spk_id |
| 245 | } |
| 246 | try: |
| 247 | if binarization_args['with_f0']: |
| 248 | cls.get_pitch(wav_fn, mel, res) |
| 249 | if binarization_args['with_txt']: |
| 250 | try: |
| 251 | # print(ph) |
| 252 | phone_encoded = res['phone'] = encoder.encode(ph) |
| 253 | except: |
| 254 | traceback.print_exc() |
| 255 | raise BinarizationError(f"Empty phoneme") |
| 256 | if binarization_args['with_align']: |
| 257 | cls.get_align(tg_fn, ph, mel, phone_encoded, res) |
| 258 | except BinarizationError as e: |
| 259 | print(f"| Skip item ({e}). item_name: {item_name}, wav_fn: {wav_fn}") |
| 260 | return None |
| 261 | return res |
| 262 | |
| 263 | |
| 264 | class ZhSingingBinarizer(ZhBinarizer, SingingBinarizer): |
nothing calls this directly
no test coverage detected