diff --git a/basic_pitch/inference.py b/basic_pitch/inference.py index 06fa54f..e8d03d5 100644 --- a/basic_pitch/inference.py +++ b/basic_pitch/inference.py @@ -458,6 +458,9 @@ def predict( multiple_pitch_bends: If True, allow overlapping notes in midi file to have pitch bends. melodia_trick: Use the melodia post-processing step. debug_file: An optional path to output debug data to. Useful for testing/verification. + midi_tempo: The tempo, in BPM, written to the output MIDI file's header. This only sets the + tempo metadata; note start/end times are taken from the audio in absolute seconds and are + not rescaled, so it does not change note timing or playback duration. Returns: The model output, midi data and note events from a single prediction """ @@ -544,6 +547,9 @@ def predict_and_save( melodia_trick: Use the melodia post-processing step. debug_file: An optional path to output debug data to. Useful for testing/verification. sonification_samplerate: Sample rate for rendering audio from MIDI. + midi_tempo: The tempo, in BPM, written to the output MIDI file's header. This only sets the + tempo metadata; note start/end times are taken from the audio in absolute seconds and are + not rescaled, so it does not change note timing or playback duration. """ for audio_path in audio_path_list: print("") diff --git a/basic_pitch/note_creation.py b/basic_pitch/note_creation.py index 753f5a1..c0a2322 100644 --- a/basic_pitch/note_creation.py +++ b/basic_pitch/note_creation.py @@ -232,6 +232,10 @@ def note_events_to_midi( multiple_pitch_bends : If True, allow overlapping notes to have pitch bends Note: this will assign each pitch to its own midi instrument, as midi does not yet support per-note pitch bends + midi_tempo : The tempo, in BPM, written to the output MIDI file's header via + initial_tempo. This only sets the tempo metadata, while the note start/end times are taken + from the audio in absolute seconds and are not rescaled, so it does not change note timing + or playback duration. Returns: pretty_midi.PrettyMIDI() object diff --git a/basic_pitch/predict.py b/basic_pitch/predict.py index 2b924e2..78146c6 100644 --- a/basic_pitch/predict.py +++ b/basic_pitch/predict.py @@ -122,7 +122,9 @@ def main() -> None: "--midi-tempo", type=float, default=120, - help="The tempo for the midi file.", + help="The tempo, in BPM, written to the MIDI file's header. Note: this only sets the tempo " + "metadata and does not change note timing or playback duration, which always follow the " + "original audio.", ) parser.add_argument( "--debug-file",