Train and publish
In Teachable Machine, give each class a useful name such as jump, card, or clap. Export the model and copy its share URL.
Complete block reference (48 blocks)
TurboWarp extension · user guide
The extension connects a Teachable Machine Pose, Image, or Audio model to TurboWarp. Your camera frame or microphone audio becomes label probabilities that scripts can read as labels, scores, and Boolean conditions.
Kamishibai DSL 4.0 bundle
Click the documentation button immediately below the Teachable Machine member
heading. The bundled blocks retain the model URL, recognition, preview, label, score,
threshold, and lifecycle behavior described here. The TurboWarp Teachable Machine 3.5.1 package line keeps the public lifecycle
opcodes startRecognition, stopRecognition, and
isRecognizing, with no legacy aliases. Configurable SVG pose overlay blocks
remain available in pose mode, while image mode uses label scoring without keypoints. Latest-needed model initialization
and cancellation controls remain host APIs documented under Composition API.
Quick start
You need a published Teachable Machine Pose, Image, or Audio model, the matching camera or microphone permission, and network access. Load the downloaded tm.js from the custom extension dialog’s Files tab with Run without sandbox enabled, then place these blocks in order.
In Teachable Machine, give each class a useful name such as jump, card, or clap. Export the model and copy its share URL.
Paste the model folder URL. A missing trailing slash is added automatically.
Allow camera or microphone access. The extension starts the required input and loads the model automatically if needed.
Read the top label, test one class, or use a confidence value to control your project.
How it works
While recognition is running, the extension repeatedly samples the selected camera or microphone input, runs the model in the browser, and stores a probability for every class in your model.
current label is the class with the highest probability. confidence is that class’s score, rounded to two decimal places. confidence of [NAME] reads one named class.
The preview is a camera canvas placed over the TurboWarp stage. It does not become a sprite and does not change model input when hidden. It is mirrored by default, and can switch between mirrored and unmirrored while the camera is running without changing recognition input.
Version 1.11.0 overlays the 17 recognized PoseNet joints and 12 standard bone connections as SVG by default. Blocks control visibility, each joint's color, opacity, and radius, shared bone color, opacity, and width, the minimum confidence, and independent confidence scaling for those visual properties.
The extension requests a normal Canvas2D context for its owned camera canvas. Physical-camera measurements of the 320x240, one-draw/one-read path did not show a repeatable end-to-end benefit from willReadFrequently; the hint helped a different read-heavy condition with four or more reads per draw, but could make video drawing more expensive. Chrome may therefore emit its Canvas2D readback warning during CPU inference. Other TurboWarp canvases are unchanged, and hosts do not need a global Canvas or Console patch.
start camera opens the camera and displays the preview.start recognition starts the required input and loads the model when necessary.stop recognition clears live results, stops audio listening, and leaves the camera available.stop camera stops recognition, releases media tracks, and removes the preview.hide camera preview only changes what is shown; recognition can continue.Composition hosts
The composition API lets an application host cancel obsolete model demand while camera startup continues independently. The first inference waits for both the active input and one registered model.
SHA checks for separate PoseNet files run in parallel. Shared descriptor verification overlaps classifier loading, but unverified bytes never reach TensorFlow. Camera getUserMedia() and video.play() may run alongside the complete model path.
Create the composition with modelInitializationPolicy: 'latest-needed' and pass an AbortSignal to registerPoseModel(). At most one heavy request is active and one newest request is pending. A cancelled model is never published to the registry.
Choosing a result
Default builds expose immediate probabilities. Builds that enable the optional temporalPoseScoring feature also expose accumulated scores for steadier decisions.
Best for quick gestures. The answer follows every frame, so it reacts fast but may flicker near a decision boundary.
Use label is [NAME] with confidence at least [THRESHOLD]?. Thresholds are clamped to 0–1; 0.75 is a practical starting point.
Best for sustained poses. Evidence is added over elapsed time while older evidence decays, reducing one-frame changes.
The reporter returns an empty label until the best positive score reaches the threshold. Hidden-tab time is excluded. Stopping recognition or resetting clears all accumulated scores.
Block guide
Reporter values are empty or zero before the first usable recognition result and after recognition stops. Boolean status blocks are useful when coordinating startup.
Configure and check the Teachable Machine model.
set model URL to [URL] changes the model and clears the previously loaded one.load model fetches model.json and metadata.json.model is loaded? reports readiness.Teachable Machine version reports the extension build.Choose how much of the machine recognition may use.
set compute mode to [MODE] · auto (default), webgpu, webgl, wasm, or cpucompute mode reports what the project asked for.active compute backend reports what the browser actually gave.auto tries WebGPU, WebGL, WASM, and CPU in that order and keeps the first one that really computes. A named mode is a preference: when the browser cannot provide it the same order takes over, and last error explains the substitution. Change the mode before loading a model—switching releases a model loaded from a URL so it can be rebuilt on the new backend.
Control capture separately from recognition.
start camera · stop camera · camera is running?refresh camera list detects available video inputs.set camera to [CAMERA] · default, front, back, or a detected devicecamera count · camera device ID · camera device nameshow camera preview · hide camera previewcamera preview is visible?set camera preview opacity to [OPACITY] clamps opacity to 0–1.set camera preview position to [POSITION]set camera preview to [MIRRORING] · mirrored (default) or unmirroredcamera preview mirroring reports the current setting.set pose overlay [VISIBILITY] · pose overlay is visible?set [PART] joint color [COLOR] opacity [OPACITY] radius [RADIUS]set pose bone color [COLOR] opacity [OPACITY] width [WIDTH]set pose overlay minimum confidence to [CONFIDENCE]set pose [PROPERTY] confidence scaling [STATE]Camera labels may appear only after permission is granted. Device IDs are browser- and machine-specific. Switching a running camera preserves the model, recognition state, and preview settings; a failed switch attempts to restore the previous camera.
When TurboWarp-Camera-Source is loaded, this extension leases the camera it shares under the pose role, so one device serves recognition and anything else reading frames. stop camera then releases the lease without stopping tracks other consumers are reading. Camera Source is optional: without it the extension opens and stops its own camera as before, and nothing in a project changes.
Start the loop, read scores, and make decisions.
start recognition · stop recognition · recognition is running?current label · confidence · confidence of [NAME]label is [NAME]? uses a fixed 0.75 threshold.label is [NAME] with confidence at least [THRESHOLD]?Measure startup and show useful failure details.
camera startup time (ms)model load time (ms)first recognition time (ms)last error keeps the latest runtime error message.Live confidence flickers frame to frame near a decision boundary; these blocks combine evidence over time so a brief misrecognition cannot flip a decision. They are in the palette by default (temporalPoseScoring): set accumulated pose accumulation [ACCUMULATION] decay [DECAY], set accumulated pose threshold [THRESHOLD], reset accumulated pose scores, accumulated pose, accumulated score, and accumulated score of [NAME]. Decay is the fraction retained after one second (0–1), and a decay change takes effect the next time recognition starts.
Troubleshooting
Check last error first. Most setup failures come from permissions, an incorrect model URL, blocked network requests, or loading the extension in the sandbox. A sandboxed load is silent in the editor: the dialog keeps waiting and only the browser console shows TM must run without the extension sandbox. Load the file from the Files tab, never from the URL tab.
start camera also needs the page to have been interacted with once. Browsers refuse video.play() without user activation, reported as NotAllowedError: play() failed because the user didn’t interact with the document first. Clicking the green flag counts, so an ordinary project is fine; a project that starts on its own must wait for a button press.
Allow camera permission for the TurboWarp page and make sure another application is not exclusively using the camera. The page must run in a secure context (HTTPS or localhost). Then run start camera again.
Use the published Teachable Machine model folder URL—not a link to the editor or an individual JSON file. The extension appends model.json and metadata.json to that URL. Confirm that the network allows jsDelivr and Teachable Machine model hosting.
Add more varied training examples, keep the whole body visible, improve lighting, and test a threshold such as 0.75. If your build exposes accumulated-pose blocks, use them for a pose that must be held for a short time.
Run show camera preview, set opacity above zero, and choose a supported position. Packaged projects with a modified stage DOM may not support preview attachment; last error explains stage-detection failures.
All 48 blocks are documented below, including compatibility blocks and blocks available through optional features. Select a block to read its behavior, arguments, default values, and menu choices. Each block has a permanent link.
Teachable Machine versionReturns the extension version.
Block type: REPORTER. Opcode: versionReporter. Permanent link
This block has no arguments.
set recognition mode to [MODE]Selects whether the current Teachable Machine model recognizes poses, images, or audio.
Block type: COMMAND. Opcode: setRecognitionMode. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
MODE | STRING | pose |
recognition modeReturns the current recognition mode.
Block type: REPORTER. Opcode: recognitionModeReporter. Permanent link
This block has no arguments.
set compute mode to [MODE]Selects the TensorFlow.js compute backend. "auto" negotiates WebGPU, WebGL, WASM, and CPU in that order and falls back automatically when a backend is unusable. Changing the mode releases a model that was loaded from a URL so it can be reloaded on the new backend.
Block type: COMMAND. Opcode: setComputeMode. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
MODE | STRING | auto |
compute modeReturns the requested compute mode.
Block type: REPORTER. Opcode: computeModeReporter. Permanent link
This block has no arguments.
active compute backendReturns the TensorFlow.js backend recognition is actually running on, which can differ from the requested mode when the browser could not provide it.
Block type: REPORTER. Opcode: computeBackendReporter. Permanent link
This block has no arguments.
set model URL to [URL]Sets the Teachable Machine model URL.
Block type: COMMAND. Opcode: setModelURL. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
URL | STRING | https://teachablemachine.withgoogle.com/models/XXXX/ |
start cameraStarts the camera and attaches the preview.
Block type: COMMAND. Opcode: startCamera. Permanent link
This block has no arguments.
stop cameraStops the camera and recognition loop.
Block type: COMMAND. Opcode: stopCamera. Permanent link
This block has no arguments.
camera is running?Reports whether the camera is running.
Block type: BOOLEAN. Opcode: isCameraRunning. Permanent link
This block has no arguments.
refresh camera listRefreshes the list of available video input devices.
Block type: COMMAND. Opcode: refreshCameraList. Permanent link
This block has no arguments.
set camera to [CAMERA]Selects the default, front, back, or a detected camera and switches a running camera.
Block type: COMMAND. Opcode: setCameraSelection. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CAMERA | STRING | default |
camera countReturns the number of video input devices found by the latest refresh.
Block type: REPORTER. Opcode: cameraCountReporter. Permanent link
This block has no arguments.
camera device IDReturns the active camera device ID when available.
Block type: REPORTER. Opcode: cameraDeviceIdReporter. Permanent link
This block has no arguments.
camera device nameReturns the active camera device name when available.
Block type: REPORTER. Opcode: cameraDeviceNameReporter. Permanent link
This block has no arguments.
show camera previewShows the camera preview.
Block type: COMMAND. Opcode: showPreview. Permanent link
This block has no arguments.
hide camera previewHides the camera preview.
Block type: COMMAND. Opcode: hidePreview. Permanent link
This block has no arguments.
camera preview is visible?Reports whether the preview is configured as visible.
Block type: BOOLEAN. Opcode: isPreviewVisible. Permanent link
This block has no arguments.
set camera preview opacity to [OPACITY]Sets preview opacity from 0 to 1.
Block type: COMMAND. Opcode: setPreviewOpacity. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
OPACITY | NUMBER | 0.6 |
set camera preview position to [POSITION]Sets the preview position on the stage.
Block type: COMMAND. Opcode: setPreviewPosition. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
POSITION | STRING | bottom-right |
set camera preview to [MIRRORING]Sets whether the preview is mirrored without changing the recognition input.
Block type: COMMAND. Opcode: setPreviewMirroring. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
MIRRORING | STRING | mirrored |
camera preview mirroringReturns mirrored or unmirrored for the current preview setting.
Block type: REPORTER. Opcode: previewMirroringReporter. Permanent link
This block has no arguments.
set pose overlay [VISIBILITY]Shows or hides the SVG pose overlay without stopping recognition.
Block type: COMMAND. Opcode: setPoseOverlayVisibility. Permanent link
Available when the optional poseOverlay feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
VISIBILITY | STRING | on |
pose overlay is visible?Reports whether the SVG pose overlay is configured as visible.
Block type: BOOLEAN. Opcode: isPoseOverlayVisible. Permanent link
Available when the optional poseOverlay feature is enabled.
This block has no arguments.
set [PART] joint color [COLOR] opacity [OPACITY] radius [RADIUS]Sets the SVG circle style for one PoseNet joint.
Block type: COMMAND. Opcode: setPoseJointStyle. Permanent link
Available when the optional poseOverlay feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
PART | STRING | nose | |
COLOR | STRING | #00e5ff | |
OPACITY | NUMBER | 1 | |
RADIUS | NUMBER | 4 |
set pose bone color [COLOR] opacity [OPACITY] width [WIDTH]Sets the color, opacity, and line width for all SVG pose bones.
Block type: COMMAND. Opcode: setPoseBoneStyle. Permanent link
Available when the optional poseOverlay feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
COLOR | STRING | #00e5ff | |
OPACITY | NUMBER | 0.9 | |
WIDTH | NUMBER | 3 |
set pose overlay minimum confidence to [CONFIDENCE]Hides joints and bones whose keypoint confidence is below the given value.
Block type: COMMAND. Opcode: setPoseOverlayMinimumConfidence. Permanent link
Available when the optional poseOverlay feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONFIDENCE | NUMBER | 0.5 |
set pose [PROPERTY] confidence scaling [STATE]Scales the selected SVG style property from zero to its configured value using keypoint confidence.
Block type: COMMAND. Opcode: setPoseConfidenceScaling. Permanent link
Available when the optional poseOverlay feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
PROPERTY | STRING | joint-opacity | |
STATE | STRING | off |
load modelLoads the configured Teachable Machine model.
Block type: COMMAND. Opcode: loadModel. Permanent link
This block has no arguments.
model is loaded?Reports whether the model is loaded.
Block type: BOOLEAN. Opcode: isModelLoaded. Permanent link
This block has no arguments.
start recognitionStarts recognition.
Block type: COMMAND. Opcode: startRecognition. Permanent link
This block has no arguments.
stop recognitionStops recognition.
Block type: COMMAND. Opcode: stopRecognition. Permanent link
This block has no arguments.
recognition is running?Reports whether recognition is running.
Block type: BOOLEAN. Opcode: isRecognizing. Permanent link
This block has no arguments.
current labelReturns the highest-scoring label.
Block type: REPORTER. Opcode: currentPoseReporter. Permanent link
This block has no arguments.
confidenceReturns the confidence of the current label.
Block type: REPORTER. Opcode: scoreReporter. Permanent link
This block has no arguments.
confidence of [NAME]Returns the confidence for a named label.
Block type: REPORTER. Opcode: poseScoreReporter. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
NAME | STRING | jump |
set accumulated pose accumulation [ACCUMULATION] decay [DECAY]Sets the accumulation rate per second and the decay retained per second; decay changes apply to the next recognition session.
Block type: COMMAND. Opcode: setAccumulatedPoseParameters. Permanent link
Available when the optional temporalPoseScoring feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
ACCUMULATION | NUMBER | 1 | |
DECAY | NUMBER | 0.9 |
set accumulated pose threshold [THRESHOLD]Sets the minimum accumulated score required to report a pose; values below the threshold report an empty string.
Block type: COMMAND. Opcode: setAccumulatedPoseThreshold. Permanent link
Available when the optional temporalPoseScoring feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
THRESHOLD | NUMBER | 0 |
reset accumulated pose scoresClears all accumulated pose scores.
Block type: COMMAND. Opcode: resetAccumulatedPose. Permanent link
Available when the optional temporalPoseScoring feature is enabled.
This block has no arguments.
accumulated poseReturns the pose label whose accumulated score is highest and meets the threshold, or an empty string otherwise.
Block type: REPORTER. Opcode: accumulatedPoseReporter. Permanent link
Available when the optional temporalPoseScoring feature is enabled.
This block has no arguments.
accumulated scoreReturns the highest accumulated pose score without rounding.
Block type: REPORTER. Opcode: accumulatedScoreReporter. Permanent link
Available when the optional temporalPoseScoring feature is enabled.
This block has no arguments.
accumulated score of [NAME]Returns the accumulated score for a named pose without rounding.
Block type: REPORTER. Opcode: accumulatedPoseScoreReporter. Permanent link
Available when the optional temporalPoseScoring feature is enabled.
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
NAME | STRING | jump |
label is [NAME]?Reports whether the named label has at least 0.75 confidence.
Block type: BOOLEAN. Opcode: isPose. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
NAME | STRING | jump |
label is [NAME] with confidence at least [THRESHOLD]?Reports whether the named label meets the given threshold.
Block type: BOOLEAN. Opcode: isPoseWithThreshold. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
NAME | STRING | jump | |
THRESHOLD | NUMBER | 0.75 |
camera startup time (ms)Returns camera startup time in milliseconds.
Block type: REPORTER. Opcode: cameraMsReporter. Permanent link
This block has no arguments.
model load time (ms)Returns model load time in milliseconds.
Block type: REPORTER. Opcode: modelLoadMsReporter. Permanent link
This block has no arguments.
first recognition time (ms)Returns first recognition time in milliseconds.
Block type: REPORTER. Opcode: firstRecognitionMsReporter. Permanent link
This block has no arguments.
last errorReturns the latest recorded error message.
Block type: REPORTER. Opcode: lastErrorReporter. Permanent link
This block has no arguments.
Fixed menus and finite numeric inputs preserve existing raw values unless edited. Connected reporters remain read only and are never evaluated. Failed saves retain drafts; cancel, dispose and scope changes discard them. Existing runtime clamps and serializers remain unchanged. The fixed editor is OFF by default; enable blockEditorDialogs and blockEditorFixedInputs at startup.