DEV Community

VEILVM
VEILVM

Posted on

A browser karaoke or pitch-scoring app still ships its grading model

Karaoke and language-learning apps like a score that appears the moment the singer stops: cents off pitch, timing windows, vibrato bonuses, and a letter grade that looks official enough to share. When the reference melody, the tolerance curves, the "perfect" windows, and the combo multipliers all run in the browser, you have published the judging rubric — and a way to mint a perfect score without singing.

A rival can clone the feel of your grading in a weekend. A player can hook the scorer, replay a studio take as if it were live, or post a 100 that your leaderboard later treats as real. Neither is acceptable if that number unlocks rewards, ranks, or a paid "certified" badge.

What actually ships

A typical client-side pitch-scoring script includes:

  • Reference tracks — MIDI-like pitch curves, lyric timings, and difficulty variants you have not announced yet.
  • Tolerance and windows — how many cents and milliseconds still count as perfect, good, or missed.
  • Bonuses and penalties — streaks, vibrato detection, leftover-noise cuts, and difficulty multipliers.
  • Grade bands — the exact cutoffs that turn a raw score into S/A/B or a shareable badge.
  • Anti-cheat flags — the checks you already run in the page, which now tell a cheater what to avoid.

The microphone can be real. The function that decided "perfect" is often already in the bundle.

How it gets lifted

People search the bundle for strings like cents, perfectWindow, gradeFor, or a function named scoreTake.

export const RUBRIC = {
  perfectCents: 20,
  goodCents: 50,
  windowMs: 80,
  streakBonus: 1.08,
  grades: { S: 95, A: 85, B: 70, C: 50 },
};

export function scoreTake(frames, reference) {
  let raw = 0, streak = 0;
  for (const f of frames) {
    const err = Math.abs(f.cents - reference.at(f.t));
    if (err <= RUBRIC.perfectCents && f.deltaMs <= RUBRIC.windowMs) {
      streak += 1;
      raw += 1 * RUBRIC.streakBonus ** Math.min(streak, 8);
    } else if (err <= RUBRIC.goodCents) {
      streak = 0;
      raw += 0.6;
    } else {
      streak = 0;
    }
  }
  const pct = 100 * raw / frames.length;
  return { pct, grade: gradeFor(pct, RUBRIC.grades) };
}
Enter fullscreen mode Exit fullscreen mode

Once RUBRIC is public, a perfect window is just a number to satisfy. If the leaderboard or a reward grant trusts pct from the client, you have turned a singing game into a form submission.

What actually protects you

Move official scores off the client

  • Authoritative grading belongs on the server, against the current rubric, a recorded take you actually received, and a logged attempt.
  • Unreleased songs and difficulty curves should not be fully described in a public bundle.
  • Certified or paid badges must be awarded server-side, not unlocked by posting a local score.

Protect a local rehearsal hint if you still want one

A live pitch meter can still run locally so the singer gets immediate feedback. For that chunk:

  • Ship only a practice hint, not the official grade bands or reward multipliers.
  • Bundle the rehearsal UI separately from leaderboard and reward grant code.
  • Apply stronger-than-mangling protection (control-flow flattening or VM-based compilation) to any rubric you still ship.
  • Leave source maps off the public CDN.
  • Re-score, or at least confirm, the take on the server before you publish a rank or unlock a reward.

Do not treat the page as a judge

If a badge is granted because the page said grade: "S", anyone can write that result into the request. A public score that matters needs a server that heard the take.

Practical checklist

  • [ ] Leaderboard, reward, and certified-badge scores are computed or confirmed on the server.
  • [ ] Official grade bands, multipliers, and unreleased reference curves are not fully described in the public bundle.
  • [ ] Any local hint is limited to rehearsal feedback, split from reward UI, and protected with stronger-than-Terser obfuscation.
  • [ ] Source maps for the scorer are not on the public CDN.
  • [ ] Hooking the scorer cannot change a published rank or a reward grant.
  • [ ] Attempts that matter for ranking are logged and stored server-side.
  • [ ] The UI does not treat a localStorage grade as a completed official score.

Honest limits

Skilled singers can still practice against the audible reference and learn the song. Obfuscation does not hide a melody the user can hear; it raises the cost of reading the rubric and forging a score. If a grade cannot be public, do not put the official judge in JavaScript you send to every browser.

Summary

A browser karaoke scorer ships the work that makes it powerful: the windows, the multipliers, and the grade bands. Use a rehearsal meter if you must, protect that chunk, and let the server be the only path that publishes a score.

Disclosure: I work on VEILVM, a JavaScript VM-protection service. Free browser tier (3 runs/day, up to 5 KB) and a Pro plan at $9/month or $79/year with API access. Try the playground at vm.ldvmp.com.

Top comments (0)