Skip to content

Commit

Permalink
pedal_on -> onset_time
Browse files Browse the repository at this point in the history
  • Loading branch information
kongqiuqiang committed Aug 26, 2020
1 parent 2553869 commit 8a184b8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions piano_transcription_inference/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ def write_events_to_midi(start_time, note_events, pedal_events, midi_path):

if pedal_events:
for pedal_event in pedal_events:
message_roll.append({'time': pedal_event['pedal_on'], 'control_change': 64, 'value': 127})
message_roll.append({'time': pedal_event['pedal_off'], 'control_change': 64, 'value': 0})
message_roll.append({'time': pedal_event['onset_time'], 'control_change': 64, 'value': 127})
message_roll.append({'time': pedal_event['offset_time'], 'control_change': 64, 'value': 0})

# Sort MIDI messages by time
message_roll.sort(key=lambda note_event: note_event['time'])
Expand Down Expand Up @@ -431,14 +431,14 @@ def detected_pedals_to_events(self, pedal_on_offs):
Returns:
pedal_events: list of dict, e.g.,
[{'pedal_on': 0.1800, 'pedal_off': 0.9669},
{'pedal_on': 1.1400, 'pedal_off': 2.6458},
[{'onset_time': 0.1800, 'offset_time': 0.9669},
{'onset_time': 1.1400, 'offset_time': 2.6458},
...]
"""
pedal_events = []
for i in range(len(pedal_on_offs)):
pedal_events.append({
'pedal_on': pedal_on_offs[i, 0],
'pedal_off': pedal_on_offs[i, 1]})
'onset_time': pedal_on_offs[i, 0],
'offset_time': pedal_on_offs[i, 1]})

return pedal_events

0 comments on commit 8a184b8

Please sign in to comment.