genres_ALOTC = [0, 0, 0, 0, 0, 0, 0, 0] g_id = 0 for genre_name in genres: try: print(genre_name) rng_h, rng_t = qui_genre_rng(genre_name) for file_number in range(rng_h, rng_t): # for file_number in range(rng_h, rng_h + 10): try: print("id =", file_number, end=' - - - ') aud, sr = d[file_number] total_time = aud.shape[0] / sr D = fourier_tempogram(aud) s = D.shape[1] # 2048 22050 f_tempo_list = [] for t in range(D.shape[1]): # get every most tempo and list them f_tempo_list.append( ff_get_two_tempo(D, t, total_time)[0][0]) # get t1 t2 by using the most exist tempo_list, tempo_cnt = get_tempo_distribu( f_tempo_list) t_1, t_2 = f_get_two_tempo_total(tempo_list, tempo_cnt)
dataset = BallroomData() # song_id = 3 # # 50 # aud, sr = dataset[song_id] clicks = ["60.mp3", "78.mp3", "120.mp3", "134.mp3", "160.mp3", "171.mp3"] # clicks = ["78.mp3", "120.mp3", "134.mp3", "160.mp3", "171.mp3"] for click in clicks: print("click =", click) aud, sr = librosa.load(os.path.join(".", "click", click)) total_time = aud.shape[0] / sr D = fourier_tempogram(aud) # 2048 20050 for t in range(D.shape[1]): print("f_get_two_tempo", end=' : ') print( "- - - - - - - - - - - - - - - - - - - - - - - - - - " "(t%d)" % t, f_get_two_tempo(D, t, total_time)) # print("gt = ", end='') # print(dataset.get_gt_bpm(song_id)) # librosa.display.specshow(D[40:, :]) # plt.title(click) # plt.show()