Brainwave Oscillations - EEG Simulator (3D)

A Blender head with 24 coupled Jansen-Rit cortical patches and 19 scalp electrodes: change synaptic speed, drive and coupling and watch delta, theta, alpha, beta and gamma rhythms emerge.

Switch to 2D

Presets

Playback

Brain-state model

View

Camera

Layers

Quality

Model check

The science

What you see. The cortex is split into 24 patches. Each patch is a neural mass: a population-level model with pyramidal cells and excitatory and inhibitory interneurons (Jansen and Rit, 1995). The scalp electrodes record a distance-weighted mix of the patch potentials. The rhythm you see is produced by the excitation-inhibition feedback loop, not by sine waves added together.

Equations (per patch). Post-synaptic potentials obey second-order kernels, y'' = A a S(input) - 2a y' - a2 y:

y0'' = A a S(y1 - y2) - 2a y0' - a2 y0
y1'' = A a [ p + C2 S(C1 y0) ] - 2a y1' - a2 y1
y2'' = B b C4 S(C3 y0) - 2b y2' - b2 y2

with the sigmoid S(v) = 2 e0 / (1 + exp(r (v0 - v))). The patch output is v = y1 - y2. Standard values: A = 3.25 mV, B = 22 mV, 1/a = 10 ms, 1/b = 20 ms, C = 135, C1 = C, C2 = 0.8 C, C3 = C4 = 0.25 C, e0 = 2.5 /s, v0 = 6 mV, r = 0.56 /mV. The drive p (default 220 pulses/s) plus noise models input from the rest of the brain. With these values one patch settles on a limit cycle near 11 Hz, which is the alpha range.

Why the bands move. Every kernel time constant is divided by the synaptic speed s. The equations are exactly covariant under this rescaling of time, so the frequency of the rhythm is f = s f1, where f1 is the rhythm at s = 1. Slow synapses give delta and theta, fast ones give beta and gamma. Real brain states change many things at once (neuromodulators, thalamic input, connectivity); this single knob is a teaching device, not a physiological dial. Lowering p below about 110/s removes the oscillation and leaves a steady state; raising B or p changes the shape and amplitude of the wave.

Coupling and synchrony. Patch i receives an extra input g C Σj Wij (Sj - mean) from the other patches, with weights Wij decaying exponentially with the distance on the cortex. Patches also differ in speed by up to +/- the detuning setting. Coupling pulls the phases together (Kuramoto-like locking). The synchrony r = |mean of exp(i phi)| uses a phase read from the (v, dv/dt) plane, a rough substitute for a Hilbert-transform phase: r near 0 means unrelated phases, r near 1 means one common rhythm. Large synchronised sources produce larger scalp signals, which is why strong rhythms such as alpha appear in real EEG.

Scalp read-out. Electrode k shows the sum over patches of Kki vi with Kki proportional to 1/(d2 + 0.25), normalised. A real head needs a volume-conductor model (skull, CSF, folded cortex); this kernel only gives plausible blurring and a polarity map. Electrode sites are the approximate international 10-20 positions. Amplitudes are in model millivolts, not microvolts.

Spectrum. The dominant frequency comes from a 2048-point FFT (4.1 s window, Hann taper, 0.24 Hz bins, parabolic peak interpolation) averaged over all 19 channels. Bands: delta 0.5-4, theta 4-8, alpha 8-13, beta 13-30, gamma 30-100 Hz.

Checks (run in the page). (1) The RK4 time stepping relaxes to the steady state of one patch found by an independent bisection root-finder. (2) The FFT of a pure 10 Hz sine returns 10 Hz, the reference patch rhythm is in the alpha range, and doubling s doubles the frequency (x2.000). (3) Halving the integration step leaves the rhythm and amplitude unchanged to well under 1 %.

What this model is not. It is a classical, simplified neural-mass model. It reproduces how a feedback loop can generate band-limited rhythms and how coupling synchronises them; it does not model individual neurons, cortical layers, thalamus, real anatomy, or any disease. It is an educational illustration only and gives no medical or diagnostic information.

What to try

  • Run the presets in turn and watch the dominant frequency move through delta, theta, alpha, beta and gamma. The last graph shows frequency against synaptic speed: the line is f = s f1.
  • Set coupling to 0 with detuning 0.25, then raise coupling slowly: synchrony r climbs and the scalp amplitude grows because the patches add up.
  • Press "Flash stimulus" to give every patch a 40 ms pulse and see the evoked wave and ringing.
  • Lower the drive p below 110/s: the rhythm stops (steady state). Raise it above 300/s and the wave shape changes.
  • Click an electrode to see its own trace and its position in the topographic map.
