more
This commit is contained in:
parent
3b6ed078f4
commit
c2cfc429ae
|
@ -274,7 +274,8 @@ def keep_highest(song_name, offset, songlen, segsize, count, output_name, minfre
|
||||||
|
|
||||||
# -------------------------------------------- Write -------------------------------------------- #
|
# -------------------------------------------- Write -------------------------------------------- #
|
||||||
|
|
||||||
f = open("result_owen_2.txt", "w")
|
'''
|
||||||
|
f = open("result_megalovania.txt", "w")
|
||||||
f.write("Song name : " + song_name + "\n")
|
f.write("Song name : " + song_name + "\n")
|
||||||
f.write("Start : " + str(offset) + "\n")
|
f.write("Start : " + str(offset) + "\n")
|
||||||
f.write("End : " + str(offset+songlen) + "\n\n")
|
f.write("End : " + str(offset+songlen) + "\n\n")
|
||||||
|
@ -285,6 +286,7 @@ def keep_highest(song_name, offset, songlen, segsize, count, output_name, minfre
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
'''
|
||||||
|
|
||||||
return (loct, locs)
|
return (loct, locs)
|
||||||
|
|
||||||
|
@ -301,48 +303,6 @@ def convert_to_wav(song_name:str, output_file="audio.wav") -> str:
|
||||||
return output_file
|
return output_file
|
||||||
return song_name
|
return song_name
|
||||||
|
|
||||||
def retrieve_all_from_song(filename, t0, t1, bpm, dta=0.001, dtf=0.01, threshold=0.06, show=True):
|
|
||||||
# dt = sample interval
|
|
||||||
# threshold is in percent
|
|
||||||
|
|
||||||
if(t1 <= t0):
|
|
||||||
print("ERROR : t1 <= t0\n")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
# converts format to .wav
|
|
||||||
new_fn = convert_to_wav(filename)
|
|
||||||
|
|
||||||
print("Filtering song...")
|
|
||||||
#void_freq_clean(new_fn, t0, t1, dtf, 20, 20000, 0.05, "crop1.wav")
|
|
||||||
#def void_freq_clean(song_name, offset, songlen, segsize, minfreq, maxfreq, ampthr, output_name):
|
|
||||||
|
|
||||||
print("Now retrieving the frequencies")
|
|
||||||
(maxlist, maxamps) = retrieve_dominant_freqs(new_fn, t0, t1, dtf)
|
|
||||||
#def retrieve_dominant_freqs(song_name, offset, songlen, segsize):
|
|
||||||
|
|
||||||
print("Now retrieving the amplitudes")
|
|
||||||
amps = retrieve_dominant_amps(new_fn, t0, t1, dta, threshold, (4/(bpm/60))/4)
|
|
||||||
|
|
||||||
print("Len of freqs : ", len(maxlist), "|", len(maxamps))
|
|
||||||
print("Len of amps : ", len(maxlist), "|", len(amps))
|
|
||||||
|
|
||||||
maxa = amps[0]
|
|
||||||
for jj in amps:
|
|
||||||
if(jj > maxa):
|
|
||||||
maxa = jj
|
|
||||||
|
|
||||||
for i in range(len(amps)):
|
|
||||||
amps[i] = (amps[i] * 2000) / maxa
|
|
||||||
|
|
||||||
if(show):
|
|
||||||
timesF = [t0 + dtf*k for k in range(len(maxlist))]
|
|
||||||
timesA = [t0 + dta*k for k in range(len(amps))]
|
|
||||||
|
|
||||||
plt.plot(timesA, amps)
|
|
||||||
plt.plot(timesF, maxlist)
|
|
||||||
plt.show()
|
|
||||||
|
|
||||||
# free()
|
|
||||||
'''
|
'''
|
||||||
# c-type
|
# c-type
|
||||||
SONG_LEN = 7
|
SONG_LEN = 7
|
||||||
|
@ -398,23 +358,23 @@ BPM = 157
|
||||||
SEGSIZE = 1/(BPM/60)
|
SEGSIZE = 1/(BPM/60)
|
||||||
wavved_song = convert_to_wav("songs/owen(157.00024-1008).mp3")
|
wavved_song = convert_to_wav("songs/owen(157.00024-1008).mp3")
|
||||||
'''
|
'''
|
||||||
|
'''
|
||||||
# Owen 2/2
|
# Owen 2/2
|
||||||
SONG_LEN = 7
|
SONG_LEN = 7
|
||||||
OFFSET = 25.466
|
OFFSET = 25.466
|
||||||
BPM = 157
|
BPM = 157
|
||||||
SEGSIZE = 1/(BPM/60)
|
SEGSIZE = 1/(BPM/60)
|
||||||
wavved_song = convert_to_wav("songs/owen(157.00024-1008).mp3")
|
wavved_song = convert_to_wav("songs/owen(157.00024-1008).mp3")
|
||||||
|
'''
|
||||||
'''
|
'''
|
||||||
# death
|
# death
|
||||||
SONG_LEN = 8
|
SONG_LEN = 10
|
||||||
OFFSET = 21.750
|
OFFSET = 21.750
|
||||||
BPM = 180
|
BPM = 180
|
||||||
SEGSIZE = 1/(BPM/60)
|
SEGSIZE = 1/(BPM/60)
|
||||||
wavved_song = convert_to_wav("songs/Night of Knights.mp3")
|
wavved_song = convert_to_wav("songs/Night of Knights.mp3")
|
||||||
'''
|
'''
|
||||||
'''
|
|
||||||
# Bad apple
|
# Bad apple
|
||||||
SONG_LEN = 20
|
SONG_LEN = 20
|
||||||
OFFSET = 0.152
|
OFFSET = 0.152
|
||||||
|
@ -422,7 +382,7 @@ BPM = 138
|
||||||
SEGSIZE = 1/(BPM/60)
|
SEGSIZE = 1/(BPM/60)
|
||||||
#wavved_song = convert_to_wav("songs/Bad apple (138-152).mp3")
|
#wavved_song = convert_to_wav("songs/Bad apple (138-152).mp3")
|
||||||
wavved_song = convert_to_wav("songs/Bad apple (138-152)[filtered].wav")
|
wavved_song = convert_to_wav("songs/Bad apple (138-152)[filtered].wav")
|
||||||
'''
|
|
||||||
'''
|
'''
|
||||||
# Freedom dive
|
# Freedom dive
|
||||||
SONG_LEN = 7
|
SONG_LEN = 7
|
||||||
|
@ -446,6 +406,21 @@ NOTE_DIST = (2**(1/4))
|
||||||
OCTAVE_DIST = 0.05
|
OCTAVE_DIST = 0.05
|
||||||
|
|
||||||
# keep_highest(song_name, offset, songlen, segsize, count, output_name, minfreq=110, maxfreq=5000, ampthr=250):
|
# keep_highest(song_name, offset, songlen, segsize, count, output_name, minfreq=110, maxfreq=5000, ampthr=250):
|
||||||
(loct, locs) = keep_highest(wavved_song, OFFSET, SONG_LEN, SEGSIZE/4, 1, "Zblit.wav", minfreq=330, maxfreq=3000, ampthr=500)
|
(loct, locs) = keep_highest(wavved_song, OFFSET, SONG_LEN, SEGSIZE/4, 1, "Zblit.wav", minfreq=220, maxfreq=3000, ampthr=800)
|
||||||
|
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
loct2 = []
|
||||||
|
|
||||||
|
for k in loct:
|
||||||
|
if(type(k) == float):
|
||||||
|
loct2.append(k)
|
||||||
|
else:
|
||||||
|
loct2.append(k[0])
|
||||||
|
loct2.append(k[1])
|
||||||
|
|
||||||
|
for i in range(len(loct2)-1):
|
||||||
|
print("*"*(random.randint(10, 100)))
|
||||||
|
time.sleep(loct2[i+1]-loct2[i])
|
||||||
|
|
||||||
print("yipee")
|
print("yipee")
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
Song name : audio.wav
|
||||||
|
Start : 21.75
|
||||||
|
End : 31.75
|
||||||
|
|
||||||
|
Hit Objects :
|
||||||
|
21.80657596371882
|
||||||
|
21.86517006802721
|
||||||
|
21.954943310657598
|
||||||
|
22.158684807256236
|
||||||
|
22.288934240362813
|
||||||
|
22.47361678004535
|
||||||
|
22.554920634920634
|
||||||
|
22.686349206349206
|
||||||
|
22.807539682539684
|
||||||
|
22.91013605442177
|
||||||
|
23.045102040816328
|
||||||
|
23.131043083900227
|
||||||
|
23.180090702947847
|
||||||
|
23.220328798185943
|
||||||
|
[23.287528344671202, 23.367142857142856]
|
||||||
|
[23.472698412698414, 23.55392290249433]
|
||||||
|
23.821655328798187
|
||||||
|
23.95299319727891
|
||||||
|
24.15141723356009
|
||||||
|
24.22986394557823
|
||||||
|
24.498219954648526
|
||||||
|
24.66047619047619
|
||||||
|
[24.78424036281179, 24.884920634920636]
|
||||||
|
25.170090702947846
|
||||||
|
25.489603174603175
|
||||||
|
25.57687074829932
|
||||||
|
25.655873015873016
|
||||||
|
25.812653061224488
|
||||||
|
[25.908027210884356, 25.956757369614515]
|
||||||
|
25.993038548752835
|
||||||
|
[26.150385487528347, 26.199002267573697]
|
||||||
|
26.305804988662132
|
||||||
|
26.492925170068027
|
||||||
|
26.652392290249434
|
||||||
|
26.81343537414966
|
||||||
|
27.013990929705216
|
||||||
|
27.16793650793651
|
||||||
|
27.28827664399093
|
||||||
|
27.49448979591837
|
||||||
|
27.838990929705215
|
||||||
|
27.88766439909297
|
||||||
|
27.953197278911563
|
||||||
|
28.156689342403627
|
||||||
|
28.287687074829932
|
||||||
|
28.502426303854875
|
||||||
|
28.686780045351476
|
||||||
|
28.83141723356009
|
||||||
|
29.16842403628118
|
||||||
|
29.285532879818593
|
||||||
|
[29.477437641723355, 29.53560090702948]
|
||||||
|
29.660725623582767
|
||||||
|
29.810306122448978
|
||||||
|
29.866689342403628
|
||||||
|
30.13770975056689
|
||||||
|
[30.484603174603173, 30.555702947845806]
|
||||||
|
30.623378684807257
|
||||||
|
30.807585034013606
|
||||||
|
30.956666666666667
|
||||||
|
31.155680272108846
|
||||||
|
31.289024943310658
|
||||||
|
31.38056689342404
|
||||||
|
31.4947052154195
|
||||||
|
31.62167800453515
|
|
@ -5,8 +5,7 @@ End : 14.984
|
||||||
Hit Objects :
|
Hit Objects :
|
||||||
[8.078591836734693, 8.132503401360545]
|
[8.078591836734693, 8.132503401360545]
|
||||||
8.204578231292517
|
8.204578231292517
|
||||||
8.288115646258504
|
[8.288115646258504, 8.34134693877551]
|
||||||
8.34134693877551
|
|
||||||
8.527968253968254
|
8.527968253968254
|
||||||
[8.879102040816326, 8.922888888888888]
|
[8.879102040816326, 8.922888888888888]
|
||||||
[9.129260770975057, 9.181766439909296]
|
[9.129260770975057, 9.181766439909296]
|
||||||
|
@ -32,8 +31,7 @@ Hit Objects :
|
||||||
12.076947845804987
|
12.076947845804987
|
||||||
12.293716553287982
|
12.293716553287982
|
||||||
12.344793650793651
|
12.344793650793651
|
||||||
12.503886621315193
|
[12.503886621315193, 12.549975056689341]
|
||||||
12.549975056689341
|
|
||||||
[12.88151700680272, 12.925519274376416]
|
[12.88151700680272, 12.925519274376416]
|
||||||
13.12928344671202
|
13.12928344671202
|
||||||
13.183308390022676
|
13.183308390022676
|
||||||
|
@ -43,7 +41,8 @@ Hit Objects :
|
||||||
13.776233560090702
|
13.776233560090702
|
||||||
13.816392290249432
|
13.816392290249432
|
||||||
13.914839002267573
|
13.914839002267573
|
||||||
[14.015201814058956, 14.068489795918367]
|
14.015201814058956
|
||||||
|
14.068489795918367
|
||||||
14.142446712018142
|
14.142446712018142
|
||||||
14.282956916099774
|
14.282956916099774
|
||||||
14.527979591836734
|
14.527979591836734
|
||||||
|
|
Loading…
Reference in New Issue