Opus Motion ★ Star on GitHub

Music · token-sampler-prompt

Token sampler prompt (LLM typing)

A thin prompt field in a dark void types a phrase token by token on the beat (or on sung-word starts): just before each token a tiny next-token distribution flickers above the caret and the sampled candidate lights orange, the camera re-frames between caret, text and field with a hair of kick per token, and ⏎ fires a flash-zoom on the closing downbeat.

A free, MIT-licensed music visualizer from the Opus Motion Library — 616 motions for Remotion, React and plain HTML.

Token sampler prompt (LLM typing): three frames of the music visualizer, start, middle and end
Token sampler prompt (LLM typing) — start, middle and end of the 7.0-second motion.

What Token sampler prompt (LLM typing) is for

AI-product videos, “how an LLM picks the next word” explainers, prompt demos; feed `lyrics` to type exactly on the vocal.

  • llm
  • token
  • sampling
  • prompt
  • ai
  • typing
  • next token
  • probability
  • caret
  • terminal
  • beat
  • music
  • explainer
  • treatise

Details

Category
Music visualisers & audio graphics
Length
7.0 s (210 frames at 30 fps)
Formats
16:9, 1:1, 9:16
Weight
light
Transparent overlay
yes
Seamless loop
no
Text props
text
Colour props
background ink dim accent
Mood
nature, night
Roles
subject

Use Token sampler prompt (LLM typing) in Remotion, React or HTML

Remotion project

terminal
# copy this motion into your Remotion project
node cli/mgl.mjs add token-sampler-prompt --to ../my-app/src

# render an mp4 (run in the library folder)
node cli/mgl.mjs render token-sampler-prompt --props '{"text":"turn the city lights up one more time","background":"#0A0A0B","ink":"#EEE9DF","dim":"#5E5B57","accent":"#FF4D12"}'

# or export for apps / editors: mp4 | webm-alpha | prores-alpha | gif | png | poster
node cli/mgl.mjs export token-sampler-prompt --as webm-alpha --props '{"text":"turn the city lights up one more time","background":"#0A0A0B","ink":"#EEE9DF","dim":"#5E5B57","accent":"#FF4D12"}'

React / Next.js

tsx
import {MotionPlayer} from 'opus-motion-library/web';

<MotionPlayer
  motion="token-sampler-prompt"
  props={{
    text: 'turn the city lights up one more time',
    background: '#0A0A0B',
    ink: '#EEE9DF',
    dim: '#5E5B57',
    accent: '#FF4D12',
  }}
  playOnView
  loop="auto"
/>

Plain HTML / WordPress

html
<script src="opus-motion.element.js" defer></script>

<opus-motion motion="token-sampler-prompt"
  props='{"text":"turn the city lights up one more time","background":"#0A0A0B","ink":"#EEE9DF","dim":"#5E5B57","accent":"#FF4D12"}'>
</opus-motion>

Compose spec (multi-scene video)

json
{
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "scenes": [
    {
      "motion": "token-sampler-prompt",
      "props": {
        "text": "turn the city lights up one more time",
        "background": "#0A0A0B",
        "ink": "#EEE9DF",
        "dim": "#5E5B57",
        "accent": "#FF4D12"
      }
    }
  ]
}

Token sampler prompt (LLM typing) props

17 parameters — change any of them to make the motion yours.

PropDefaultWhat it does
text"turn the city lights up one more time"the phrase to type (split on spaces, timed to the beat) when `tokens`/`lyrics` are empty
tokens[]explicit stream [{text, at?: seconds, dist?: [[candidate, p]], pick?}] — give real distributions (and jokes) here
lyrics[]timed lyrics: [{text, start, end, words?: [{text, start, end, syl?:[[a,b]]}]}] in seconds; words without times are estimated
bpm120tempo used when `beats` has no beat list
offsetSec0.4time of the first beat in seconds (aligns the grid to your song)
beats{}beat data: {bpm, offsetSec, beatsPerBar} or a list of beat times (s), or a full analysis {beats, downbeats, sections, onsets:{kick,snare,hat:[[t,strength]]}}
tokensPerBeat1typing speed when timing from the grid
background"#0A0A0B"frame colour or 'transparent'
ink"#EEE9DF"typed-text colour
dim"#5E5B57"field / idle-candidate colour
accent"#FF4D12"sampled token + caret colour
backdrop"rings"'void' (plain) or 'rings' (tunnel rings pulling in behind)
cameratruebeat-cut camera reframes between caret, text and field
enterKeytrueshow ⏎ and fire the flash-zoom exit on the downbeat after the last token
seed3placeholder-distribution and shot variety
promptLabel"PROMPT"small caps label above the prompt field
nextTokenLabel"NEXT TOKEN"heading of the candidate-token panel (" · id N" follows)

Notes & credits

Technique sources:

  • pdoom-video app/src/scenes/prompt.ts + prompt-data.ts (MIT): candidate flicker ~0.16 s ahead, camera zoom 1.25–2.7 with ±0.03 rad roll