diff --git a/pytest/modules/Pitcher/test_pitcher.py b/pytest/modules/Pitcher/test_pitcher.py new file mode 100644 index 0000000..e623986 --- /dev/null +++ b/pytest/modules/Pitcher/test_pitcher.py @@ -0,0 +1,27 @@ +"""Tests for pitcher.py""" + +import os +import unittest +import src.modules.Pitcher.pitcher as test_subject +import pytest +from src.modules.plot import plot + + +class PitcherTest(unittest.TestCase): + @pytest.mark.skip(reason="Skipping this FUNCTION level test, can be used for manual tests") + def test_get_pitch_with_crepe_file(self): + # Arrange + test_dir = os.path.dirname(os.path.abspath(__file__)) + root_dir = os.path.abspath(test_dir + "/../../..") + # test_file_abs_path = os.path.abspath(root_dir + "/test_input/audio_denoised.wav") + test_file_abs_path = os.path.abspath(root_dir + "/test_input/test_denoised.wav") + test_output = root_dir + "/test_output" + + # Act + pitched_data = test_subject.get_pitch_with_crepe_file(test_file_abs_path, 'full', device="cuda") + # test_subject.get_pitch_with_crepe_file(test_file_abs_path, 'full', 'cpu', batch_size=1024) + plot(pitched_data, test_output, title="pitching test") + print("done") + +if __name__ == "__main__": + unittest.main() diff --git a/src/modules/Midi/midi_creator.py b/src/modules/Midi/midi_creator.py index 7ddf4b9..02d4440 100644 --- a/src/modules/Midi/midi_creator.py +++ b/src/modules/Midi/midi_creator.py @@ -102,18 +102,6 @@ def create_midi_notes_from_pitched_data(start_times: list[float], end_times: lis word = str(words[index]) midi_segment = create_midi_note_from_pitched_data(start_time, end_time, pitched_data, word) - - # segment_count = len(midi_segment) - # if segment_count > 1: - # for index, midi_segment in enumerate(midi_segment[1:]): - # midi_segment.word = "~" - # - # if word.endswith(" "): - # word = word[:-1] - # midi_segment[-1].word += " " - # - #midi_segment[0].word = word - #new_segments.extend(midi_segment) new_segments.append(midi_segment) # todo: Progress?