Working-tree content. Subject to change and not yet released. Commit: e3d4530507.
Feature — Onboarding
A one-time intro shown to new users: one screen — a film of the app being played, the product in one line, and Start. Completion is persisted in MMKV so returning users skip it.
The old six-step carousel (and later four-slide pager) is gone, with its slide art (hero-feel, hero-learn, hero-skills, hero-create and their tablet crops, ~4.7 MB; removed 25/11/2026). None of it was preloaded at launch, but the generated asset manifests require every file in their folder, so it all shipped in the app.
What runs on which script. Script 4 is the default (the A/B test's winner; schema default and fallback baseline). Start goes straight on to the tutorial on script 4, script 3 and every public build. Only scripts 1–2 of a selling build arm the post-onboarding paywall first (shouldArmOnboardingPaywall), kept for those scripts.
Files
Route: app/(onboarding)/index.tsx re-exports OnboardingScreen.
Visual stack
Film
The single onboarding screen opens on a film (OnboardingIntroFilm, played through the app's shared VideoPlayback, an expo-video VideoView; the ad backfill uses the same component). The video paywall (script 3) plays the same film through the same component; it only shows on the popular catalogue, so there it is always ShowOff. The pick is onboardingFilm (is_public says which film a build may show).
The film plays at once (DEV 25/11/2026; it used to wait for Remote Config, and the band stayed dark meanwhile). useOnboardingScreenFilm opens on DEFAULT_ONBOARDING_FILM, the public-domain film (0.9 MB, against ShowOff's 1.2 MB, so its first frame comes sooner; and every build may show it). When the config lands (hydrated, or the variant locked):
- it wants the same film: nothing changes, the film loops on;
- it wants the other film and no frame has shown yet: the swap is immediate;
- it wants the other film and the film is playing: the film stops looping, plays to its end (
playToEnd) and the next loop is the config's film. No cut mid-shot, and the band never fades out between the two.
The state lives in the onboarding store (film, syncDesiredFilm / markFilmStarted / filmLoopEnded), the rules in withDesiredFilm / afterFilmLoop / filmLoops. On the popular catalogue the first loop is therefore the public-domain film, then ShowOff. The video paywall (useOnboardingVideoSource) opens long after the config and plays the config's film directly.
Start waits for the locked variant. Once the screen is seen (the splash has gone), decideOnboardingVariant locks the install's A/B-tested values (onboarding_script, tutorial_song, mon_pkg; experiment-decision.ts): the console's answer if this launch's fetch lands within 3 s (EXPERIMENT_DECISION_WAIT_MS) or an earlier launch fetched it, else the in-app baseline (script 4, the console's three songs, no ads arm). Until then Start shows a loading state and takes no tap; the film does not wait. Start waits for nothing else, and never past one ceiling: ONBOARDING_START_GATE_CAP_MS (3 s, kept equal to EXPERIMENT_DECISION_WAIT_MS) after the screen is seen, started by decideOnboardingVariant (onboarding-start-gate.pure.ts, selectStartReady in the store). Past it Start takes a tap even if the variant is not locked yet; Remote Config keeps its own timeout.
No GPU prewarm on the onboarding screen (DEV 19/11/2026: it held Start and made the film hang). The tutorial song warms the GPU under its own loading card, as every song does: the first-hit rehearsal fires each kind of effect once before the 3-2-1 (piano.md, "Loading gate"). To try a fallback install in a development build, set EXPO_PUBLIC_AB_FORCE_FALLBACK=1 in .env.local: the screen ignores the fetch, waits the full 3 s and locks the baseline. With EXPO_PUBLIC_ONBOARDING_REPLAY=1 beside it every Metro reload is a new try, since the replay also clears the lock. Release builds ignore both. The lock sets the ab_source user property (remote | fallback) and, for remote only, sends ab_config_applied — the activation event of every experiment on these keys, so the Firebase A/B report leaves fallback installs out. The wait is reported as onboarding_perf.config_wait_ms. The tutorial's songs and covers are fetched once the variant is locked (prepareTutorialAfterConfig), so they are this variant's. Start also lets the piano sampler load (AppStartupPolicy): starting its audio engine during the film would duck the film's music.
The films ship in the app only: there is no build switch and no Remote Config key for them. ShowOff was kept after the owner tried it against a RushE film as two TestFlight builds; the RushE film and the onboarding_video key (which could replace a film with a URL) are gone. A console that still serves onboarding_video is ignored like any unknown key.
Encoding. The shipped files are 1080², 30 fps, HEVC tagged hvc1 (the tag AVPlayer plays), 2.2 MB for the two (ShowOff 1.24 MB, public-domain 0.95 MB). The films were shot in a dark room, so the encode carries a 1.25× gain on each colour channel (RGB, so blacks stay black and the foot still dissolves into the page without a seam); nothing is filtered at runtime. The masters (1080², 60 fps) are gitignored under src/assets/onboarding/Onboarding_video/; ShowOff's is the cut delivered on 22/10/2026 (HEVC, ~2.8 Mbps), the public-domain one H.264 at ~18 Mbps. Encode from them, never from a shipped file (a second HEVC pass costs quality):
ShowOff re-encode (DEV 25/11/2026). ShowOff was 2.05 MB (video ~1.5 Mbps). It is now -preset veryslow -crf 28 (video ~0.86 Mbps, 1.24 MB, −40%), chosen over CRF 26 / 27 after a side-by-side on device frames: SSIM 0.992 / PSNR 45.9 dB against the previous file, no visible loss at 100% on the busiest frames (PERFECT text, particles, the glow line). The master was not at hand, so this pass was encoded from the shipped file (a second HEVC generation); re-encode from onb_showoff.mp4 with the same settings when the master is available:
After adding, removing or renaming a film, run bun run assets:sync (the asset manifest is generated and gitignored).
The film fills about two thirds of a phone, ~1,800 px tall on a 3x screen. The earlier 720², ~0.5 Mbps encode was stretched 2.5× and its text and badges smeared; H.264 at the new quality would weigh about twice as much. onboarding-film-assets.test.ts holds each file to hvc1 at 1080². Android support for HEVC varies by device: encode H.264 (-c:v libx264 -tune film -crf 23) if these files ship there.
Title segments
A title is TitleLines = readonly (readonly TitleSegment[])[]: lines of segments, each solid white or carrying the brand scoreNumber gradient (gradient: true). OnboardingTitle draws each line as one <TextOutlineRun> (one Skia canvas per line); the tutorial's Welcome screen uses it. See <TextOutlineRun> in src/components/TextOutline.tsx.
State
MMKV key: onboarding. Only hasCompleted is persisted; everything else is in-memory and a cold relaunch starts fresh.
Flow
During FTUE, the tutorial gameplay song, the friendly arm's whole offer, the reward picker's Claim and the pick-song Get choice are permanently unlocked as "promo" library entitlements (no rewarded ad). See songs.md.
The onboarding_script variants shape the tutorial's run after the welcome (popular catalogue; a public build always plays Twinkle, then the picker).
From the welcome or the drills to the song (goToTutorialSong): script 4's welcome and scripts 1–3's training drills (finished or skipped) go straight to the choose screen on a choosing run, or to the song (tutorialSongRoute). A "Now you're ready to play your first masterpiece!" beat stood there for 1.5 s until the PO removed it (23/10/2026). The hand-off still sends its fn_tutorial_set, and waits for the run's MIDI as the beat's time let it, at most TUTORIAL_SONG_HANDOFF_MAX_WAIT_MS (1.5 s) — no wait once it has arrived, which on script 4 is long before the welcome is left.
The onboarding A/B test runs on onboarding_script and tutorial_song. The Firebase experiment sets both per group: the script (3 = the old training drills, 4 = the training merged into the first song) and the group's own tutorial_song (its three_songs; keep one_song, which builds on script 1 still read). Typical groups: baseline 3 with today's songs; var1–var3 4 with their songs. Script 4 is script 3 in everything else (the choose screen, the video paywall, the first-song paywall at the 4th song_end, onboardingScriptHasVideoPaywall).
- Default: an install the console names no script for walks
4, and plays the app's copy of the console'stutorial_song(No Batidão, APT, Twinkle — excerpts the app ships). Both equal what the console serves since the onboarding test ended (DEV 16/11/2026), so an install that cannot fetch walks the same run as everyone else; change them together with the console. A value the app does not know (5,0) is dropped and the last one stands; the persisted config is the last-known-good, so a failed fetch keeps the console's last script. - Locked for good:
onboarding_script,tutorial_songandmon_pkgare locked once per install (experiment-lock.pure.ts, kept in MMKV and laid over every Remote Config update by the store), so a fetch that lands later — Firebase placing the player in a group after they met the baseline — changes nothing they play. The monetization slice reads the lockedmon_pkgtoo (readEffectiveMonetizationValue; the DevTool's rules still win). Only a consoleab_lock_versionabove the round an install locked in lets it lock again: bump it when a test starts or ends, never while one runs. Where and when the lock is taken is the onboarding screen's decision. - Fixed per run: the run reads the script once (
getTutorialScript), so the welcome's training decision and the songs agree even if a fetch lands in between. - Reported: as the
onboarding_scriptuser property at launch. - Old builds: a build from before script 4 drops the value and walks its own default (script 1). Target the experiment at the new app version.
- Forced by the build:
EXPO_PUBLIC_RC_FORCE_ONBOARDING_SCRIPTmakes any build walk one script whatever the console says. No CI job sets it (ci-cd.md): TestFlight follows the experiment as the store build does, so a group's script and itstutorial_songalways arrive together. To keep a tester on one group, give their build number its own Remote Config condition above the experiment. In a development build,EXPO_PUBLIC_RC_ONBOARDING_SCRIPTin.env.localwins over both (dev-overrides.ts).
Trying the tutorial's songs without the console (development builds only; the store build ignores these, so players are never touched). In .env.local:
EXPO_PUBLIC_RC_TUTORIAL_SONG replaces tutorial_song and is read entry by entry, as the console's value is. APT. and Dance Monkey are rewarded-video songs whose excerpts the app ships (no download), so picking one shows the unlock. With "balance" the picked song is free in the Song list afterwards, the reward picker follows the song, and the song not claimed stays locked; with "friendly" all three are free after Get. Restart Metro after editing .env.local.
Every script reports its "get a song" step as fn_tutorial_get_song (song_id, song_name), so the scripts' funnels line up: script 1 on the picker's Get, scripts 2, 3 and 4 on the choose screen's Get, before the song starts (tutorialChoiceGetSongParams names the song by its catalog id, as the song's own events do).
The choose screen (TutorialChooseSongScreen, rules in choose-song-store.ts). Its cards rise in one by one on the reward picker's keyframes (below), 72 pt apart (100 on tablet). No consent (UMP) or tracking (ATT) prompt opens here, nor on the welcome or the drills. The consent (UMP) and tracking (ATT) prompts are asked right after the splash (DEV, 26/11/2026 — PostSplashPrivacyPrompts, askPrivacyPromptsAfterSplash in tutorial-privacy-prompts.ts) for a player still in the funnel, over the onboarding video, which goes on loading under them (nothing pauses it); a player past the tutorial is asked on the splash itself (requestAttAtBoot). The ad SDK starts as they are answered (requestGuardedAttThenPreloadAds, DEV 02/12/2026), as at boot: it was held to the run's end while the prompts were asked there, and its start and first ad loads then ran under the reward picker's Claim. Ad loads still wait out the tutorial song (holdTutorialAdPark). The prompts no longer ride with the video paywall, and no exit waits on them: an exit used to wait on their answer, and the reward picker's Claim froze when it never came. The video paywall is unchanged: scripts 3–4 of a selling build, not Premium, once the reward picker's cards are in (onEntranceDone) or as the tutorial result's reveal settles on the other runs (useTutorialRunEnd). Script 1 and public builds keep the pick-song screen's own prompt (TutorialTrackingPrompt), which finds them answered. The choose screen is the reward picker's stage without the claim (DEV, 26/11/2026 — TutorialPickerStage, the shared card TutorialRewardCard in mode="pick", clocks in usePickerClocks): the title drops in, the cards rise in one by one (sounds ftue_title_in, ftue_card_pop). Get enters the claim clock where the reward picker's Claim has opened its lock (PICK_FROM_MS, 430 ms): the button leaves, the other songs and the title fade, the picked card moves to the middle and grows under the halo's rim, pulse and light rays — no lock, no glow, flash, ring or particles — while the picked song previews under it, rings leaving its cover on the notes; at the launch cue (2.7 s after Get, ftue_scene_transition) it zooms into the light wipe, and at the wipe's peak (3.14 s after Get) the preview stops and the song screen fades in on its loading card (pickCue → revealDone). Before the pick each cover previews its song with its badge, and the cover whose song is sounding turns like a record (once every 6 s) and kicks on each note (DEV, 27/11/2026 — option 5 of the cover-effects preview, in place of the waves, which played again as the halo's rings after the pick; useCoverRecord). Past the pick the badge fades out and the cover takes no tap (previewEnabled={!locked && pickable}), and no card is marked as previewing (TutorialPickerPreviews picked). Step by step in Choose → play, step by step. Until DEV 25/11/2026 the pick reveal handed over at its settle (~950 ms) and the song screen carried the reveal on, settled: the song's load then landed on the route's fade with the choose screen still up, which held the fade back and froze the rays before a jump. On the song screens that do play a reveal (a run without a choose screen, the run's later songs: entrance="drop"), at the hand-over (the hold over, the rays at rest) the song's lane and keyboard mount under the still reveal, and the reveal leaves only once the song is ready, straight onto its Get ready! card (tutorialRevealLeaves, tutorial-reveal-handoff.ts); a song still not ready 2.5 s after the hand-over (TUTORIAL_REVEAL_READY_WAIT_MS, a UI-thread clock) gets the loading card. Two things keep the cover from flickering out and back there: the song screen renders at once from its already-loaded module (lazyRoute + memoLoader.peek, no lazy() first-render fallback), and SongRevealCover draws from the memory/disk image cache (it used cachePolicy="none", reloading the cover in every new view) with no fade in the reveal (artFadeMs={0}):
- How many songs. Always the first 3 entries of
three_songs(fewer only when the console names fewer), so order the list by priority (tutorialOfferSize). Script 1 is unchanged (one song). - How many are free. Fixed by the install's monetization arm — friendly (and no arm) 3, balance / aggressive / very_aggressive 2 (
mon-arms/); before the arm is known the friendly 3 stands. The console cannot change it: atutorial.free_songsinmon_pkgis ignored and noted (mon-pkg-mapper.ts), and the tutorial holds any count to 2–3 besides — the PO changes only which songs (tutorial_song). It becomes the run's reward plan (tutorialRewardPlan), fixed with the run's songs:grant_all(free ≥ songs offered — friendly): Get unlocks every offered song for good in the Song list (promo grant, even when a row is VIP or a rewarded video). (The line that said so under the cards, "All 3 songs stay unlocked in your song list." The song ends on the Game Mode result as before.pick_after_play(2 ≤ free < songs offered — the other arms): Get unlocks only the song picked (its line under the cards, "The song you pick stays unlocked in your song list."). After its excerpt the Game Mode result shows only the score (SessionResultOverlaysummaryOnly: stars, score and judgements, centred; no suggestion column, previews or buttons), holdsTUTORIAL_SCORE_HOLD_MS(3 s: the stars' 1.5 s pop-in, then the 1.5 s hand-off beat) after the count-up, and the route's fade replaces it with the reward picker (tutorialResultLeadsToReward).single: a run with no choice (script 1, public builds) or only one distinct song — that song.
- Screen copy (DEV, 25/11/2026). The title alone: the line under it ("A short version…"), the line under the cards and the cards' difficulty tags are gone. The reward picker drops its line under the title too ("Choose 1 song…") but keeps its cards' tags.
- Cards. Title, artist and a Get button. The run's difficulty (the console's
difficulty/diff_tag, PO 09/11/2026) is not drawn on these cards (hideDifficulty); the pick reveal and the song's intro still name it. The cards (two or three) always sit in one centred row capped at their Figma width; where the width is short (a small iPad with three cards) they narrow evenly instead of scrolling (TutorialPickSongRow).
No paywall reads Remote Config enableIAP: that flag only switches the single-song deals (the No Ads package no longer follows it either — see remote-config-enable-iap.md). Every script's paywalls — the one after the film, script 3's video paywall and its held-back first-song paywall — show whatever it says (paywalls-ignore-enable-iap.test.ts).
The reward picker (TutorialRewardScreen, /(tutorial)/reward, rules in reward-song-store.ts) ends the song on pick_after_play runs: "Great job! Pick your reward — Pick 1 song to unlock". It shows the offered songs the player did not play, locked, each with Claim.
-
The claim flow (DEV's prototype "Reward Unlock -> Gameplay", 26/11/2026, applied keyframe for keyframe — times, easings, distances, colours and sounds:
reward-unlock-timeline.tsover the prototype'skf()/bez()port in@core/motion/keyframes; flow inreward-claim-flow.pure.ts). It runs by itself from the Claim — no Play, no "Unlock later…":choosing → claiming → launching → done. Intro (from the screen's arrival): "Great job! Pick your reward" drops 10 pt as it fades in, "Pick 1 song to unlock" a beat later from 8 pt; each locked card rises 14 pt, fading in and growing from 0.85 with an overshoot (its Claim from 0.9), 100 ms after the card before it; each lock nudges once (1.06) while the player chooses; soundsftue_title_inand aftue_card_popper card; the cards being in (0.6 s for two) opens the video paywall where one shows (cardsIncue →onEntranceDone). Claim (its own clock, 0 = the tap): Claim presses in (0.94) and back; the other Claim dims to 35 %; the lock shakes (±8° → ±6°), pops (1.18) and comes apart — the shackle lifts 7 pt and tilts −20° about its bottom right, the lock rises 14 pt and shrinks as it fades — as the veil lifts, a soft blue glow comes up behind the cover, a white flash and a light-blue ring spread and 16 particles (gold stars, cyan sparkles, lilac dots) fly out; the cover bounces (1.06); the other card fades, shrinking to 0.9 about its middle and sinking 8 pt; the copy floats up as it fades; the claimed card moves to the screen's middle and stays its own size (no grow — the prototype's ×1.25 showed the 256 px thumbnail's pixels; the halo's rays and rim are laid out at the size the prototype showed them,HALO_SIZE_KEEP), and the halo comes: light rays turning 13°/s, spreading from 0.3 and breathing, a bright rim and one pulse out. Soundsftue_claim_tap,ftue_lock_shake,ftue_unlock_burst,ftue_cards_fade,ftue_card_to_center,ftue_halo, thenftue_scene_transitionat the launch cue (3.15 s). Preview (1.45 s, the prototype's 2.80 s;previewStartcue): the claimed song's preview plays under the halo (claimCue→playPreview, the song's MIDI through the sampler as every preview), and each melody note it plays sends a ring off the cover (TutorialPreviewRings: cover-sized, growing 1.7× over 850 ms, a long note's — 3 sixteenths or more — 1.95× over 1.1 s; the line thinning 1.8 → 0.9 pt; five colours in turn,rewardPreviewRing*; the beats now carrymelodyandbeatsfromSongPreviewService.subscribeBeats); the rings follow the notes as heard, so a preview that starts a beat late stays in time. Zoom (the launch cue, phaselaunching): the rings fade, the card's name and difficulty fade, the card zooms from 1× by 3.2 more and lifts 40 pt as it fades, its halo and rim with it (claimedTravelAt,claimedFadeAt), into the light wipe (TutorialTransitionWipeover the sharedLightWipe: a white-to-blue radial light at 50 % × 45 %,rewardWipe*, peaking at 0.85). Sharpness (DEV, 27/11/2026): the picked card sits at 1× in the middle and scales up only in the zoom — its 256 px thumbnail already shows 228 px on a 76 pt cover @3x, and the prototype's ×1.25 there read blurred all through the halo (DEV 02/12/2026); its cover art (SongRevealCover fullResArt) and the halo's rays and rim (ImageCache allowDownscaling={false}) keep their files' own resolution instead of being decoded at their views' size; the name under the cover is still text scaled by the card's transform. Hand-over at the wipe's peak (3.57 s,handOvercue,HAND_OVER_MS):finishLaunchbrings gameplay's loading card up at once under the same light at its peak, which clears over it in 480 ms (HAND_OVER_FADE_MS;showPlayLaunchCoverUnderWipe→LightWipeClearinPlayLaunchCover), and the claim commits once it is clear — one light clearing rather than the picker and the card crossfading (DEV, 27/11/2026, option 2 of the hand-over preview); the cover silences the preview. The prototype cut straight to the song; the app loads it on the loading card (DEV, 26/11/2026). Drawing: the halo's canvases are drawn once, when the picker mounts, and only their views move (turn, breath, spread, fades) — no Skia work or blur on any frame of the pick (the halo dropped frames as it came, DEV 26/11/2026). The unlock burst (flash, ring, 16 particles, the halo's pulse) is one Skia canvas (30/11/2026: it was ~20 — a canvas, and a GPU surface for the compositor, per piece — and the Claim dropped 11–25 frames where the choose screen's pick, without them, dropped none): each frame of the claim clock records one picture (unlock-burst-frame.ts) — the ring's glow and the flash as images baked once on idle after mount (unlock-burst-art.ts,useUnlockBurstImages), so no blur runs on a frame; the ring line (its width animated directly, 3 → 0.8 pt) and the particles drawn live, sharp at any scale; the canvas drawn at the grown card's size and shrunk back by its view. A picture is recorded only while something shows (01/12/2026,unlockBurstClockAt: the burst's span, then the pulse's; −1 otherwise, which a shared value set to what it holds does not pass on), so before the pick, between the burst and the pulse and after it the canvas is not redrawn; its paints are made once (a frame only sets alphas); and while nothing shows it draws the two baked images 1 pt wide at alpha 1/255, so their GPU upload is done before the flash. Each lock's canvas reads the shackle's own clock (shackleClockAt), held outside the shackle's move, so it redraws only for that ~0.1 s. The halo's rays and rim are the prototype's, exported as PNGs @1x/@2x/@3x at the size the centred card shows them (ftue_halo_rays, 550 pt;ftue_halo_rim, 133 pt — so a phone's @3x lands 1:1; DEV 26/11/2026: drawn in Skia they read soft at 1×, 2× and 3×); The other bitmaps are drawn atFX_SHARPNESStimes the largest size each shows, released when the picker unmounts. A card turns about its cover by translate-and-scale from its measured height, never a transform origin (the halo sat off the cover). The lock is the prototype's 36 × 40 SVG in Skia (TutorialRewardLock); the light is two picker-wide layers (Skia canvases drawn once, and the two PNGs) kept on the claimed cover as it moves — under the cards the glow, the rays and the preview's rings (TutorialRewardHalo), over them the flash, ring, particles and pulse on one canvas, and the rim (TutorialUnlockBurst); colours arereward*theme tokens. Nothing mounts or renders on the claim: every part is mounted with the screen (the light layers' canvases drawn once at mount, hidden until the claim) and moves off two UI-thread clocks —introSvfrom the arrival,claimClockSvfrom the Claim — sampled withsample(); the clocks' cues hop to the store on the JS thread (introCue/claimCue, which play the sounds — loaded lazily during the tutorial song,warmFtueRewardSfx— and take the flow's steps;usePickerClocks, shared with the choose screen). The store takes the tap at once (claimreturnstrue) and its phase and claimed card land on the next idle slot (≤ 150 ms,reward-claim-commit.ts; the launch cue lands it first if it ever comes sooner); a second tap meanwhile is turned away; the Labs clone's Reset drops a claim still waiting (reward-claim-no-render.contract.test.ts). The prototype's tap marker (its "show touch point" toggle) is a demo aid and is not drawn. -
The commit unlocks that song for good (promo grant), ends the tutorial and opens the song's full chart directly (
pendingPlay{ kind: "play", full: true }→/(app)/play?full=1,songPlayType: "tutorial_next"). It runs only once the light has cleared over the loading card (the grant and the tutorial's end together), so a kill mid-animation reopens the saved picker with nothing taken. The Song list is not mounted under it; pause → Songs and the result's Songs replace onto it (leaveToSongList), so they land there as any song does. -
The song not claimed keeps its catalog lock: a rewarded-video song opens with one rewarded video, a VIP song needs VIP.
-
End jobs (
useTutorialRunEnd, shared with the result):song_result(sent by the score-only result before it),reachedResultfor a relaunch, then, once the cards have appeared, script 3/4's video paywall, then the consent / tracking prompts once it has gone (closing it leaves the player on the picker), or on the other scripts the prompts alone. The claim's commit waits for the tracking answer. -
Drawing (
TutorialRewardView, cardsTutorialRewardCard→TutorialRewardCover+TutorialRewardCta): display and animation only — the screen hands itrewardSongView(), the flow'sphaseand the store's actions. The Labs clone draws the same view. -
Testing without a reinstall: Component Labs → Claim reward → Open claim screen pushes a clone (
/lab-claim-reward,ClaimRewardLabScreen, storeclaim-reward-lab-store.ts) over the app, after the tutorial. Its cards come fromtutorial_song.three_songsthe catalog knows, then catalog rows, to three songs, less the song "played" (Played #1–3 chips). The whole claim flow plays, but nothing is granted, no song opens and the tutorial store is untouched (the status chip shows the step; sounds play). Tunereward-unlock-timeline.tshere. Reset remounts the view (previews, entrance and claim state replay); Close pops it and reopens Labs.
The choosing runs' result (TutorialSongResultScreen) is the Game Mode result (SessionResultOverlay, Play tab lit). It shows the excerpt's score, frozen at game over (tutorial-song-result.ts).
- Kept from Congrats:
song_result, script 3/4's video paywall and the tracking prompt (after the paywall where it shows). The last two happen on the run's first result only, after the reveal. - Not run here: interstitials, and the first-song and replay paywalls.
- No Replay: the action row has Song list and Next song only (
SessionResultOverlaywithoutonReplay); each tutorial song is played once. - Leaving: Song list and Next complete the tutorial. A suggestion rides out with the completion (
pendingPlay). An exit into gameplay (the exit picker's Get, the reward picker's Claim, a gameplay suggestion) never lands on the Song list:complete()fixesexitHref(tutorialExitHrefintutorial-exit.ts) withhasCompletedin one update, and the root layout passes it to the tutorial group'sStack.Protected redirectTo, so the guarded tutorial screen replaces itself with/(app)/playand the app's stack opens as[play]alone. Before, the app landed on the Song list and gameplay was pushed over it once it was up; taps during that hop reached the Song list under the cover (paywall, another song). With nothing under gameplay, its exits go throughleaveToSongList(pop when the Song list is underneath, else replace onto it), and Android's back does the same (useHardwareBackToSongListinapp/(app)/_layout.tsx). The other exits — a locked suggestion (its rewarded video first, as on the Game Mode result) or a Learn one — still land on the Song list, whereTutorialExitHostopens them (tutorialExitNeedsHost). A gameplay pick raises the rootPlayLaunchCoverfirst, so nothing (and the Game Mode result'sreplaceinto a next song / replay) shows before gameplay; the cover also takes the touches, so nothing it hides can be pressed. The cover wears the loading card's face (PrepareLoadingFace: the prepare art and the piano-keys loader), and it lifts only once BOTH the play route has arrived (useScreenEntered→markPlayLaunchEntered) and its loading card has painted (PrepareLoadingOverlay, two frames after mount →markPlayLaunchCardPainted), so the hand-off from cover to card is invisible. A 4 s backstop, counted from the navigation, lifts it if gameplay never arrives. A play visit opened under the cover carriescover=1(playParamsUnderCover/playHrefUnderCover) and opens without the stack's fade (playOpensUnderCoverinapp/(app)/_layout.tsx): on a first play, with the Song List mounting at the same time, the cover could lift on the route's 700 ms arrival backstop while the fade was still running, and the Song List flashed through the half-faded play screen (iPad A16). - Choosing the next song: the result's song cards carry no CTA. A tap selects one (the top card by default), and Next opens it — with the video glyph when it is ad-locked (songs.md).
- No Learn tab: Learn Mode opens after four finished songs, so a first-run player sees no toggle here — only the Play recommendations under "Recommended for You" (songs.md).
- Waits for tracking: every exit waits for the tracking answer.
- Relaunch: reaching the result ends the run for a relaunch. A player who quits the app on the result or under script 3's video paywall comes back to the song list, not the training. The result sets the tutorial store's persisted
reachedResult; the screen on view stays up, and the next cold start restores the tutorial as complete (restoreTutorialPersistedState). Except a reward picker still owed a claim (pick_after_play): the run's end also saves the picker's cards (pendingReward,reward-song-store.tsreachEnd), so a player who quits on the score-only result or on the picker comes back to that same picker (TutorialEntryScreenopens it in place of the Welcome), not the song list. The saved cards win over a relaunch's fresh offer; Claim clears them with the tutorial's completion. Before the result, a relaunch starts the tutorial again (Welcome, and the drills on scripts 1–3), but a choosing run whose song was already picked does not offer the choice again: the pick is saved as it is made (savedPick,choose-song-store.ts), and the hand-off (goToTutorialSong) replays that song (resumePick, found by catalog file in the rebuilt offer, else its old place), so a second pick cannot unlock a second song. Cleared with the tutorial's completion.
On script 1 and public builds, a song's result is the Congrats celebration. The last song's celebration ends the run for a relaunch, as the choosing runs' result does: quitting there, or on the picker after it, comes back to the song list. It stays until the celebration has fully come in, then 1.5 s more (tutorialResultHoldMs). The choose screen has no close: the player picks one of its songs.
Song previews on both pickers. On "Pick Your First Song" and "New song available!" each cover is a preview button: a tap plays fifteen seconds of the song (the badge turns into the moving wave), and the songs also play one after another on their own, each fading in over half a second (TUTORIAL_PREVIEW_FADE_IN_MS). Every picker comes in top to bottom (reward-claim-motion.ts): the title block drops in as it fades in (TutorialTextEntrance, inside TutorialPickerHeader), then the cards scale in left to right, then the line under them (the choose screen). The preview badges pop in (fade, scale up) only once the cards are all in (useTutorialPickerPreviewStore.cardsIn, set by TutorialPickSongRow), and the first preview starts a second after that pop (PREVIEW_START_AFTER_CARDS_MS) — not with the entrance, whose frames it cost. It is the result screens' queue (useSongPreviewQueue) without their 3 s wait and 2 s fade, which hold the music back for the score; here the songs are the screen. On the choose screen the queue repeats: after its last song it goes back to its first, in the same order, until the player taps Play (repeat: true; the picker and every other screen play their songs once). The choose screen's sounding cover is a record (DEV, 27/11/2026): its art turns inside its ring once every COVER_TURN_MS (6 s) and coasts on to upright when the song stops; every note the preview plays (subscribeBeats) kicks the whole cover (up to 1.07, settling in 450 ms; useCoverRecord, timings in reward-claim-motion.ts). Transforms only — no canvas, nothing to compile on the first note; still under Reduce Motion; the exit picker's and the reward picker's covers keep still. The waves (TutorialPreviewRipple) are gone: they played again as the halo's rings after the pick. A choose-screen song is previewed by its catalog name (its game chart's busiest 15 s, never a recording), never by its tutorial chart (tutorial-song-preview.pure.ts). Play, Get and close stop the previews before leaving; the picker's tracking prompt counts as a screen cover, so nothing plays under it. No analytics event is sent. Rules: tutorial-song-choice.pure.ts, tutorial-song-result.ts, first-song.pure.ts.
Each tutorial_song entry can also set the difficulty tag its song shows on the song's intro (and its pick reveal; the choose screen's cards no longer draw it) (a chip as wide as its word, the intro's title block just under the cover and over the rays, PO 09/11/2026) and on its tutorial result (the end picker's cards show no tag, PO 23/10/2026): "difficulty" takes the sheet's number (1–6) or the song list's label ("easy", "hard", any case) and replaces the catalog row's; "diff_tag": false hides the tag. Both are optional; an unreadable value is ignored, never the song. The tag is drawn bare, like the song list's. Analytics keep the catalog difficulty.
Which catalog song an entry is. The card (title, artist, cover, the preview it plays), the song it unlocks and its analytics come from the catalog row the entry names (catalogSongForEntry), in the live catalog: the bundled songs.json overridden by the newest song_catalog (Remote Config / CDN) this device has fetched — the list the Song list shows (tutorial-catalog-source.ts). A song added to the sheet and published in song_catalog after a build can therefore be a tutorial song, cover and all, without a new build. On a first install the catalog refresh runs after the first paint: a song only in song_catalog is found if the refresh lands before the run's songs are fixed (on the choose screen, or the first song on script 1); otherwise that slot plays the stand-in. Every tutorial screen shows the fields copied when the run was fixed, so the choose screen, the song and its result always name the same song. A slot that plays the stand-in leaves a crash-report breadcrumb with why (empty_slot, no_catalog_row, midi_missing).
"song_id"(optional, read from 1.0.8): the row'sidin the catalog, thesong_idsong events send (dance-monkey,no-batidao,fur-elise,apt,twinkle-twinkle-little-star). It is matched exactly and wins overname. An id no row has plays the stand-in rather than whatevernamewould find, so a typo shows on the device."name"(required): withoutsong_id, the row whose file name, id or title it matches, ignoring case, accents, spaces and punctuation. Keep it besidesong_id: builds beforesong_idmatch bynamealone, and drop an entry without one.
Excerpts the app ships play with no download. An entry's midi is fetched while onboarding runs, unless its file name is one the app carries under src/assets/tutorial/: then the song plays that bundled chart, and nothing is downloaded or waited for (bundledTutorialExcerpt, prepareTutorialRun). The match is the file the URL ends in, exactly (case included), wherever it is hosted: …/Q4_Folder/tutorial_1stUA_package/APT_RoseBrunoMars_tutorial.mid plays the bundled APT_RoseBrunoMars_tutorial. The app ships the excerpts of the Instant songs:
The CDN keeps a copy of each, for builds that predate it and as the source of truth. A file whose notes change takes a new file name: the old name keeps playing the copy the app shipped with. Adding an excerpt to the app is committing its .mid under its CDN file name; charts:convert-tutorial turns it into a chart at build time.
Training drills
Scripts 1–3 only. On those scripts the welcome's "Let's go!" opens the drills below (TutorialWelcomeScreen); script 4 goes on to the song (the choose screen first), and its first song teaches the tap and the hold instead (Guided first song). fn_training_set / fn_training_ready still come from the welcome; fn_training_start / fn_training_end are no longer sent.
tutorial_start (step: step_tap | step_hold) reports each lesson once the player has done it: on the drills (scripts 1–3) when the tap drill and the hold drill are passed; on the guided first song (script 4) when its first tap note is played and its first hold's head is played (it need not be held to its tail, PO 23/10/2026).
The drills' Skia sheets bake on the practice mount. Nothing is baked ahead (the TutorialPracticePrewarm / KeyboardAtlasPrewarm / JudgementAtlasPrewarm launch warmups were dropped: they held the splash and loaded the app before the FTUE), so the practice's keyboard sheets and lane master atlas are cut in its own mount, under the loading card. tutorialPracticeBeamFloorPx (tutorial-practice-beam.ts) is the one beam floor TutorialGameplayCanvas holds, so the master-atlas key does not swing between steps. The surface mounts in two commits: TutorialGameplayStack mounts the lane canvas, and the keyboard two frames later (useStagedMount — frames, not an idle slot: the idle queue ran both stages back to back and the stall stayed one piece). The longest single stall is ~440 ms (the canvas, its layers and Skia views) and the keyboard's is ~140 ms; the UI thread's worst frame there is ~55 ms, under the loading card.
The practice screen's two drills (tap, then hold) move on only after a Perfect press
(PERFECT+ or PERFECT). A press is judged exactly as Game Mode judges one: classifyHit on the
live Timing-panel windows, the ones TimingZoneConfigOverlay draws
(judgeTutorialPracticePress).
A GOOD or EARLY press (the great / tooEarly judgements):
- pops its label, GOOD or EARLY, in PERFECT's look (white letters, the yellow outline and
glow;
tutorialJudgementLook), while the note closes in on its centre and fades out (TUTORIAL_RETRY_NOTE_FADE_MS). The key's light goes out with it, even with the finger still on the key: held, it stood in the lane as a golden column and read as the note stuck there; - once the label has played out (
TUTORIAL_RETRY_LABEL_MS, the label's own life), says "Tap Again!" — "Hold Again!" on the hold drill (tutorialRetryMessage) — forTUTORIAL_COACH_COPY_DWELL_MS, raised a tenth of the screen above the drill's other copy; - then drops the note again from the top.
A hold let go too soon. The hold drill also wants the key kept down until the long note's
tail reaches the line. Letting go more than TUTORIAL_HOLD_RELEASE_MARGIN_MS (0.3 s, the last
fifth of the 1.5 s hold — Game Mode allows only its ~25 ms Perfect-late window) before the tail
breaks the hold (tutorial-practice-hold-release.ts):
the ramp stops so the note freezes where the finger left it, EARLY pops (the tap drill's
own word, fire("tooEarly", 0): one label for a press too soon and a lift too soon), the note
closes in on the part still standing above the line and fades, then "Hold Again!" and a fresh
fall — the same retryLabel → retry → drill path a GOOD press takes (beginRetry). Game
Mode's own early release stays neutral; only the training says anything.
The label sits where Game Mode's does, top-centre of the canvas; only the drills draw it in
PERFECT's look, the tutorial song keeps Game Mode's colours. This is the
retryLabel → retry pair of phases in
tutorial-practice-flow.ts. A note resting
on the line takes any press on its key as PERFECT+. The drill's notes fall at Game Mode's lane speed (DEFAULT_LANE_PX_PER_SECOND), so its zones sit as far from the line as a song's. Other keys, and presses while the note is still
above the Too-early window, are ignored.
Tutorial song
The tutorial song is a Game Mode session (useTutorialSongSession over useMagicGameplay) that
waits on each note, drawn by Game Mode's own gameplay group (PlayScreenGameplayGroup, under
GameplayThemeTierProvider): the score (hidden through the 3-2-1, shown at GO), the x2–x5 badge,
the points over each lane, and the glow, smoke, stars and keyboard colours that climb with the
streak. Only the training drills keep the fixed tier-1 look. It draws Game Mode's song progress
rail (PlayScreenSongProgressRail) across the top. The rail stays hidden through the 3-2-1, shows at GO, and fills with the chart's tick up
to totalEndTicks, so it waits with the song
(TutorialSongGameplayPhase).
Before the song starts, TutorialGameplayScreen plays the song reveal: the cover rises with a
pulsing ring over the starry sky, then the title and artist fade in (no difficulty tag on a tutorial song). It is the shared
SongRevealShowcase (with
SongRevealCover, SongRevealMeta, song-reveal.model.ts and
StarryScaffold) in src/components/, because Learn
Mode plays it too — after the "Learn Mode unlocked!" popup's Claim opens Twinkle
(songs.md). The tutorial's result
celebration draws the same SongRevealCover.
A chosen tutorial song starts sooner than other songs
(tutorial-song-start.ts): its reveal
holds 0.7 s once settled instead of 2 s (holdMs, the 0.95 s motion unchanged). The song
mounts under the reveal once it settles — reported by the reveal on the UI thread
(onSettled), so the mount never lands on the entrance — and loads through that hold; its lane
atlas and its keyboard's sheets are baked by the surface's own mount (no
prewarm: the old ones held the splash and loaded the app before the FTUE). Its 3-2-1 is Game Mode's 2 s pre-roll, armed when the reveal hands
over (piano.md). Learn Mode's reveal keeps the 2 s hold.
Choose → play, step by step
What happens between Get on "Pick Your First Song" and the song's first note (scripts 2–4; DEV, 25/11/2026). The rule: everything that loads, loads on the song screen's loading card — never with the choose screen still up. The choose screen only animates.
- Get (choose screen). The store's
pickruns at once:fn_tutorial_get_song, the promo grant (every offered song ongrant_all, else the pick), the run set to the song, the pick saved for a relaunch, phaserevealing. The previews stop; the claim clock starts atPICK_FROM_MS(430 ms) and the picked cover is measured (measureInWindow) for the light layers and the move to the middle. - The pick on the choose screen (
TutorialPickerStage, every part mounted with the screen): the Get button leaves, the other cards and the title fade, the picked card moves to the middle at its own size; the halo comes — the rays (ftue_halo_rays) turning, spreading and breathing, the rim (ftue_halo_rim) and one pulse. No difficulty tag on the run's first song. Nothing loads meanwhile. - 1.02 s after Get — the preview: the picked song's preview plays under the halo, rings leaving its cover on the melody notes (
TutorialPreviewRings). - 2.72 s after Get — the launch cue (
ftue_scene_transition): the rings and the card's name fade, the card zooms from 1× into the light wipe (TutorialTransitionWipe) as it fades with its light. - 3.14 s after Get — the hand-over, the wipe at its peak:
pickCue→revealDone→ phaseleaving, the preview stops →router.replace("/(tutorial)/play?revealed=1"). The song screen opens with the same light at its peak over its loading card (LightWipeClear, over everything), clearing in 480 ms as the picker's own wipe clears under the route's fade. - Route fade under the clearing light (the tutorial stack's own
fade, react-native-screens' iOS default 500 ms). The song screen's first frame is light on purpose: only the song's loading card (TutorialLoadingCover: the card's own face, the prepare art and the piano-keys loader) — no reveal, no song yet. The choose screen is unmounted once the fade is over. - Song mount once the route has arrived (
transitionEnd,useScreenEntered, backstop ≤ 1 s): the chart, runner and sampler load, and the lane and keyboard mount at once (surfaceArmed), all under the song's own loading card — identical to the cover, which goes in the same commit. - Song ready (
prepareReady): the loading card cross-fades to Get ready! → 3-2-1 (2 s) → the song.
The reward picker does the same with the full song (/(app)/play), at its own hand-over: gameplay's loading card comes up at once under the wipe's peak, the light clears over it in 480 ms, and the song loads there. The app is entered only once that light is clear (showPlayLaunchCoverUnderWipe runs the commit when the cover's wipeClearing drops, markPlayLaunchWipeCleared; 500 ms past the light's length at the latest, PLAY_LAUNCH_WIPE_GRACE_MS): the commit takes the tutorial group down and mounts the app and the play screen, whose chart, sampler and WebGPU engine then load, and run as the light started it would share its frames (DEV, 02/12/2026; the WebGPU build alone was held before, 01/12/2026 — useSpriteEngineLease, shouldMountPlayGameplay's launchLightClear still do). The load starts about half a second later for it. Its freeze now lands on the still loading card, as the tutorial song's does. The engine is not kept from the tutorial song (keeping it crashed before).
To measure a hop on a device, build with EXPO_PUBLIC_HITCH_TRACE=1: the song screen marks route_entered, song_mount, gameplay_ready and prepare_ready (Component Labs → Hitch traces).
Guided first song
On script 4, the run's first song, the first time it is played (step.index === 0 && !tutorialRunUsesClassicTraining() in TutorialGameplayScreen), teaches what the training drills did, on two of its own notes (tutorial-song-guide.pure.ts, wired in useTutorialSongSession). Every later song plays as Game Mode.
- The first tap note. The song's first note that is not a hold, as the engine reads a hold (its tempo included: a short long note on a fast song is a tap). Either guided note may come first: No Batidão opens on three holds and taps after them, Fur Elise taps first and holds last. Twinkle has holds only, so only its first hold is guided.
- While it is the note to play, a press on its key (inside the note tolerance) that is not Perfect is ignored. It pops the label it earned, as Game Mode would (GOOD or EARLY — EARLY also for a press before the Early window while the note is on screen; before it shows, the key just sounds), and it sounds, but it scores nothing (no points over the lane) and the note goes on falling.
- The song waits for the note on the line, as Game Mode waits on every note (auto-pause). The moment it does, the training's spotlight (
TutorialPracticeSpotlightOverlay) comes in, dimming everything but the key's column, with "Tap the key when the note reaches the line" (TutorialSongGuideCopy, 50 pt above halfway down to the hit line). It comes in over 588 ms (TUTORIAL_SONG_GUIDE_SPOTLIGHT_ENTER_MS, 1.7× the drills' 1 s pace), and from the same frame the hand of the training drills (TutorialHandGuide) shows the tap gesture on its key. Playing the key clears all three. Every guided wait below brings them in the same way. All three are mounted once byTutorialSongGuideLayerand shown on the UI thread fromguideWaitKindSv(opacity + translate), so a wait starting or ending commits nothing to React. The layer is aforwardRefhost isolated from the gameplay tree (a sibling ofPlayScreenGameplayGroup, outsideGameplayThemeTierProvider): it takes stable props (waits,guideWaitKindSv, one memoizedguideGeometry), builds its Skia layers on an idle JS slot after the surface may mount (useIdleMount, off the lane's first-mount commit), and the session flips its prewarm through the ref handle (guideRef.current?.setPrewarm) — no prop flip.TutorialGameplayScreenre-renders for its own state (the song mounting under the reveal, the hand-over, the reveal's fade), soSongRevealShowcaseandTutorialSongSurfacearememo, and the hand-over reaches the song ascountdownArmedSv(a SharedValue viauseBooleanSharedValue), not a prop: onlysurfaceArmed(the reveal gone) re-renders the song shell. What remains in the Profiler during the reveal and the guide's waits are Reanimated'ssettledStylerenders (FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS, left on by design — see piano.md). Under the Get ready! card their Skia layers draw atTUTORIAL_SONG_GUIDE_PREWARM_OPACITYto warm the GPU pipelines. - A press there scores Perfect however long the wait. Game Mode turns such a press Late after 0.5 s and Miss after 1.2 s (fixed, not BPM-scaled); the guide lifts both limits through
useMagicJudgement'sgetAutoPausePerfectGraceMs(returningundefinedonce nothing is guided, so Game Mode's default grace applies). - A Perfect press while the note is still falling plays on.
- The first hold.
- Its press is guarded as the first tap note's is (PO, 24/10/2026): a press on its key before the line that is not Perfect pops the label it earned and sounds, but scores nothing, and the hold goes on falling to the line. A key held down through such a press does not start the hold on arrival; the player presses again.
- Waiting on the line for its press, it gets the spotlight with the training's hold line, "Hold the key when the long note reaches the line", and the hand (the long press), and its press scores Perfect however long the wait.
- From the press on it plays as Game Mode (PO, 23/10/2026: a hold scores like a tap, and its haptic already tells it from one). Let go early, it keeps its head's points without the completion bonus and the song goes on; held to its tail, it gets the bonus.
Skipping the FTUE (Remote Config onboarding_skip)
Remote Config key onboarding_skip (boolean, default true) controls the FTUE
skip affordances. Read it through
selectOnboardingSkipEnabled —
Firebase-only, with no __DEV__ override, so a dev build shows the same funnel
players get.
With the key set to false, none of the skip affordances render and the flow is
exactly the full funnel. The practice pill is additionally gated on
handler.isPlaying — the pre-roll done, the loading card faded out and the drill on
screen — so it never lands on top of the prepare loading card (the sampler can be ready
while the card is still held its minimum time or fading). Its 0.5 pt rim is the song list
Play pill's rim as it reads on that pill — light blue at half strength
(tutorialSkipBorder) — so it stays as quiet on the pill's near-black fill.
TutorialTrainingOverlay renders the pill only when a caller passes both
showSkip and onSkip, which is why the tutorial song screen (which passes
neither) has no skip.
The screen never navigates. The final CTA calls useOnboardingStore.finishWithPaywall(), which arms shouldShowPostOnboardingPaywall. Root-mounted PaywallHost opens the subscription modal in portrait; dismissing it calls complete(), which flips hasCompleted to true and the root app/_layout.tsx mounts (tutorial). See routing.md.
Post-onboarding paywall handoff
Scripts 1–2 of a selling build only. Script 4 (the default), script 3 and public builds never reach it (shouldArmOnboardingPaywall); it is kept for the scripts that still name it.
finishWithPaywall() flips shouldShowPostOnboardingPaywall on. <PaywallHost>
watches that flag, opens the global PaywallModal
with POST_ONBOARDING_PAYWALL_VARIANT in portrait, and immediately calls
dismissPostOnboardingPaywall() so a future re-mount can't re-arm the modal.
When the user dismisses or purchases, the host calls complete() (if onboarding
is not yet marked done), which swaps the root layout from (onboarding) to
(tutorial).
Purchase and restore go through the IAP service (getIapService().purchase / restore in PaywallHost).
Debugging
Profile screen exposes a "Reset onboarding flow" button that closes the paywall, resets onboarding and tutorial state, then signs out — re-running the full onboarding → paywall → tutorial sequence.