Skip to content

Commit

Permalink
MIDI60: new config
Browse files Browse the repository at this point in the history
related to: #9
  • Loading branch information
anthonio9 committed Feb 18, 2024
1 parent 0000768 commit 012d0e2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
45 changes: 45 additions & 0 deletions config/ppn-split-midi60.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
MODULE = 'penn'

# Configuration name
CONFIG = 'ppn-split-midi60'

# gset only
DATASETS = ['gset']

EVALUATION_DATASETS = ['gset']

STEPS = 50000

LOG_INTERVAL = 500

CHECKPOINT_INTERVAL = 5000 # steps

# audio parameters
SAMPLE_RATE = 11025

# the original hopsize is 256 samples, this is 4 times less than that
HOPSIZE = 64

# use only the voiced frames
VOICED_ONLY = True

STRING_INDEX = None

# poly pitch net model
MODEL = 'ppnmidi60'

PITCH_BINS = 60

PITCH_CATS = 6

GSET_SPLIT_PLAYERS = True

REMOVE_OVERHANGS = True

MIDI60 = True

MIDI_OFFSET_RAND = 36

GAUSSIAN_BLUR = False

INTERPOLATE_UNVOICED = False
7 changes: 1 addition & 6 deletions penn/data/preprocess/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,13 @@ def gset():
pitch, times = extract_pitch_array_jams(
jams_track, audio_file.stem, uniform=True)

breakpoint()

if penn.STRING_INDEX is not None:
pitch = pitch[penn.STRING_INDEX, :]
pitch = pitch[None, :]

if penn.INTERPOLATE_UNVOICED:
# Fill unvoiced regions via linear interpolation
pitch, voiced = interpolate_unvoiced(pitch)
breakpoint()
else:
unvoiced = pitch == 0
voiced = ~unvoiced
Expand Down Expand Up @@ -812,9 +809,7 @@ def notes_dict_to_pitch_array60(

below36 = midi_array[midi_array < 36]

if not (below36 == 0).all():
breakpoint()
pass
assert not (below36 == 0).all():

offset_array = np.vstack(offset_list)

Expand Down
4 changes: 2 additions & 2 deletions penn/train/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ def train(datasets, directory, gpu=None, use_wand=False):
loader=test_loader,
gpu=gpu)

if use_wand:
if use_wand and not penn.MIDI60:
log_wandb.log({"test_logits": wandb.Image(fig)})

# Evaluate
if step % penn.LOG_INTERVAL == 0:
if step % penn.LOG_INTERVAL == 0 and not penn.MIDI60:
evaluate_fn = functools.partial(
evaluate,
directory,
Expand Down

0 comments on commit 012d0e2

Please sign in to comment.