So I know the community has made a lot of songs that go here, but I couldn't find NF and the only one on it was so hard. I was like maybe more people would play it if they could just put in any song and it would generate the songs. Also there was missing on Easy and some were only expert and by my opinion, not expert at all. I believe VR has capability as it is escaping reality, but we can only do that if there is a lot or appeals to more categories.
Overview
The objective is to have a model that takes the input of a audio file and output a full map.
Step 1 - Downloading Data
We need to first grab all the data from the api
import requestsimport jsonbefore ="2024-01-28T00%3A00%3A01%2B00%3A00"continuing =Truewhile continuing: url ="https://api.beatsaver.com/maps/latest?automapper=false&before="+ before +"&pageSize=100" headers ={'Accept':'application/json','Accept-Charset':'utf-8'} response = requests.get(url, headers) obj = response.content obj1 = json.loads(obj) maps = obj1['docs']for i inrange(0, len(maps)): curMap = maps[i] map_id = curMap['id'] metadata = curMap['metadata']# Derminating stats = curMap['stats']# Determine based on that uploadTime = curMap['uploaded']# Used for next Setting it versions = curMap['versions']# Data needed to keepif stats['upvotes']>10and metadata['duration']>80:print(map_id, stats['upvotes'], stats['downvotes'], metadata['duration'])# Extract relevant fields map_data ={"id": curMap["id"],"metadata": curMap["metadata"],"stats": curMap["stats"],"uploaded": curMap["uploaded"],"versions": curMap["versions"]}# Write the extracted data to a JSON file output_file_name = map_id +".json"withopen(output_file_name, 'w')as json_file: json.dump(map_data, json_file, indent=4)print("Data written to", output_file_name)# con += 1 continuing =len(maps)>2 before = uploadTimeprint("Finished on " , before)
So once this downloads all the json files it came up to around 50k json files. I then had to narrow it down and download what is necessary inforamtion. I choose parameters that left it to be around 10k for my dataset.
import jsonimport osimport requestsdefdownloadZip(url,id): output ="./downloads/"+str(id)+".zip" r = requests.get(url)withopen(output, 'wb')as f: f.write(r.content)defcompare_ignore_case(str1,str2):return str1.casefold()== str2.casefold()defloads(filename):withopen(filename)as file: data = json.load(file)# Print the data upvotes = data['stats']['upvotes'] downvotes = data['stats']['downvotes'] duration = data['metadata']['duration'] per = (upvotes / (downvotes + upvotes)) *100 evenbpm =int(data['metadata']['bpm'])== data['metadata']['bpm'] difficulties = [False,False,False,False,False] difficult = [False,False,False,False,True] sets = data['versions'][0]['diffs']for s in sets:ifcompare_ignore_case(s['difficulty'], 'easy'): difficulties[0]=Trueifcompare_ignore_case(s['difficulty'], 'normal'): difficulties[1]=Trueifcompare_ignore_case(s['difficulty'], 'hard'): difficulties[2]=Trueifcompare_ignore_case(s['difficulty'], 'expert'): difficulties[3]=Trueifcompare_ignore_case(s['difficulty'], 'expertplus'): difficulties[4]=True onlyExpertPlus = difficulties == difficultif upvotes >100and per >80and evenbpm andnot onlyExpertPlus and duration <250: dURL = data['versions'][0]['downloadURL']downloadZip(dURL, data['id'])return"True"return"False"path ="."file_list = os.listdir(path)f =open('out.txt', 'w')con =0for l in file_list:try: ans =loads(l)if ans =="True": con +=1except:print("Ran into issue on file"+ l)print('Downloaded '+str(con) +' Songs')
Step 2 - Cleaning Data
I then created a short script to remove files that weren't going to be useful.
import os# Function to delete image and video filesdefdelete_media_files(folder):for root, dirs, files in os.walk(folder):for file in files: file_path = os.path.join(root, file)# Check if the file is an image or video fileif file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp','.tiff', '.svg', '.webp', '.ico','.mp4', '.avi', '.mkv', '.mov', '.wmv', '.flv')):try: os.remove(file_path)print(f"Deleted: {file_path}")exceptExceptionas e:print(f"Error deleting {file_path}: {e}")# Specify the directory to start traversing fromfolder_to_search =input("Enter the directory path to start traversing from: ")# Check if the specified directory existsif os.path.exists(folder_to_search):# Confirm with the user before proceeding confirmation = input(f"Are you sure you want to delete all image and video files in {folder_to_search}? (yes/no): ")
if confirmation.lower()=="yes":delete_media_files(folder_to_search)print("Operation completed.")else:print("Operation aborted by user.")else:print("Directory not found.")
Notable Links
Created by nick sypteras in October 2017 was an OSU generator which is close to beatsaber in a way. It has clicking in a 2d field based on music so that could really help along the process.
Another OSU mapper that is on github written by kotritrona using tensorflow and deep learning hasn't been updated for 2 years so I assume it is the final product on version 7.0
Another one is the actual project after dance dance revolution game called Dance Dance Convolution. The idea has been proven to work and it has the same principle as 2 entities only issue is deciding in a 9 grid instead of 4 expanding the amount of combinations and patterns exponentially.
Useful website for verification of this wiki webpage that is highly liked in the community.