def RhythmMasterLevelPorcess(): # pathname = r'I:\librosa\RhythmMaster\hangengxman\hangengxman_4k_nm.imd' # level = LevelInfo.LoadRhythmMasterLevel(pathname) # print(type(level)) # count = 0 # for note in level: # if note[1] == 3: # print(count, type(note[2])) # count += 1 songList = ['feiyuedexin'] songList = ['aiqingmaimai'] x, y = PrepareTrainData(songList, 32, True) y = y[:, 3] acceptThrehold = 0.9 pathname = MakeMp3Pathname(songList[0]) # y = y > acceptThrehold # LevelInfo.SaveSamplesToRegionFile(y, pathname, 'region') # return notes = postprocess.TrainDataToLevelData(y, 0, acceptThrehold) notes = np.asarray(notes) notes[0] notes = notes[:, 0] LevelInfo.SaveInstantValue(notes, pathname, '_slide')
def GenerateLevel(predicts, pathname): short = predicts[:, 1] short = postprocess.PickInstanceSample(short, count=400) notes = postprocess.TrainDataToLevelData(short, 10, 0.1, 0) notes = notes[:, 0] LevelInfo.SaveInstantValue(notes, pathname, '_inst_beat')
def GenerateLevel(predicts, pathname): pre = predicts[:, 1] # pre = postprocess.PurifyInstanceSample(pre) # picked = postprocess.PickInstanceSample(pre) # sam = np.zeros_like(pre) # sam[picked] = 1 notes = postprocess.TrainDataToLevelData(pre, 10, 0.90, 0) notes = np.asarray(notes) notes[0] notes = notes[:, 0] LevelInfo.SaveInstantValue(notes, pathname, '_inst_singing')
def GenerateLevel(predicts, pathname): # #for long note # print('evaluate shape', evaluate.shape) # predicts = evaluate[:,1] > acceptThrehold # LevelInfo.SaveSamplesToRegionFile(predicts, pathname, '_region') # return # predicts = postprocess.pick(evaluate, kernelSize=11) print('predicts', predicts.shape) # postprocess.SaveResult(predicts, testy, 0, r'I:\work\result.log') acceptThrehold = 0.8 pred = predicts[:, 1] notes = postprocess.TrainDataToLevelData(pred, 10, acceptThrehold, 0) print('gen notes number', len(notes)) notes = notes[:, 0] LevelInfo.SaveInstantValue(notes, pathname, '_region')
def SaveShortNoteFile( pathname=r'I:\librosa\RhythmMaster\breakfree\breakfree_4k_nm.imd'): # 读取节奏大师关卡,生成文件 duration = LevelInfo.ReadRhythmMasterLevelTime(pathname) level = LevelInfo.LoadRhythmMasterLevel(pathname) numSample = duration // 10 targetData = ConvertLevelToLables(level, numSample) beat = np.max(targetData[:, 1:4], axis=1) # beat[:] = 0 long = np.max(targetData[:, 4:5], axis=1) for i in range(1, len(long)): if long[i - 1] == 0 and long[i] > 0: beat[i] = 1 note = postprocess.TrainDataToLevelData(beat, 10, 0.1) note = note[:, 0] print('note count', len(note)) LevelInfo.SaveInstantValue(note, pathname, '_origshort')
def LoadRawData(useSoftmax=True): songList = ['hangengxman'] songList = ['jilejingtu'] with open('I:/work/evaluate_data.raw', 'rb') as file: evaluate = pickle.load(file) print(type(evaluate)) acceptThrehold = 0.4 pathname = MakeMp3Pathname(songList[0]) #for long note print('evaluate shape', evaluate.shape) predicts = evaluate[:, 1] > acceptThrehold LevelInfo.SaveSamplesToRegionFile(predicts, pathname, '_region') return predicts = postprocess.pick(evaluate) # postprocess.SaveResult(predicts, testy, 0, r'I:\work\result.log') if useSoftmax: predicts = predicts[:, 1] acceptThrehold = 0.7 notes = postprocess.TrainDataToLevelData(predicts, 0, acceptThrehold) notes = np.asarray(notes) notes[0] pathname = MakeMp3Pathname(songList[0]) duration, bpm, entertime = LoadMusicInfo(pathname) levelNotes = postprocess.ConvertToLevelNote(notes, bpm, entertime) levelFilename = 'I:/work/%s.xml' % (songList[0]) LevelInfo.GenerateIdolLevel(levelFilename, levelNotes, bpm, entertime, duration) notes = notes[:, 0] LevelInfo.SaveInstantValue(notes, pathname, '_predict')