Update main.py to work with new code

This commit is contained in:
Thibaud 2024-06-03 12:17:33 +02:00
parent 1453e1d639
commit a567d0ef0d
2 changed files with 5 additions and 4 deletions

View File

@ -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")

View File

@ -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)