Make new snapping plot more similar to osu editor
This commit is contained in:
parent
31639c850e
commit
ad5049d1ca
|
@ -418,9 +418,10 @@ def snap2(data, sample_rate, bpm, first_offset=0, div=4, show=False, adjust=Fals
|
||||||
|
|
||||||
|
|
||||||
if(show):
|
if(show):
|
||||||
new2 = [0.9 if new[i] != 0 else 0 for i in range(len(new))]
|
|
||||||
|
|
||||||
t = [j/1000+first_offset for j in range(len(new))]
|
t = [j/1000+first_offset for j in range(len(new))]
|
||||||
|
scatter_t = [t[i] for i in range(len(new)) if new[i] != 0]
|
||||||
|
scatter_chosen_rhythm = [0.9 for i in range(len(new)) if new[i] != 0 ]
|
||||||
beats_1 = [0 for j in range(len(new))]
|
beats_1 = [0 for j in range(len(new))]
|
||||||
beats_2 = [0 for k in range(len(new))]
|
beats_2 = [0 for k in range(len(new))]
|
||||||
beats_4 = [0 for l in range(len(new))]
|
beats_4 = [0 for l in range(len(new))]
|
||||||
|
@ -436,20 +437,24 @@ def snap2(data, sample_rate, bpm, first_offset=0, div=4, show=False, adjust=Fals
|
||||||
beats_4[int(1000*current_t)] = 0.9
|
beats_4[int(1000*current_t)] = 0.9
|
||||||
|
|
||||||
if(k % 2 == 0):
|
if(k % 2 == 0):
|
||||||
beats_2[int(1000*current_t)] = 0.92
|
beats_2[int(1000*current_t)] = 0.902
|
||||||
|
|
||||||
if(k % 4 == 0):
|
if(k % 4 == 0):
|
||||||
beats_1[int(1000*current_t)] = 0.94
|
beats_1[int(1000*current_t)] = 0.91
|
||||||
|
|
||||||
|
if(k % 16 == 0):
|
||||||
|
beats_1[int(1000*current_t)] = 0.915
|
||||||
|
|
||||||
k += 1
|
k += 1
|
||||||
current_t = first_offset + k*60/(bpm*div)
|
current_t = first_offset + k*60/(bpm*div)
|
||||||
|
|
||||||
plt.plot(t, new2, "bo")
|
points = plt.scatter(scatter_t, scatter_chosen_rhythm, marker="o", label="Detected Rhythm")
|
||||||
plt.plot(t, beats_4, "r-")
|
div1_plot, = plt.plot(t, beats_4, "b-", label="1/4")
|
||||||
plt.plot(t, beats_2, "y-")
|
div2_plot, = plt.plot(t, beats_2, "r-", label="1/2")
|
||||||
plt.plot(t, beats_1, "g-")
|
div3_plot, = plt.plot(t, beats_1, "black", label="1/1")
|
||||||
plt.xlabel("Time (s)")
|
plt.xlabel("Time (s)")
|
||||||
plt.ylabel("Amplitude")
|
#plt.ylabel("Amplitude")
|
||||||
|
plt.legend(handles=[points, div1_plot, div2_plot, div3_plot])
|
||||||
plt.grid()
|
plt.grid()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
@ -1020,4 +1025,4 @@ def filter_n_percent(song_name, offset, length, threshold, reduce, show):
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
return song_data
|
return song_data
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue