Dual N-back

Dual N-back
HTML5 Application

Dual N-back

The Dual N-back trainer is built as a focused HTML5 application with a two-column layout that mirrors the flashcards workflow. The left column hosts the 3x3 visual grid, progress bar, and response buttons, while the right column contains session controls and metrics.

Dual n-back tasks are used in neuropsychological training as structured working-memory paradigms that blend monitoring, updating, and response inhibition across two sensory channels. The format is grounded in classic cognitive load models: a stream of visual positions and audio cues requires continuous comparison against the N-back target, with performance reflecting the ability to hold, refresh, and suppress interference over time. In clinical and research settings, this produces repeatable trials where accuracy, streaks, and error types can be tracked consistently across sessions, making it a practical framework for observing changes in attentional control and processing efficiency. Adjustable timing and N level support graded protocols, while optional biasing can raise match frequency to emphasize response calibration without changing the underlying task structure.

A live version of the app is available here.

Core features

  • Adjustable N level: Set the N level between 1 and 10 using a slider.
  • Timing controls: Session length and interval sliders allow fine-grained pacing.
  • Match bias: Optional bias raises the match rate to a fixed target.
  • Audio cues: Spoken letter cues are generated using local audio files.
  • Correction feedback: Response buttons provide visual feedback when enabled.

Stimulus flow

Each round selects a visual grid cell and an audio token. If bias is enabled, the generator increases the chance of matching the N-back position.


const nLevel = state.nLevel;
const canMatch = roundIndex >= nLevel;

if (state.biasEnabled && canMatch) {
  const targetVisual = Math.random() < state.biasRate;
  const lastVisual = visualSequence[roundIndex - nLevel];
  visualIndex = targetVisual ? lastVisual : getNonMatchIndex(lastVisual);
}

Local storage

Session settings are persisted locally so the N level, timing, and bias preferences remain consistent across reloads.

  • N level: dualNBackNLevel
  • Session seconds: dualNBackSessionSeconds
  • Interval seconds: dualNBackIntervalSeconds
  • Show corrections: dualNBackShowCorrection
  • Bias enabled: dualNBackBiasEnabled