Skip to content
charleeagniPublic

About

@TypeSafeAI 's Jev controls the 2 hands and each finger to play the piano in real-time. Jev only "sees" what we see and plays this from the "note waterfall". It uses @browser_use 's jev-ultrafast and some decision scheduling to make this happen in real-time. Sound on πŸ”ˆπŸ”‰πŸ”Š

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Jev Piano

Two Jev brains, one per hand, play River Flows in You on a web piano in real time.

A hand has a fixed span and five fingers that never cross. A note sounds only if a finger is already resting on that exact key when its moment arrives. Every 100 ms slice of the piece is a question to TypeSafe's Jev: where does this hand sit, and which key does each of its fingers rest on. Jev answers with option ids from the list the page offered, never a key name or a coordinate. The answer takes about 400 ms, so each slice is asked about 500 ms before it arrives and several slices stay in flight at once. A decision applies at the moment it was asked about, not when it lands.

page clock ──► sliceFor(hand, t+500ms) ──► one TypeSafe request ──► option ids ──► commitSlice(t)
                  (handSlice.js)              (sliceBrain.py)                       (handSchedule.js)
                                                                                          β”‚
                                        applyDue(now) ── the clock reaches t β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        a finger is on the key, so the note sounds (handStage.js)

Run it

Chrome must be installed. Browser Harness launches it (or attaches to a running one) and owns the CDP connection.

uv sync

# Replay a recorded take: same choices, same delays, no API key, no requests.
uv run python slice_jev.py --replay recordings/slices-take3.json --real-hand

# Live. Needs TYPESAFE_API_KEY in .env (see .env.example).
./slices.sh --real-hand

A live run writes slices-<timestamp>.json: every ask, every answer, when it landed, and the decision stream the page showed. That file is what --replay plays back. --max-seconds 20 checks a run without playing the whole piece. --viewport window leaves the Chrome window alone.

Record a video

The page records its own audio; the video is an external screen recording, lined up afterwards with two clapperboard marks (a white flash and a click at the same instant).

uv run python slice_jev.py --replay recordings/slices-take3.json --real-hand --audio   # press Enter once your recorder is rolling
uv run python alignTake.py "Screen Recording.mov" slices-<timestamp>.wav take.mp4

alignTake.py finds the flashes in the video and the clicks in the audio, shifts the audio to match, trims to just after the marks, crops to the page, and muxes an MP4. Needs ffmpeg.

Layout

Where What
index.html, styles.css, app.js The instrument: keyboard, falling notes, clock, sound, strike receipts. window.__piano.
handModel.js Rules: spans, five fingers per hand, no crossing, which finger owns a note. No DOM.
handSchedule.js Decisions apply at the moment they were asked about; projections of the future keyboard.
handSlice.js Builds one hand's slice question (hand head + finger heads) and commits the answer.
handStage.js Performance clock, overlay, and the window.__hands API the Python side drives.
decisionStream.js The sidebar: what each hand is thinking about and what it chose, as it happens.
realHands.js, handSurface.js, realHandReach.mjs, realFingerPose.mjs Optional Three.js hands (?real-hand=1). Reach and pose solving are pure modules with their own tests.
slice_jev.py The pipeline: fill slices up to the horizon, harvest answers, never block on a request.
sliceBrain.py One TypeSafe request per hand per slice: the question format and the rules text.
sliceReplay.py A recorded run as a brain.
sliceAudio.py, alignTake.py Audio capture with sync marks; aligning and muxing the screen recording.
pianoBrowser.py, typesafe.py The Chrome tab over CDP; the HTTP call and the answer check.
midi_to_score.py .mid β†’ river-flows-in-you.json (tick, at_ms, keys).
recordings/ One full live take (165 s, 551 decisions) for --replay.
vendor/three/ Three.js, MIT.

Checks

Offline, no browser, no requests:

node test_hand_model.js && node test_hand_slice.js && node simulate_slices.js
node test_real_hand_reach.mjs && node test_real_finger_pose.mjs
uv run python test_midi_to_score.py && uv run python sliceReplay.py && uv run python sliceAudio.py && uv run python alignTake.py && uv run python typesafe.py
uv run ruff check .

simulate_slices.js is the pipeline's claim, checked against the real score: a brain that answers 400 ms late strikes exactly the notes an instant one does.

With Chrome, still no requests:

uv run python test_real_hands.py        # 3D hands: opt-in loading, fixed bones, strikes, disposal
uv run python test_decision_stream.py   # the sidebar, fed deterministic choices
uv run python test_audio_sync.py        # 48 kHz capture, silence kept, both sync marks heard

Numbers from the recorded take

Decisions 551 requests over 165 s, two hands
Answer latency p50 361 ms, p95 605 ms
Late decisions 7
Notes missed 30 of 800

Missed notes are mostly a finger that stayed rather than moved, or a placement dropped because the slice was asked against a guess about an earlier slice that turned out wrong. The pipeline re-asks once when there is still time for a second answer to land.

About

@TypeSafeAI 's Jev controls the 2 hands and each finger to play the piano in real-time. Jev only "sees" what we see and plays this from the "note waterfall". It uses @browser_use 's jev-ultrafast and some decision scheduling to make this happen in real-time. Sound on πŸ”ˆπŸ”‰πŸ”Š

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages