def stdCalc(bmap, count0: int, count50: int, count100: int, count300: int, combo: int, mods: int, perfect: int, max_combo: int): p = pyt.parser() beatmap = p.map(bmap) objcount = beatmap.ncircles + beatmap.nsliders + beatmap.nspinners totalhits = count50 + count100 + count300 sr = pyt.diff_calc().calc(beatmap, mods) pp, _, _, _, _ = pyt.ppv2(sr.aim, sr.speed, bmap=beatmap, mods=mods, n300=count300, n100=count100, n50=count50, nmiss=count0, combo=combo) pp_fc = 0 if perfect == 0: pp_fc, _, _, _, _ = pyt.ppv2(sr.aim, sr.speed, bmap=beatmap, mods=mods, n300=objcount - totalhits, n100=count100, n50=count50, nmiss=0, combo=max_combo) return round(sr.total, 2), round(pp, 2), round(pp_fc, 2)
def calculate_score_pp(self, beatmap_id, score): p = osu.parser() beatmap_url = "https://osu.ppy.sh/osu/{0}".format(beatmap_id) beatmap_raw = requests.get(beatmap_url).text f = codecs.open(Logic.temp_beatmap_name, "w+", "utf-8") f.write(beatmap_raw) f.close() f = codecs.open(Logic.temp_beatmap_name, encoding="utf-8") clean_beatmap = p.map(f) f.close() os.remove(Logic.temp_beatmap_name) stars = osu.diff_calc().calc( clean_beatmap, osu.mods_from_str(score.get_mods_string())) pp, _, _, _, acc = osu.ppv2(aim_stars=stars.aim, speed_stars=stars.speed, bmap=clean_beatmap, mods=osu.mods_from_str( score.get_mods_string()), combo=score.max_combo, n300=score.number_300s, n100=score.number_100s, n50=score.number_50s, nmiss=score.misses) return pp, acc
def set_embed_pp( self, mods: Mods = None, acc: tuple[Union[float, int]] = (95, 97.5, 100), ) -> None: if self.mode != 0: return if not mods: mods = self.mods self.embed_pp_values = [] stars = pyttanko.diff_calc().calc(self.mapfile, mods._value_) for a in acc: n300, n100, n50 = pyttanko.acc_round(a, len(self.mapfile.hitobjects), 0) pp = pyttanko.ppv2( stars.aim, stars.speed, n100=n100, n50=n50, mods=mods._value_, bmap=self.mapfile, n300=n300, )[0] self.embed_pp_values.append(f'{a}%-{pp:.2f}PP')
def get_pyttanko(bmap_file, mods: int): """Uses pyttanko to parse the map each hitobject contains the strain values. Thanks Francesco""" bmap = pyttanko.parser().map(open(bmap_file)) stars = pyttanko.diff_calc().calc(bmap, mods=mods) return bmap
def run(): ERROR_MARGIN = 0.02 '''pp can be off by +- 2% margin is actually 3x for < 100pp, 2x for 100-200, 1.5x for 200-300''' p = pyttanko.parser() bmap = pyttanko.beatmap() stars = pyttanko.diff_calc() try: for s in suite.suite: print_score(s) with open("test/test_suite/%d.osu" % (s.id), "r") as f: p.map(f, bmap=bmap) stars.calc(bmap, s.mods) pp, _, _, _, _ = pyttanko.ppv2(stars.aim, stars.speed, bmap=bmap, mods=s.mods, n300=s.n300, n100=s.n100, n50=s.n50, nmiss=s.nmiss, combo=s.max_combo) margin = s.pp * ERROR_MARGIN if s.pp < 100: margin *= 3 elif s.pp < 200: margin *= 2 elif s.pp < 300: margin *= 1.5 if abs(pp - s.pp) >= margin: pyttanko.info("failed test: got %gpp, expected %g\n" % (pp, s.pp)) exit(1) except KeyboardInterrupt: pass except FileNotFoundError: pyttanko.info("please download the test suite by running " + "./download_suite\n") sys.exit(1) except Exception as e: if p.done: raise else: pyttanko.info("%s\n%s\n" % (traceback.format_exc(), str(p))) sys.exit(1)
def convert_star_rating(self) -> float: m = (Mods.NOMOD, Mods.NOFAIL, Mods.AUTOPILOT, Mods.RELAX, Mods.SPUNOUT) if not self.mods in m and self.mode == 0: sr = pyttanko.diff_calc().calc(self.mapfile, self.mods) if not sr: star_rating = self.difficulty else: star_rating = sr.total else: star_rating = self.difficulty return star_rating
def get_real_pp(self): stars = pyttanko.diff_calc().calc(self.bmap, self.mods) ppv2 = pyttanko.ppv2(aim_stars=stars.aim, speed_stars=stars.speed, mods=self.mods, n100=self.count100, n50=self.count50, n300=self.count300, nmiss=self.misses, combo=self.combo, bmap=self.bmap) return round(ppv2[0], 2)
def calc_if(osufile, mods_num, c50, c100, mapcb): p = osu.parser() with open(osufile, 'r', encoding='utf-8') as f: bmap = p.map(f) stars = osu.diff_calc().calc(bmap, mods_num) pp = osu.ppv2( stars.aim, stars.speed, mods=mods_num, n100=c100, n50=c50, nmiss=0, max_combo=mapcb, bmap=bmap ) return pp[0]
def get_if_fc_pp(self): # Set miss count to zero self.misses = 0 self.combo = self.bmap.max_combo() stars = pyttanko.diff_calc().calc(self.bmap, self.mods) # max_combo used if combo is not provided => # don't need to set it manually ppv2 = pyttanko.ppv2(stars.aim, stars.speed, n100=self.count100, n50=self.count50, n300=self.count300, mods=self.mods, bmap=self.bmap) return round(ppv2[0], 2)
def pp_if_fc(self) -> tuple[float, float]: if self.mode != 0: return n100 = round(self.n100 / 1.5) n50 = round(self.n50 / 1.5) stars = pyttanko.diff_calc().calc(self.bmap.mapfile, self.mods._value_) data = pyttanko.ppv2(stars.aim, stars.speed, bmap=self.bmap.mapfile, mods=self.mods._value_, n100=n100, n50=n50) return data[0], data[4]
def calc_acc_pp(osufile, mods_num): acc_pp = [] p = osu.parser() with open(osufile, 'r', encoding='utf-8') as f: bmap = p.map(f) stars = osu.diff_calc().calc(bmap, mods_num) for acc in range(95, 101): c300, c100, c50 = osu.acc_round(acc, len(bmap.hitobjects), 0) pp, _, _, _, _ = osu.ppv2( stars.aim, stars.speed, mods=mods_num, n300=c300, n100=c100, n50=c50, bmap=bmap ) acc_pp.append(int(pp)) return acc_pp
def std(map_id, beatmap, mods, combo, n300, n100, n50, nmiss): """Get pp for a Standard play.""" if not beatmap["text"]: return None parser = pyttanko.parser() with io.StringIO(beatmap["text"]) as f: bmap = parser.map(f) stars = pyttanko.diff_calc().calc(bmap, mods) return pyttanko.ppv2( aim_stars=stars.aim, speed_stars=stars.speed, mods=mods, combo=combo, n300=n300, n100=n100, n50=n50, nmiss=nmiss, bmap=bmap, )[0]
def calculate_osu_pp(self, osu_file, mods=0): """ 计算pp :param osu_file: file osu后缀名的文件 :param mods: int 模式 HR HD DT NF等,可调用api进行查看 :param n300: int 300 :param n100: int 100 :param n50: int 50 :param nmiss: int miss :param combo: int 最大的连击数 :return: (str stars星级, str pp点) """ p = osu.parser() with open(osu_file, "r", encoding="utf-8") as f: bmap = p.map(f) stars = osu.diff_calc().calc(bmap) if self.is_search_map is True: pp, _, _, _, _ = osu.ppv2(stars.aim, stars.speed, bmap=bmap, mods=mods) else: pp, _, _, _, _ = osu.ppv2(stars.aim, stars.speed, bmap=bmap, mods=self.int_mods, n300=self.count300, n100=self.count100, n50=self.count50, nmiss=self.countmiss, combo=self.maxcombo) # pp, _, _, _, _ = osu.ppv2( # stars.aim, stars.speed, bmap=bmap, mods=mods, # n300=n300, n100=n100, n50=n50, nmiss=nmiss, # combo=combo # ) return "{:.1f}".format(stars.total), "{}".format(int(pp))
def calc_pp(osufile, mods_num, maxcb, c50, c100, c300, miss): p = osu.parser() with open(osufile, 'r', encoding='utf-8') as f: bmap = p.map(f) stars = osu.diff_calc().calc(bmap, mods_num) map_stars = stars.total pp, aim, speed, acc, accuracy = osu.ppv2( stars.aim, stars.speed, mods=mods_num, combo=maxcb, n300=c300, n100=c100, n50=c50, nmiss=miss, bmap=bmap ) cs = bmap.cs ar = bmap.ar od = bmap.od hp = bmap.hp play_pp = int(round(pp, 2)) aim_pp = int(round(aim, 2)) speed_pp = int(round(speed, 2)) acc_pp = int(round(acc, 2)) accuracy = round(accuracy, 2) return map_stars, cs, ar, od, hp, play_pp, aim_pp, speed_pp, acc_pp, accuracy
def bmapData(self, mapId, modsInt): if self.bmapDict.get("{}+{}".format(mapId, modsInt)) == None: map = requests.get("https://osu.ppy.sh/osu/{}".format(mapId)) map = map.content wrapper = io.BufferedReader(io.BytesIO(map)) wrapper = io.TextIOWrapper(wrapper, encoding="utf-8") parser = osu.parser() bmap = parser.map(wrapper) stars = osu.diff_calc().calc(bmap, modsInt) self.bmapDict["{}+{}".format(mapId, modsInt)] = { "ar": bmap.ar, "od": bmap.od, "maxcombo": bmap.max_combo(), "nobjects": len(bmap.hitobjects), "nsliders": bmap.nsliders, "ncircles": bmap.ncircles, "aim": stars.aim, "speed": stars.speed } with open("bmaps.json", "w") as file: file.write(json.dumps(self.bmapDict, indent=4)) return self.bmapDict["{}+{}".format(mapId, modsInt)] else: return self.bmapDict["{}+{}".format(mapId, modsInt)]
def _prep_data_worker(self, start, end, filenames): session = self.DBSession() i = start total_writes = 0 while i < end: print('{}: {}/{}'.format(filenames[i], i - start, end - start)) extract_path = os.path.join(self.extract_root, filenames[i].replace(" ", "_")) os.makedirs(extract_path, exist_ok=True) try: with zipfile.ZipFile(os.path.join(self.beatmaps_root, filenames[i]), "r") as zip_ref: zip_info = zip_ref.infolist() beatmap_list = [] # search for all beatmap files for info in zip_info: if '.osu' in info.filename: # extract beatmap data = zip_ref.read(info) bmfile_path = os.path.join(extract_path, os.path.basename(info.filename)) bmfile = open(bmfile_path, 'wb') bmfile.write(data) bmfile.close() # read the beatmap to find related audio file try: file = open(bmfile_path) p = pyttanko.parser() bmap = p.map(file) audio_file_name = bmap.audio_filename.strip().lower() audio_path = os.path.join(extract_path, audio_file_name) wave_filepath = audio_path + '.wav' for jifo in zip_info: if jifo.filename.lower() == audio_file_name and not os.path.isfile( os.path.join(extract_path, audio_file_name)): # extract audio for beatmap data = zip_ref.read(jifo) audio = open(audio_path, 'wb') audio.write(data) audio.close() # convert to wav stream = ffmpeg.input(audio_path) stream = ffmpeg.output(stream, wave_filepath, ac=1) ffmpeg.run(stream, quiet=True, overwrite_output=True) # calculate difficulty if bmap.mode == 0: file = open(bmfile_path) p = pyttanko.parser() bmap = p.map(file) diff = pyttanko.diff_calc().calc(bmap) file.close() # save metadata to mysql db date = datetime.datetime(*info.date_time[0:6]) new_bm_metadata = BeatmapMetadata(bmFilePath=bmfile_path, audioFilePath=wave_filepath, gamemodeType=bmap.mode, difficulty=diff.total, dateCreated=date) session.add(new_bm_metadata) except Exception as e: print("error parsing beatmap or audiofile, deleting beatmap: ", e) os.remove(bmfile_path) except(zipfile.BadZipFile): print("Bad zipfile: ", filenames[i]) i += 1 session.commit()
def _prep_data_worker(self, start, end, full_filepaths): """Processes a subset of the compressed beatmap sets in the range [start:end). :param start: An integer describing the start index of filenames to process (inclusive). :param end: An integer describing the end index of filenames to process (exclusive). :param full_filepaths: An list of filepaths of which a subset will be processed by this function. """ session = self.DBSession() i = start while i < end: print('{}: {}/{}'.format(full_filepaths[i], i - start, end - start)) extract_path = os.path.join(self.extract_root, full_filepaths[i].replace(" ", "_")) os.makedirs(extract_path, exist_ok=True) try: with zipfile.ZipFile( os.path.join(self.beatmaps_root, full_filepaths[i]), "r") as zip_ref: zip_info = zip_ref.infolist() # search for all beatmap files for info in zip_info: if '.osu' in info.filename: # extract beatmap data = zip_ref.read(info) bmfile_path = os.path.join( extract_path, os.path.basename(info.filename)) bmfile = open(bmfile_path, 'wb') bmfile.write(data) bmfile.close() # read the beatmap to find related audio file try: file = open(bmfile_path) p = pyttanko.parser() bmap = p.map(file) audio_file_name = bmap.audio_filename.strip( ).lower() audio_path = os.path.join( extract_path, audio_file_name) wave_filepath = audio_path + '.wav' for jifo in zip_info: if jifo.filename.lower( ) == audio_file_name and not os.path.isfile( os.path.join( extract_path, audio_file_name)): # extract audio for beatmap data = zip_ref.read(jifo) audio = open(audio_path, 'wb') audio.write(data) audio.close() # convert to wav stream = ffmpeg.input(audio_path) stream = ffmpeg.output(stream, wave_filepath, ac=1) ffmpeg.run(stream, quiet=True, overwrite_output=True) # calculate difficulty if bmap.mode == 0: file = open(bmfile_path) p = pyttanko.parser() bmap = p.map(file) diff = pyttanko.diff_calc().calc(bmap) file.close() # save metadata to mysql db date = datetime.datetime(*info.date_time[0:6]) new_bm_metadata = BeatmapMetadata( bmFilePath=bmfile_path, audioFilePath=wave_filepath, gamemodeType=bmap.mode, difficulty=diff.total, dateCreated=date) session.add(new_bm_metadata) except Exception as e: print( "error parsing beatmap or audiofile, deleting beatmap: ", e) os.remove(bmfile_path) except zipfile.BadZipFile: print("Bad zipfile: ", full_filepaths[i]) i += 1 session.commit()
async def get_pyttanko(self, map_id: str, accs=[100], mods=0, misses=0, combo=None, completion=None, fc=None): url = 'https://osu.ppy.sh/osu/{}'.format(map_id) file_path = os.getcwd() + '/temp/{}.osu'.format(map_id) await self.download_file(url, file_path) bmap = pyttanko.parser().map(open(file_path)) _, ar, od, cs, hp = pyttanko.mods_apply(mods, ar=bmap.ar, od=bmap.od, cs=bmap.cs, hp=bmap.hp) stars = pyttanko.diff_calc().calc(bmap, mods=mods) bmap.stars = stars.total bmap.aim_stars = stars.aim bmap.speed_stars = stars.speed if not combo: combo = bmap.max_combo() bmap.pp = [] bmap.aim_pp = [] bmap.speed_pp = [] bmap.acc_pp = [] bmap.acc = accs for acc in accs: n300, n100, n50 = pyttanko.acc_round(acc, len(bmap.hitobjects), misses) pp, aim_pp, speed_pp, acc_pp, _ = pyttanko.ppv2(bmap.aim_stars, bmap.speed_stars, bmap=bmap, mods=mods, n300=n300, n100=n100, n50=n50, nmiss=misses, combo=combo) bmap.pp.append(pp) bmap.aim_pp.append(aim_pp) bmap.speed_pp.append(speed_pp) bmap.acc_pp.append(acc_pp) if fc: n300, n100, n50 = pyttanko.acc_round(fc, len(bmap.hitobjects), 0) # print("-------------", n300, n100, n50) fc_pp, _, _, _, _ = pyttanko.ppv2(bmap.aim_stars, bmap.speed_stars, bmap=bmap, mods=mods, n300=n300 + misses, n100=n100, n50=n50, nmiss=0, combo=bmap.max_combo()) pyttanko_json = { 'version': bmap.version, 'title': bmap.title, 'artist': bmap.artist, 'creator': bmap.creator, 'combo': combo, 'max_combo': bmap.max_combo(), 'misses': misses, 'mode': bmap.mode, 'stars': bmap.stars, 'aim_stars': bmap.aim_stars, 'speed_stars': bmap.speed_stars, 'pp': bmap.pp, # list 'aim_pp': bmap.aim_pp, 'speed_pp': bmap.speed_pp, 'acc_pp': bmap.acc_pp, 'acc': bmap.acc, # list 'cs': cs, 'od': od, 'ar': ar, 'hp': hp } if completion: try: pyttanko_json['map_completion'] = (completion / len(bmap.hitobjects)) * 100 except: pyttanko_json['map_completion'] = "Error" os.remove(file_path) return pyttanko_json
def calculatePlay(bmap, mode: int = 0, count0: int = 0, count50: int = 0, count100: int = 0, count300: int = 0, countgeki: int = 0, countkatu: int = 0, combo: int = 0, mods: int = 0, perfect: int = 0, calcPP: int = 1): if mode == 0: #Standard modString = pyt.mods_str(mods) accuracy = acc.stdCalc(count0, count50, count100, count300) p = pyt.parser() beatmap = p.map(bmap) objcount = beatmap.ncircles + beatmap.nsliders + beatmap.nspinners totalhits = count50 + count100 + count0 sr = pyt.diff_calc().calc(beatmap, mods) pp = 0 if calcPP == 1: pp, _, _, _, _ = pyt.ppv2(sr.aim, sr.speed, bmap=beatmap, mods=mods, n300=count300, n100=count100, n50=count50, nmiss=count0, combo=combo) pp_fc = 0 if perfect == 0: pp_fc, _, _, _, _ = pyt.ppv2(sr.aim, sr.speed, bmap=beatmap, mods=mods, n300=objcount - totalhits, n100=count100, n50=count50, nmiss=0, combo=beatmap.max_combo()) accuracy_fc = acc.stdCalc(0, count50, count100, objcount - totalhits) beatmapDict = { "title": beatmap.title, "artist": beatmap.artist, "creator": beatmap.creator, "version": beatmap.version, "objcount": objcount, "mode": beatmap.mode, "maxcombo": beatmap.max_combo() } playDict = { "totalhits": totalhits + count0, "pp": round(pp, 2), "pp_fc": round(pp_fc, 2), "accuracy": accuracy, "accuracy_fc": 0 if perfect == 1 else accuracy_fc, "modString": modString if modString != "nomod" else "NM", "rating": round(sr.total, 2), "completion": round(((totalhits + count300) * 100) / objcount, 2), "mode_icon": "https://i.imgur.com/lT2nqls.png", "mode_name": "Standard" } elif mode == 1: #Taiko p = pyt.parser() beatmap = p.map(bmap) beatmapDict = { "title": beatmap.title, "artist": beatmap.artist, "creator": beatmap.creator, "version": beatmap.version, "objcount": 0, "mode": beatmap.mode, "maxcombo": None } playDict = { "totalhits": 0, "pp": "Not implemented.", "pp_fc": 0, "accuracy": acc.taikoCalc(count0, count100, count300), "accuracy_fc": 0 if perfect == 1 else acc.taikoCalc(0, count100, count300 + count0), "modString": modString if modString != "nomod" else "NM", "rating": "N/A", "completion": 100, "mode_icon": "https://i.imgur.com/G6bzM0X.png", "mode_name": "Taiko" } elif mode == 2: #CTB accuracy = acc.ctbCalc(count0, countkatu, count50, count100, count300) beatmap = Beatmap(bmap) p = pyt.parser() beatmapMetadata = p.map(bmap) difficulty = Difficulty(beatmap, mods) pp = 0 if calcPP == 1: pp = round(calculate_pp(difficulty, accuracy, combo, count0), 2) beatmapDict = { "title": beatmapMetadata.title, "artist": beatmapMetadata.artist, "creator": beatmapMetadata.creator, "version": beatmapMetadata.version, "objcount": len(beatmap.hitobjects), "mode": beatmapMetadata.mode, "maxcombo": beatmap.max_combo } playDict = { "totalhits": 0, "pp": pp, "pp_fc": 0, "accuracy": accuracy, "accuracy_fc": 0, "modString": modString if modString != "nomod" else "NM", "rating": round(difficulty.star_rating, 2), "completion": 100, "mode_icon": "https://i.imgur.com/EsanYkH.png", "mode_name": "Catch the Beat" } elif mode == 3: #Mania p = pyt.parser() beatmap = p.map(bmap) beatmapDict = { "title": beatmap.title, "artist": beatmap.artist, "creator": beatmap.creator, "version": beatmap.version, "objcount": 0, "mode": beatmap.mode, "maxcombo": None } playDict = { "totalhits": 0, "pp": "Not implemented.", "pp_fc": 0, "accuracy": acc.maniaCalc(count0, count50, count100, countkatu, count300, countgeki), "accuracy_fc": 0, "modString": modString if modString != "nomod" else "NM", "rating": "N/A", "completion": 100, "mode_icon": "https://i.imgur.com/0uZM1PZ.png", "mode_name": "Mania" } return beatmapDict, playDict
async def submitted_play_star_calc(self, bmap, mods): return pyttanko.diff_calc().calc(bmap, mods)
def generateData(): #get random beatmap dir folder = path.dirname(__file__) data_folder = path.join(folder, "Training Songs") beatmap_folder = path.join(data_folder, random.choice(os.listdir(data_folder))) beatmap_list = [] for f in os.listdir(beatmap_folder): if f[-4:] == ".osu": beatmap_list.append(f) beatmap_path = path.join(beatmap_folder, random.choice(beatmap_list)) #open the beatmap beatmap = OsuReader.readBeatmap(beatmap_path) p = pyttanko.parser() bmap = p.map(open(beatmap_path, 'rt', encoding="utf8")) #find the audio audio_path = path.join(beatmap_folder, beatmap.AudioFilename) #open the audio wav_path = path.join(beatmap_folder, "audio.wav.wav") if not path.exists(wav_path): subprocess.call([ 'ffmpeg', '-i', audio_path, "-ar", str(sampling_rate), "-ac", "1", path.join(beatmap_folder, "audio.wav.wav") ]) audio = read(wav_path)[1] # audio = np.divide(audio, np.full((len(audio)), 32767, np.float64), dtype=np.float64) #find the star rating difficulty = pyttanko.diff_calc().calc(bmap) stars = np.array(difficulty.total).reshape([1, 1]) print(beatmap.Title, beatmap.Version) #make list of all timings and delays between timings in beatmap delay_list = [] timing_list = [] current_time = 0 for o in beatmap.HitObjects: if o.csstype == "circle": delay_list.append(o.time - current_time) current_time = o.time timing_list.append(current_time) elif o.csstype == "slider": delay_list.append(o.time - current_time) current_time = o.time timing_list.append(current_time) for t in range(o.repeat): delay_list.append(o.endTime) current_time += o.endTime timing_list.append(current_time) elif o.csstype == "spinner": delay_list.append(o.time - current_time) current_time = o.time timing_list.append(current_time) delay_list.append(o.endTime - current_time) current_time = o.endTime timing_list.append(current_time) #make x and y song_length = len(audio) / sampling_rate * 1000 audio = np.concatenate( (audio, np.zeros(audio_batch_size, dtype=np.float64)), axis=0) audio = np.concatenate( (np.zeros(audio_batch_size, dtype=np.float64), audio), axis=0) current_time = 0 current_timing = 0 array_x = [] array_y = [] array_label = [] while current_time < song_length: audio_index = int(current_time / 1000 * sampling_rate) if current_timing < len(timing_list): distance = timing_list[current_timing] - current_time if distance < place_range: array_label.append(np.array([1])) array_y.append(np.array(distance)) array_x.append(audio[audio_index:audio_index + audio_batch_size]) current_time = timing_list[current_timing] current_timing += 1 else: array_label.append(np.array([0])) array_y.append(np.array(1000)) array_x.append(audio[audio_index:audio_index + audio_batch_size]) current_time += 1000 else: array_label.append(np.array([0])) array_y.append(np.array(1000)) array_x.append(audio[audio_index:audio_index + audio_batch_size]) current_time += 1000 while not len(array_x) % truncated_backprop_length == 0: array_label.append(np.array([0])) array_y.append(np.array(1000)) array_x.append(np.zeros(audio_batch_size, dtype=np.float64)) x = np.vstack(array_x) y = np.vstack(array_y) labels = np.vstack(array_label) return (x, y, stars, labels)