Loading model...
Loading Blender model...
EEG at the selected electrode
Power spectrum with the five bands
Band-power shares over the last 30 s
Dominant frequency against synaptic speed
Made with ๐ŸŸ  Blender ยท Three.js

About Brainwave Oscillations

The brain generates rhythmic electrical oscillations at characteristic frequencies that correlate with different mental states and cognitive functions. These rhythms โ€” recorded by electroencephalography (EEG) โ€” arise from synchronised activity among millions of neurons and are classified into five main bands: delta (0.5โ€“4 Hz, deep sleep), theta (4โ€“8 Hz, drowsiness and memory encoding), alpha (8โ€“13 Hz, relaxed wakefulness), beta (13โ€“30 Hz, active thinking), and gamma (30โ€“100 Hz, focused attention and feature binding). Understanding these oscillations underlies clinical applications from epilepsy diagnosis to brain-computer interfaces.

Frequently Asked Questions

What causes brainwave oscillations?

Oscillations emerge from rhythmic excitation and inhibition among neural networks. Interneurons (inhibitory neurons) create periodic "windows" during which pyramidal (excitatory) cells can fire, producing rhythmic bursts. Thalamo-cortical loops amplify slower rhythms (alpha, delta) by sending rhythmic bursts back and forth between the thalamus and cortex. Local cortical circuits generate faster gamma rhythms through excitatory-inhibitory balance.

What are the main EEG frequency bands and their associated states?

Delta (0.5โ€“4 Hz) dominates deep slow-wave sleep and is abnormally present in brain damage. Theta (4โ€“8 Hz) is associated with drowsiness, memory consolidation in the hippocampus, and REM sleep. Alpha (8โ€“13 Hz) is the dominant "idle" rhythm of the relaxed, eyes-closed brain and is suppressed by visual input or mental effort. Beta (13โ€“30 Hz) accompanies active cognition, motor planning, and anxiety. Gamma (30โ€“100 Hz) is linked to focused attention, sensory binding, and working memory.

How does EEG measure brainwaves?

EEG places electrodes on the scalp that detect tiny voltage fluctuations (typically 10โ€“100 ยตV) caused by the synchronised postsynaptic potentials of millions of cortical neurons. The signal is amplified and filtered, then analysed with Fourier transforms to extract the power spectrum across frequency bands. Clinical EEG uses the International 10-20 system of electrode placement with 19โ€“256 electrodes spaced at 10% or 20% intervals across the skull.

What is alpha suppression and why does it happen?

Alpha waves (8โ€“13 Hz) are suppressed โ€” a phenomenon called event-related desynchronisation (ERD) โ€” when the brain processes visual or cognitive tasks. Opening your eyes typically reduces occipital alpha power by 50โ€“80% within 1โ€“2 seconds. This occurs because alpha rhythms reflect an "idling" state of the visual cortex; when stimulated, local inhibitory mechanisms give way to more irregular, task-specific beta and gamma activity.

What are sleep spindles and K-complexes?

Sleep spindles are brief bursts of 12โ€“16 Hz oscillations lasting 0.5โ€“2 seconds that appear during Stage 2 NREM sleep. They are generated by thalamo-cortical circuits and are thought to consolidate memories by replaying hippocampal sequences. K-complexes are large, high-amplitude waveforms (amplitude >75 ยตV) also in Stage 2 sleep, thought to suppress arousal and protect sleep in response to external stimuli.

Can brainwaves be controlled voluntarily?

Yes, through neurofeedback training. Subjects view a real-time display of their own EEG power in a specific band and learn to increase or decrease it through mental strategies. Alpha neurofeedback has shown promise for reducing anxiety and enhancing creativity; theta/alpha training is used for attention-deficit disorders. Sustained practice can shift resting-state power spectra, though effect sizes in clinical trials are modest.

What is the role of gamma waves in consciousness?

Gamma oscillations (30โ€“100 Hz) are hypothesised to underlie the "binding" of disparate neural representations into unified conscious percepts โ€” the binding problem. Synchronized gamma between distant cortical areas may allow features processed in separate regions (e.g., colour in V4, motion in V5) to be integrated. However, the causal role of gamma in consciousness remains debated; studies show gamma correlates strongly with attention, but whether it is cause or consequence is unclear.

