Last active
July 4, 2025 16:34
-
-
Save NAEL2XD/22d84953c6e643a16e44f11131e7691e to your computer and use it in GitHub Desktop.
FNF Utils: FNF Chart to TJA Converter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Converts FNF's Psych Engine JSON to TJA (Taiko no Tatsujin's Chart) | |
| Doesn't require any pip modules, you can launch it like normal! | |
| """ | |
| import json | |
| from tkinter import filedialog | |
| file = json.load(open(filedialog.askopenfilename(filetypes=[("Psych Engine Chart Compatible JSON", "*.json")]), "r")) | |
| notes = [] | |
| for i in range(len(file['song']['notes'])): | |
| mustHit = file['song']['notes'][i]['mustHitSection'] | |
| for j in range(len(file['song']['notes'][i]['sectionNotes'])): | |
| add = [] | |
| for k in range(2): | |
| v = float(file['song']['notes'][i]['sectionNotes'][j][k]) | |
| if k == 1: | |
| noteData = int(v)+1 | |
| if mustHit: noteData += 4 | |
| if noteData > 8: noteData -= 8 | |
| v = noteData | |
| add.append(str(v)) | |
| notes.append(add) | |
| bpmMult = int(input("BPM Mult: "))*file["song"]["bpm"] | |
| output = open("export.tja", "w") | |
| output.write(f"""// Generated using Nael's FNF to TGA chart | |
| TITLE:{file["song"]["song"]} | |
| SUBTITLE:Generated using Nael's FNF to TGA chart | |
| BPM:{bpmMult} | |
| WAVE:Inst.ogg | |
| OFFSET:0 | |
| DEMOSTART:0 | |
| COURSE:Hard | |
| LEVEL:1 | |
| SCOREINIT: | |
| SCOREDIFF: | |
| #START | |
| """) | |
| notes.sort(key=lambda x: float(x[0])) | |
| out = [] | |
| for note in notes: | |
| # More accurate position calculation | |
| pos = round(float(note[0]) * (bpmMult / 15000)) | |
| line = int(pos / 16) | |
| while line >= len(out): out.append(list("0000000000000000,")) | |
| out[line][pos%16] = str((int(note[1])%4)+1) | |
| for l in out: | |
| output.write(f"{''.join(l)}\n") | |
| output.write("#END") | |
| output.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment