Fix dumb type errors
This commit is contained in:
parent
d88a84db71
commit
4156bc8c26
7
main.py
7
main.py
|
@ -3,19 +3,22 @@ import slider as sl
|
|||
from datetime import timedelta
|
||||
import place
|
||||
import sound_process
|
||||
import numpy as np
|
||||
|
||||
def main():
|
||||
filename = fd.askopenfilename()
|
||||
beatmap = sl.Beatmap.from_path(filename)
|
||||
timing = beatmap.timing_points[0]
|
||||
bpm = timing.bpm
|
||||
offset = timing.offset.total_seconds() * 10e3
|
||||
offset = timing.offset.total_seconds() * 1000
|
||||
print(beatmap.audio_filename)
|
||||
|
||||
timings, amplitudes, freqs = sound_process.process_song(beatmap.audio_filename, int(bpm), offset0=offset, n_iter_2=48)
|
||||
data = sound_process.process_song(beatmap.audio_filename, int(bpm), offset0=offset)
|
||||
# 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]
|
||||
|
||||
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")
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import os
|
|||
import random
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
from datetime import timedelta
|
||||
|
||||
print("Starting...\n")
|
||||
|
||||
|
@ -424,9 +425,9 @@ def test_sample(timelist):
|
|||
|
||||
def convert_tuple(datares, freq):
|
||||
"""
|
||||
Takes datares and converts it to a list of tuples (amplitude, time in ms)
|
||||
Takes datares and converts it to a list of tuples (amplitude, datetimes)
|
||||
"""
|
||||
return [(i, datares[i], freq[i]) for i in range(len(datares)) if datares[i] > 0]
|
||||
return [(timedelta(milliseconds=i), datares[i], freq[i]) for i in range(len(datares)) if datares[i] > 0]
|
||||
|
||||
def get_songlen(filename):
|
||||
"""
|
||||
|
@ -484,7 +485,6 @@ def process_song(filename, bpm, offset0=0, div_len_factor=1, n_iter_2=-1, thresh
|
|||
Path(f"{filename}_trimmed.wav").unlink()
|
||||
return convert_tuple(datares, frequencies)
|
||||
|
||||
|
||||
def main():
|
||||
data = process_song("tetris_4.wav", 160, n_iter_2 = 64)
|
||||
#print(data)
|
||||
|
|
Loading…
Reference in New Issue