What is the difference between EEG and MEG?

Electroencephalography (EEG) measures electrical potentials at the scalp, which are smeared by the poorly conducting skull. Magnetoencephalography (MEG) measures the tiny magnetic fields (femtotesla range) produced by neural currents using superconducting quantum interference devices (SQUIDs). MEG has better spatial resolution (~3 mm vs ~1 cm for EEG) and is unaffected by skull conductance, but requires a magnetically shielded room and costs several million pounds per system.

How are brainwaves used in brain-computer interfaces?

Brain-computer interfaces (BCIs) decode EEG signals to control external devices. The P300 BCI exploits a gamma-range event-related potential 300 ms after a target stimulus to let paralysed users type. Motor imagery BCIs detect beta desynchronisation over the motor cortex when users imagine moving their hand, enabling cursor control. Consumer EEG headsets with 1โ€“16 dry electrodes are used for meditation feedback, gaming, and attention monitoring, though with far lower signal quality than clinical systems.

What causes the transition between sleep stages?

Sleep stage transitions are orchestrated by the interaction of a circadian process (the ~24-hour clock driven by the suprachiasmatic nucleus) and a homeostatic process (adenosine accumulation during wakefulness). As sleep pressure builds during the day, adenosine inhibits wake-promoting neurons in the basal forebrain. During NREM sleep, slow oscillations replay hippocampal memories into the cortex for consolidation, and growth hormone is released in pulses during slow-wave sleep.

About this simulation

This simulator models the four main EEG frequency bands with a Kuramoto coupled-oscillator model: many virtual neurons with slightly different natural frequencies gradually pull into a shared phase. Delta, theta, alpha and beta oscillators each drive one channel of a scrolling waveform and a live power-spectrum bar chart. It is a simplified educational model, not a recording of real patient brain activity.

๐Ÿ”ฌ What it shows

Four oscillator populations โ€” delta (0.5โ€“4 Hz), theta (4โ€“8 Hz), alpha (8โ€“13 Hz) and beta (13โ€“30 Hz) โ€” synchronise according to the Kuramoto model. Their weighted sum forms the scrolling waveform, whilst the bar chart shows each band's relative power and the sync order r shows overall coherence.

๐ŸŽฎ How to use

Choose a Brain State Preset (Active/Focused, Relaxed/Meditative, Drowsy, Deep Sleep or Custom) to set the four bands' power balance, or switch to Custom and drag the ฮด/ฮธ/ฮฑ/ฮฒ power sliders individually. The Coupling K slider strengthens synchrony, Noise ฯƒ adds random jitter to each oscillator, and Reset/Pause restart or freeze the simulation.

๐Ÿ’ก Did you know?

The alpha rhythm was the first human brainwave ever recorded, described by German psychiatrist Hans Berger in 1929 after he invented electroencephalography. The Kuramoto model driving this simulation, devised by physicist Yoshiki Kuramoto in 1975, remains one of the simplest mathematical descriptions of how coupled oscillators spontaneously fall into synchrony.

Frequently asked questions

What do the four coloured bands represent?

Each colour is a standard EEG band: delta (0.5 to 4 Hz, linked to deep sleep), theta (4 to 8 Hz, drowsiness and memory), alpha (8 to 13 Hz, relaxed wakefulness) and beta (13 to 30 Hz, alert thinking), each modelled as its own group of coupled oscillators.

How is the scrolling waveform built?

At every step, the cosines of all oscillator phases within a band are averaged, multiplied by that band's power weight, and plotted as one line, so the trace is a direct sum of many individual oscillators rather than a single wave.

What does the Coupling K slider do?

K sets how strongly oscillators within a band pull each other towards a common phase. Raising K drives the synchrony order r from near zero (incoherent) towards one (fully synchronised); at low K the oscillators drift independently.

What does the Noise ฯƒ slider do?

Noise ฯƒ adds a small random jitter to every oscillator's phase on each step, working against the coupling force, so higher noise makes it harder for a band to stay synchronised even when coupling is strong.

What is the difference between a preset and Custom mode?

Each preset assigns fixed power weights to the four bands (Deep Sleep favours delta, Active/Focused favours beta), whilst Custom reveals four sliders so you can set each band's power independently, including combinations with no single physiological match.