Documentation · v2.4

Build a study from zero.

Welcome to the Affect Lens docs. This handbook walks through everything from building your first 5-minute study to exporting and analysing the data, all from the browser, no code required.

Quickstart, your first study in 5 minutes

Everything happens in the visual study builder. A minimal hybrid study chains one media phase and one survey phase, then exports as a single joined table.

  1. Create a study from the dashboard, or clone a template.
  2. Add a consent phase: pick a built-in IRB template or paste your own.
  3. Add a media phase: upload your video or audio clip and toggle on emotion + attention capture. Drop scene markers anywhere on the timeline.
  4. Add a survey phase: drag in question items (Likert, NPS, open-ended…). Reference tracking data with piping if you want.
  5. Share the link and watch results arrive in real time.
No installation, no SDK, no code. The whole study, builder, participant experience, and analysis, runs in the browser.

Phase types

TypeIdentifierDescription
ConsentconsentIRB-style consent screen with custom copy
MediamediaVideo or audio playback with optional tracking
SurveysurveyOne or more question items with logic
HybridhybridMedia + time-locked survey items in one phase
InstructioninstructionText/image/video instruction with timing controls
RandomiserrandomiserCounter-balance, latin square, or random
BranchbranchRoute on any signal from earlier phases

Emotion signals

Per-frame output, time-aligned to media playback. Sampled at 30fps when the participant's device permits, downsampled to 15fps automatically on slower hardware.

SignalRangeNotes
joy0..1Probability score
surprise0..1Probability score
sadness0..1Probability score
anger0..1Probability score
fear0..1Probability score
disgust0..1Probability score
contempt0..1Probability score
valence-1..1Continuous, smoothed over 200ms window
arousal0..1Continuous, smoothed over 200ms window
All probabilities sum to ≤ 1, with the residual representing "neutral." Use argmax for a single label per frame.

Signal pipeline

Every captured frame passes through the same on-device pipeline before a signal is recorded. Understanding the stages helps you interpret the data and set quality thresholds for your study.

StageWhat happensOutput
1 · DetectFace mesh + landmark detection per frame468 landmarks
2 · ValidateReject frames below quality threshold (face out of frame, occluded, too dark)valid / dropped
3 · ClassifyExpression model maps landmarks → emotion probabilities7 affects
4 · SmoothValence/arousal smoothed over a 200ms rolling window to suppress jittercontinuous
5 · AlignEach sample is stamped with the media playback time, not wall-clocktimestamp_ms

Capture runs at 30fps where the device allows, automatically dropping to 15fps on slower hardware. Dropped-frame ratio is recorded per participant so you can filter low-quality sessions out of analysis.

A study-level quality gate lets you auto-exclude any session whose valid-frame ratio falls below a threshold you set (default 70%).

Attention & engagement index

Attention is a composite index (0–100) computed per timestamp, not a single survey number. It blends three on-device signals:

ComponentDerived fromWeight
Gaze stabilityEye/head steadiness toward the screen0.45
Expression intensityMagnitude of affect (any direction)0.30
PresenceFace fully in frame, eyes open0.25

The engagement index is the attention curve weighted by absolute valence, capturing moments that are both attended and emotionally charged. Both curves are exported per frame and aggregated per scene.

Default thresholds: drop-off fires when attention stays below 40 for >1.5s; a peak is any local maximum above 75. Both are configurable per study.

Derived metrics

For every scene marker you place on a clip, the system auto-computes a standard set of metrics , no manual coding required.

MetricDefinitionUnit
peak_valenceHighest smoothed valence within the scene-1..1
mean_valenceAverage valence across the scene-1..1
time_to_smileLatency from scene start to first joy onsetms
peak_attentionMaximum attention index in the scene0..100
dropoff_countNumber of attention drop-off eventscount
dwell_ratioShare of scene spent above attention threshold0..1
emotion_shareProportion of frames per dominant emotion% per affect

Cohort aggregation

Individual traces are aggregated into cohort views in real time as participants complete. You can slice by any survey variable or segment marker.

Aggregations recompute live, there's no batch job to wait for. A study at n=300 updates the moment the 300th participant submits.

Export schema

Every study exports as a set of CSV or Parquet files keyed by participant_id × phase_id × timestamp_ms.

study_0412/ ├── participants.csv # 1 row per participant ├── phases.csv # 1 row per phase definition ├── emotion_frames.parquet # 1 row per frame, per participant ├── attention_timeline.json # attention index over time ├── survey_responses.csv # 1 row per question, per participant └── joined_study.parquet # denormalised, recommended for analysis

We ship starter notebooks for R and Python covering the common paradigms (ANOVA, mixed-effects, time-series of emotion traces) so you can go from export to analysis in minutes.

Privacy & on-device processing

All facial analysis runs locally in the participant's browser. The raw webcam video never leaves their device and is never uploaded. Only the derived signals, emotion probabilities, attention scores, valence/arousal, and survey responses are transmitted.

Because nothing identifiable leaves the device, studies clear most IRB reviews far faster. See our Privacy Policy for the full data map.

Validated scales (built-in)

ScaleItemsUse
PANAS20Positive/negative affect
SAM3Self-assessment manikin (valence/arousal/dominance)
SUS10System usability
UEQ-S8User experience (short)
NPS1Net promoter
BFI-1010Big Five inventory (short)
Looking for something else? Email research@affectlens.com with the citation and we'll add the scale to the library.