cabbiethefirst

Untitled

Sep 4th, 2025
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1.  
  2. // Paste your raw curly-brace notedata as a string here:
  3. const rawData = `
  4. {16,5.304,0,"Tap",4},
  5. {16.5,5.462,1,"Tap",8},
  6. {17,5.619,0,"Tap",4},
  7. //rest of raw data goes here
  8. `;
  9.  
  10. // --- Converter ---
  11. const converted_notes = rawData
  12. .trim()
  13. .split(/},?\s*\n?/) // split into rows
  14. .filter(line => line.trim()) // remove blanks
  15. .map(line => {
  16. let cleaned = line
  17. .replace(/[{}]/g, "") // remove curly braces
  18. .replace(/length=/, ""); // strip "length=" before the number
  19. const parts = cleaned.split(",").map(p => p.trim());
  20.  
  21. const beat = parseFloat(parts[0]);
  22. const second = parseFloat(parts[1]);
  23. const col = parseInt(parts[2]);
  24. const type = parts[3].replace(/"/g, "");
  25. const sound = parts[4] ? parseInt(parts[4]) : undefined;
  26. const holdLength = parts[5] ? parseFloat(parts[5]) : undefined;
  27.  
  28. const note = { beat, second, col, type };
  29. if (!isNaN(sound)) note.sound = sound;
  30. if ((type === "Hold" || type === "Roll") && holdLength) {
  31. note.hold = holdLength;
  32. }
  33. return note;
  34. });
  35.  
  36. // --- Apply to chart ---
  37. chart.setNotedata(converted_notes);
  38.  
  39. console.log("Loaded notes:", converted_notes.length);
Advertisement
Add Comment
Please, Sign In to add comment