Skip to content

Commit

Permalink
Add checks for negative note duration
Browse files Browse the repository at this point in the history
  • Loading branch information
yqzhishen committed Jul 13, 2024
1 parent da80060 commit b9e6970
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion preprocessing/acoustic_binarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def load_meta_data(self, raw_data_dir: pathlib.Path, ds_id, spk_id):
assert len(temp_dict['ph_seq']) == len(temp_dict['ph_dur']), \
f'Lengths of ph_seq and ph_dur mismatch in \'{item_name}\'.'
assert all(ph_dur >= 0 for ph_dur in temp_dict['ph_dur']), \
f'Negative duration found in \'{item_name}\'.'
f'Negative ph_dur found in \'{item_name}\'.'
meta_data_dict[f'{ds_id}:{item_name}'] = temp_dict

self.items.update(meta_data_dict)
Expand Down
4 changes: 3 additions & 1 deletion preprocessing/variance_binarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def require(attr):
assert len(temp_dict['ph_seq']) == len(temp_dict['ph_dur']), \
f'Lengths of ph_seq and ph_dur mismatch in \'{item_name}\'.'
assert all(ph_dur >= 0 for ph_dur in temp_dict['ph_dur']), \
f'Negative duration found in \'{item_name}\'.'
f'Negative ph_dur found in \'{item_name}\'.'

if hparams['predict_dur']:
temp_dict['ph_num'] = [int(x) for x in require('ph_num').split()]
Expand All @@ -150,6 +150,8 @@ def require(attr):
if hparams['predict_pitch']:
temp_dict['note_seq'] = require('note_seq').split()
temp_dict['note_dur'] = [float(x) for x in require('note_dur').split()]
assert all(note_dur >= 0 for note_dur in temp_dict['note_dur']), \
f'Negative note_dur found in \'{item_name}\'.'
assert len(temp_dict['note_seq']) == len(temp_dict['note_dur']), \
f'Lengths of note_seq and note_dur mismatch in \'{item_name}\'.'
assert any([note != 'rest' for note in temp_dict['note_seq']]), \
Expand Down

0 comments on commit b9e6970

Please sign in to comment.