Skip to content

Commit

Permalink
Remove redundant pedals after transcription (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
loubbrad authored Oct 9, 2024
1 parent 5a904e6 commit 34bd2a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion amt/inference/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ def _truncate_seq(
return res


# TODO: Add detection for pedal messages which occur before notes are played
def _process_silent_intervals(
seq: List,
intervals: List,
Expand Down Expand Up @@ -826,6 +825,7 @@ def _save_seq(_seq: List, _save_path: str):
tokenized_seq=_seq,
len_ms=last_onset,
)
mid_dict.remove_redundant_pedals()
mid = mid_dict.to_midi()
mid.save(_save_path)
except Exception as e:
Expand Down Expand Up @@ -1027,6 +1027,10 @@ def batch_transcribe(
):
file_queue.put(file_to_process)

# If only processing one file, add even if save file exists
if len(files_to_process) == 1:
file_queue.put(files_to_process[0])

logger.info(
f"Files to process: {file_queue.qsize()}/{len(files_to_process)}"
)
Expand Down

0 comments on commit 34bd2a2

Please sign in to comment.