PsychoPy and MATLAB code for a three-stimulus auditory oddball EEG paradigm with P300 analysis.
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#E8F4FD', 'primaryBorderColor': '#7BA7C9', 'primaryTextColor': '#2C3E50', 'secondaryColor': '#FDF2E9', 'secondaryBorderColor': '#D4A574', 'secondaryTextColor': '#2C3E50', 'tertiaryColor': '#EAFAF1', 'tertiaryBorderColor': '#82C9A1', 'tertiaryTextColor': '#2C3E50', 'lineColor': '#5D6D7E', 'textColor': '#2C3E50', 'background': '#FFFFFF', 'mainBkg': '#E8F4FD', 'nodeBorder': '#7BA7C9', 'clusterBkg': '#F8F9FA', 'clusterBorder': '#BDC3C7', 'fontSize': '14px'}}}%%
flowchart LR
A["Standard Tone (80%)"]:::input --> D[EEG Recording]
B["Target Tone (10%)"]:::input --> D
C["Novel Tone (10%)"]:::input --> D
D --> E[P300 Analysis]:::output
classDef input fill:#FDF2E9,stroke:#D4A574
classDef output fill:#EAFAF1,stroke:#82C9A1
A complete experiment-to-analysis pipeline for the three-stimulus auditory oddball paradigm, a standard cognitive neuroscience protocol for eliciting P300 event-related potentials. The paradigm presents three categories of auditory stimuli -- frequent standards, rare targets requiring a response, and rare task-irrelevant novels -- while recording EEG.
The repository contains two major components: a PsychoPy experiment script for stimulus presentation and response collection, and a MATLAB analysis suite for EEG signal processing including ERP extraction, time-frequency analysis, heart rate variability, and fractal analysis.
- PsychoPy experiment -- Automated stimulus delivery with WAV file playback, block design, and response logging
- ERP analysis -- P300 component extraction across standard, target, and novel conditions
- Time-frequency analysis -- Wavelet-based spectral decomposition via EEGLAB
- Physiological measures -- ECG-derived HRV, phasic cardiac response, and EOG analysis
- Fractal analysis -- Detrended fluctuation analysis per EEG channel
- Artifact rejection -- ADJUST plugin integration for automated artifact removal
Experiment (PsychoPy):
cd psychoPy
python Oddball_threeStimulus.pyAnalysis (MATLAB):
Open matlab_threeStimulus/ in MATLAB and run the main analysis scripts. Requires EEGLAB and the ADJUST plugin.
MIT License. See LICENSE for details.