36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from tkinter import filedialog as fd
|
|
import slider as sl
|
|
from datetime import timedelta
|
|
import place
|
|
import sound_process
|
|
import os
|
|
import numpy as np
|
|
|
|
def main():
|
|
filename = fd.askopenfilename()
|
|
os.chdir(os.path.dirname(filename))
|
|
beatmap = sl.Beatmap.from_path(filename)
|
|
timing = beatmap.timing_points[0]
|
|
bpm = timing.bpm
|
|
offset = timing.offset.total_seconds() * 1000
|
|
print(beatmap.audio_filename)
|
|
|
|
amplitudes, timings, frequencies = 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 = [timedelta(seconds=x) for x in timings]
|
|
|
|
beatmap._hit_objects = place.greedy(bpm, offset, timings, amplitudes)
|
|
#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")
|
|
|
|
#timings, intensities = alexandre_process(bpm, offset, beatmap.audio_filename)
|
|
|
|
|
|
|
|
print(bpm)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|