added spec + some songs

This commit is contained in:
Alexandre 2024-12-29 21:58:41 +01:00
parent 8f035375ab
commit bb33b03436
3 changed files with 36 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.csv
.venv
songs/

BIN
audio.wav

Binary file not shown.

View File

@ -34,6 +34,12 @@ def is_note_within(fr1, fr2):
return (fr2/fr1 <= NOTE_DIST or dist_to_integer(fr2/fr1) >= OCTAVE_DIST)
def keep_highest(song_name, offset, songlen, segsize, count, output_name, minfreq=110, maxfreq=5000, ampthr=250):
'''
INPUT : data relative to music + config about the analysis
OUTPUT :
* a list of timings : it contains floats (representing circles) and couple of floats (representing sliders) (e.g. [float, float])
* a list of amplitudes relative to timings
'''
# extracting data from cropped song
sample_rate, raw_song_data = wavfile.read(song_name)
blit = int(sample_rate*segsize) # Te
@ -176,7 +182,7 @@ def keep_highest(song_name, offset, songlen, segsize, count, output_name, minfre
loct.append((left_id + right_id)/(2*sample_rate) + offset)
else:
locs.append(a_ampl)
loct.append([left_id/sample_rate, right_id/sample_rate])
loct.append([left_id/sample_rate + offset, right_id/sample_rate + offset])
a_ampl = 0
@ -364,14 +370,14 @@ BPM = 155
SEGSIZE = 1/(BPM/60)
wavved_song = convert_to_wav("songs/rushe.mp3")
'''
'''
# Tsubaki
SONG_LEN = 10
OFFSET = 35.659
BPM = 199
SEGSIZE = 1/(BPM/60)
wavved_song = convert_to_wav("songs/TSUBAKI.mp3")
'''
'''
# death
SONG_LEN = 8
@ -380,6 +386,32 @@ BPM = 180
SEGSIZE = 1/(BPM/60)
wavved_song = convert_to_wav("songs/Night of Knights.mp3")
'''
'''
# Bad apple
SONG_LEN = 8
OFFSET = 0.152
BPM = 138
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)[filtered].wav")
'''
'''
# Freedom dive
SONG_LEN = 7
OFFSET = 1.058
BPM = 222.22
SEGSIZE = 1/(BPM/60)
#wavved_song = convert_to_wav("songs/Freedom Dive (222.22-1058).mp3")
wavved_song = convert_to_wav("songs/Freedom Dive (222.22-1058)[filtered].wav")
'''
# Mevalogania
SONG_LEN = 7
OFFSET = 0
BPM = 240
SEGSIZE = 1/(BPM/60)
#wavved_song = convert_to_wav("songs/Megalovania(240-7984).mp3")
wavved_song = convert_to_wav("songs/Megalovania(240-7984)[filtered].wav")
#wavved_song = convert_to_wav("songs/tetris_2.wav")