Skip to content

Commit dcfd40f

Browse files
committed
Support skipping glide
1 parent ef44d19 commit dcfd40f

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

configs/continuous.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ raw_data_dir: []
77
binary_data_dir: null
88
binarization_args:
99
num_workers: 0
10+
skip_glide: true # skip data with glide
1011
merge_rest: true # merge continuous rest notes
1112
merge_slur: true # merge slurs with the similar pitch
1213
round_midi: false # round midi value

configs/discrete.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ binary_data_dir: data/some_ds_quant_spk4_aug8/binary
88
binarization_args:
99
num_workers: 0
1010
shuffle: true
11+
skip_glide: true # skip data with glide
1112
merge_rest: true # merge continuous rest notes
1213
merge_slur: true # merge slurs with the similar pitch
1314
use_bound_loss: true

preprocessing/me_binarizer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class MIDIExtractionBinarizer(BaseBinarizer):
3939
def __init__(self, config: dict):
4040
super().__init__(config, data_attrs=MIDI_EXTRACTION_ITEM_ATTRIBUTES)
4141
self.lr = LengthRegulator().to(self.device)
42+
self.skip_glide = self.binarization_args['skip_glide']
4243
self.merge_rest = self.binarization_args['merge_rest']
4344
self.merge_slur = self.binarization_args['merge_slur']
4445
self.slur_tolerance = self.binarization_args.get('slur_tolerance')
@@ -60,6 +61,11 @@ def load_meta_data(self, raw_data_dir: pathlib.Path, ds_id):
6061
ds = json.load(f)
6162
if isinstance(ds, list):
6263
ds = ds[0]
64+
if self.skip_glide and ds.get('note_glide') is not None and any(
65+
g != 'none' for g in ds['note_glide'].split()
66+
):
67+
print(f'Item {ds_id}:{item_name} contains glide notes. Skipping.')
68+
continue
6369
# normalize
6470
note_seq = [
6571
librosa.midi_to_note(

0 commit comments

Comments
 (0)