(cls, item_name, ph, txt, tg_fn, wav_fn, spk_id, encoder, binarization_args)
| 150 | |
| 151 | @classmethod |
| 152 | def process_item(cls, item_name, ph, txt, tg_fn, wav_fn, spk_id, encoder, binarization_args): |
| 153 | if hparams['vocoder'] in VOCODERS: |
| 154 | wav, mel = VOCODERS[hparams['vocoder']].wav2spec(wav_fn) |
| 155 | else: |
| 156 | wav, mel = VOCODERS[hparams['vocoder'].split('.')[-1]].wav2spec(wav_fn) |
| 157 | res = { |
| 158 | 'item_name': item_name, 'txt': txt, 'ph': ph, 'mel': mel, 'wav': wav, 'wav_fn': wav_fn, |
| 159 | 'sec': len(wav) / hparams['audio_sample_rate'], 'len': mel.shape[0], 'spk_id': spk_id |
| 160 | } |
| 161 | try: |
| 162 | if binarization_args['with_f0']: |
| 163 | # cls.get_pitch(wav_fn, mel, res) |
| 164 | cls.get_pitch(wav, mel, res) |
| 165 | if binarization_args['with_txt']: |
| 166 | try: |
| 167 | # print(ph) |
| 168 | phone_encoded = res['phone'] = encoder.encode(ph) |
| 169 | except: |
| 170 | traceback.print_exc() |
| 171 | raise BinarizationError(f"Empty phoneme") |
| 172 | if binarization_args['with_align']: |
| 173 | cls.get_align(tg_fn, ph, mel, phone_encoded, res) |
| 174 | except BinarizationError as e: |
| 175 | print(f"| Skip item ({e}). item_name: {item_name}, wav_fn: {wav_fn}") |
| 176 | return None |
| 177 | return res |
| 178 | |
| 179 | |
| 180 | class MidiSingingBinarizer(SingingBinarizer): |
nothing calls this directly
no test coverage detected