From a567d0ef0da01e86069a21fbf85ec176fa73ee10 Mon Sep 17 00:00:00 2001 From: Thibaud Date: Mon, 3 Jun 2024 12:17:33 +0200 Subject: [PATCH] Update main.py to work with new code --- main.py | 5 ++--- sound_process.py | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 48e03e4..9811389 100644 --- a/main.py +++ b/main.py @@ -13,12 +13,11 @@ def main(): offset = timing.offset.total_seconds() * 1000 print(beatmap.audio_filename) - data = sound_process.process_song(beatmap.audio_filename, bpm, offset0=offset, n_iter_2=-1) + amplitudes, timings = sound_process.process_song(beatmap.audio_filename, bpm, offset0=offset, n_iter_2=-1) # NOTE : remove n_iter_2 to map the whole music - timings, amplitudes, freqs = [x[0] for x in data], [x[1] for x in data], [x[2] for x in data] + timings = [timedelta(seconds=x) for x in timings] beatmap._hit_objects = place.greedy(bpm, offset, timings, amplitudes) - beatmap.display_name = "TIPE's Extra" #beatmap._hit_objects = [sl.Slider(sl.Position(0, 0), timedelta(milliseconds=3), timedelta(milliseconds=130), 0, sl.curve.Linear([sl.Position(0, 0), sl.Position(100, 100)], 100), 100, 2, 1, 1, 1, timing.ms_per_beat, [], [],)] beatmap.write_path("rewrite.osu") diff --git a/sound_process.py b/sound_process.py index 5e81475..1a267de 100755 --- a/sound_process.py +++ b/sound_process.py @@ -343,11 +343,13 @@ def process_song(filename, bpm, offset0=0, div_len_factor=1, n_iter_2=-1, thresh datares = filter_n_percent_serial(filtered_name, offset, n_iter, div_len, threshold) + #snapped_data = amplitude + #times in ms (snapped_data, times) = debug.snap3(datares, mintime=50, initial_plot=True, after_plot=True) #frequencies=get_freq(filtered_name, offset, div_len, div_len*n_iter, snapped_data, True) Path(f"{filename}_trimmed.wav").unlink() - return convert_tuple(snapped_data, times) + return snapped_data, times ''' datares = debug.snap2(datares, 44100, bpm, first_offset=offset, div=divisor, show=True, adjust=True)