Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Paste your raw curly-brace notedata as a string here:
- const rawData = `
- {16,5.304,0,"Tap",4},
- {16.5,5.462,1,"Tap",8},
- {17,5.619,0,"Tap",4},
- //rest of raw data goes here
- `;
- // --- Converter ---
- const converted_notes = rawData
- .trim()
- .split(/},?\s*\n?/) // split into rows
- .filter(line => line.trim()) // remove blanks
- .map(line => {
- let cleaned = line
- .replace(/[{}]/g, "") // remove curly braces
- .replace(/length=/, ""); // strip "length=" before the number
- const parts = cleaned.split(",").map(p => p.trim());
- const beat = parseFloat(parts[0]);
- const second = parseFloat(parts[1]);
- const col = parseInt(parts[2]);
- const type = parts[3].replace(/"/g, "");
- const sound = parts[4] ? parseInt(parts[4]) : undefined;
- const holdLength = parts[5] ? parseFloat(parts[5]) : undefined;
- const note = { beat, second, col, type };
- if (!isNaN(sound)) note.sound = sound;
- if ((type === "Hold" || type === "Roll") && holdLength) {
- note.hold = holdLength;
- }
- return note;
- });
- // --- Apply to chart ---
- chart.setNotedata(converted_notes);
- console.log("Loaded notes:", converted_notes.length);
Advertisement
Add Comment
Please, Sign In to add comment