From 31639c850e5fb4f11f47470442ff28215fff73c4 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 31 May 2024 20:47:04 +0200 Subject: [PATCH] Compat issues --- compare_plot.py | 4 ++-- sound_process.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compare_plot.py b/compare_plot.py index 2804b4c..bea01c1 100644 --- a/compare_plot.py +++ b/compare_plot.py @@ -9,14 +9,14 @@ def compare_plot(): timing = beatmap.timing_points[0] bpm = timing.bpm offset = timing.offset.total_seconds() * 1000 - data = sound_process.process_song(beatmap.audio_filename, bpm, offset0=offset, n_iter_2=48) + data = sound_process.process_song(beatmap.audio_filename, bpm, offset0=offset, n_iter_2=48, divisor=4) timings, amplitudes, freqs = [x[0].total_seconds() for x in data], [x[1] for x in data], [x[2] for x in data] original_times = [x.time.total_seconds() for x in beatmap.hit_objects(spinners=False) if x.time.total_seconds() <= timings[len(timings) - 1]] #bx.scatter(original_times, ys=10, zs=0) - plt.scatter(timings, amplitudes, marker="x", c="red") + plt.scatter(timings, [1 if amplitudes[i] > 1000 else 0 for i in range(len(amplitudes))], marker="x", c="red") for x in original_times: plt.axvline(x=x) diff --git a/sound_process.py b/sound_process.py index d6e0a00..cf937eb 100755 --- a/sound_process.py +++ b/sound_process.py @@ -498,7 +498,7 @@ def process_song(filename, bpm, offset0=0, div_len_factor=1, n_iter_2=-1, thresh #void_freq(filename, offset, offset+div_len*(n_iter+1)+0.01, 4*60/bpm, minfreq=0, maxfreq=330, upperthr=2500, ampthr=60, ampfreq = 1200, ampval = 1/2000, leniency = 0.0, write=True, linear=True, output_file=filtered_name) datares = filter_n_percent_serial(filtered_name, offset, n_iter, div_len, threshold) #datares = snap(datares, 44100, bpm, 4, True) - datares = snap2(datares, 44100, bpm, first_offset=offset, div=4, show=True, adjust=True) + datares = snap2(datares, 44100, bpm, first_offset=offset, div=divisor, show=True, adjust=True) frequencies = get_freq(filtered_name, offset, div_len, div_len*n_iter, datares, True) Path(f"{filename}_trimmed.wav").unlink() return convert_tuple(datares, frequencies)