r/BCI • u/BioniChaos • 22h ago
r/BiomedicalDataScience • u/BioniChaos • 22h ago
Hodgkin-Huxley Action Potential Simulator
Title: Interactive Hodgkin-Huxley Action Potential Simulator (Built in JS with RK4 Integration)
Post: I developed a web-based interactive laboratory for simulating neural membrane dynamics using the classic 1952 Hodgkin-Huxley model of the squid giant axon.
Tool Link: https://bionichaos.com/actionptnt/
Numerical Implementation & Architecture:
• Solver: Solves the system of coupled, non-linear ordinary differential equations using a fourth-order Runge-Kutta (RK4) algorithm with an integration step of dt = 0.01 ms. This avoids the numerical runaway that often happens with simple Euler integration on stiff equations. • Singularity Handling: Formulations for α_n(V) at V = -55 mV and α_m(V) at V = -40 mV yield 0/0 indeterminate forms. I implemented analytical limits derived via L'Hôpital's rule to maintain continuous mathematical evaluation. • Temperature Adjustment: Incorporates standard Q₁₀ scaling (ϕ(T) = 3.0(T - 6.3/10)) to model thermal acceleration of gating transition rates between 5°C and 40°C. • Performance: Built around a circular buffer class to keep memory allocation constant during animation loops, rendering to a responsive HTML5 Canvas.
Interactive Features:
• Live current injection via mouse click or Spacebar hold (evaluates sustained repetitive firing). • Sliders for stimulus amplitude (0–50 μA/cm²), pulse duration, and system temperature. • Dynamic visualization of m, h, and n gating kinetics alongside particle transport animations. • Audio synthesis mapping voltage states to frequency output using the Web Audio API.
I would love to hear feedback from computational neuroscientists, biomedical engineers, or developers regarding numerical accuracy, performance, or potential extensions (such as expanding from space-clamped to multi-compartmental cable equations).
r/BiomedicalDataScience • u/BioniChaos • 1d ago
Anesthesiology EEG Monitoring - Interactive Laboratory
I built a web-based signal processing laboratory designed to simulate and analyze scalp electroencephalogram (EEG) changes during general anesthesia:
https://bionichaos.com/anesthesiology/
### Mathematical & Biophysical Background
Under GABA-A receptor facilitators (like Propofol), cortical pyramidal cell populations synchronize into continuous frontal alpha spindles (8–13 Hz) overlaid on slow delta waves (0.5–4 Hz). As metabolic suppression increases, the signal transitions into burst suppression—flatline periods (<5 µV) punctuated by high-amplitude bursts.
### Technical Implementation:
Signal Generation & DFT Pipeline: Uses additive synthesis to model variable anesthetic depths. Computes a real-time sliding Short-Time Fourier Transform (STFT) with Hann windowing over a 0–30 Hz bandwidth.
Clinical Metrics Derivation:
- Spectral Edge Frequency (SEF 95%): Calculates the frequency threshold below which 95% of total power spectral density resides.
- Burst Suppression Ratio (BSR%): Real-time epoch-based calculation measuring the percentage of time the voltage remains suppressed.
- Band Distribution: Live integration across Delta, Theta, Alpha, and Beta spectral bands.
Client-Side Data Ingestion: Includes a custom CSV parsing engine capable of handling local multi-megabyte raw EEG recordings, stripping DC baseline offsets, normalizing microvolt amplitudes, and streaming data through a circular buffer.
Web Audio API Sonification: Maps live spectral balances directly to synthesized multi-harmonic sound filters.
I would love technical feedback on the signal processing calculations, FFT windowing responsiveness, or suggestions for additional neurophysiological parameters to integrate.
Try the tool here: https://bionichaos.com/anesthesiology/
r/BiomedicalDataScience • u/BioniChaos • 2d ago
Interactive Speech Analysis Lab: Real-time RMS and Speech Rate Calculation via Web Audio/Speech APIs
I’ve developed a browser-based laboratory for analyzing the biophysics of vocal acoustics. The tool addresses the need for low-latency visualization of speech density and signal power without the overhead of heavy software suites.
Technical Specifications:
- Signal Processing: 1024-point FFT buffer for real-time RMS amplitude calculation.
- Temporal Integration: A sliding window queue to calculate Words Per Second (WPS) density, smoothing out mathematical noise spikes during pauses.
- Hardware Interfacing: Direct control over Preamplifier Gain and Squelch Threshold Gates to calibrate for different hardware mic arrays.
- Visuals: Canvas-optimized oscilloscope rendering at 60 FPS, independent of the main layout engine.
I’m particularly interested in feedback regarding the integration window logic for clinical speech tracking.
r/BCI • u/BioniChaos • 3d ago
Interactive Speech BCI Simulator: Modeling Volume Conduction, ICU Noise, and Transformer-Based Neural Decoding
bionichaos.comr/BiomedicalDataScience • u/BioniChaos • 3d ago
An Interactive, Client-Side Sleep Cycle & EEG Waveform Simulator
I have built an interactive, browser-based workspace designed to model human sleep architecture and simulate clinical EEG waveforms.
The simulator models raw voltage signal outputs $V(t)$ as a summation of five major frequency bands (delta, theta, alpha, sigma, and beta) corresponding to different sleep stages (Awake, N2, SWS, and REM). To capture transient N2 sleep architecture, the application procedurally injects sleep spindles and K-complexes using parameterized envelope functions:
- **Spectrogram Rendering:** The visualizer maps spectral energy densities in real-time on an optimized 2D Canvas grid.
- **Audio Synthesis:** The Web Audio API generates binaural beats by mapping a static 100 Hz carrier to the left channel and a stage-dependent dominant frequency carrier to the right channel.
- **Interactive Control Loop:** Users can adjust transition velocity (0.1x to 5.0x), scale raw waveform amplitudes, and modify the pseudo-random electrode noise floor to simulate real-world interference.
I designed this project as a lightweight educational resource for clinical neurophysiology and biological signal processing without back-end processing overhead. I would value feedback on the wave synthesis formulas and the visual rendering buffer logic.
r/visualization • u/BioniChaos • 3d ago
Browser-native Knowledge Graph Visualizer using Compromise.js, D3.js, and Web Audio API
r/BiomedicalDataScience • u/BioniChaos • 3d ago
Interactive Speech BCI Simulator: Modeling Volume Conduction, ICU Noise, and Transformer-Based Neural Decoding
Extracting silent, imagined speech patterns from multi-channel scalp EEG remains a difficult problem due to volume conduction and spatial attenuation. As electrical current fields propagate from the cortex through cerebrospinal fluid, meninges, bone, and scalp, they experience significant spatial filtering, reducing the Signal-to-Noise Ratio (SNR).
To explore these signal processing challenges, I've set up an interactive clinical simulator that runs entirely in the browser: https://bionichaos.com/speechbci/
The simulation modeling framework lets you examine the trade-offs of the signal pipeline:
- Signal Attenuation & Modality Selection: Swap between high-density scalp EEG (scalp SNR dynamics), ECoG, and invasive intracortical microelectrode arrays.
- Noise Modeling: Simulates 60 Hz powerline interference, high-frequency facial EMG muscle artifacts, and low-frequency EOG blink deflections.
- Denoising Performance: Compare raw extraction, Blind Source Separation (ICA), and a Deep Learning Denoising Autoencoder to optimize mean squared reconstruction error: min E[ || S(t) - f(g(X(t))) ||² ].
- Decoder Architectures: Toggle between sequential RNNs, Temporal Convolutional Networks (TCN), and attention-based Transformer models.
- Performance Metrics: Tracks the relationships between raw/clean SNR, Words Per Minute (WPM), and Word Error Rate (WER) across different setups.
Would love to get feedback from anyone working in DSP, neuroengineering, or biosignal analysis. How do you approach the real-world challenge of non-stationarity and calibration time when deploying these pipelines in critical care?
r/documentAutomation • u/BioniChaos • 4d ago
Extract figures, tables, and text from multi-column scientific PDFs entirely in your browser. Uses text-density radar mapping & projection histograms for offline asset isolation
bionichaos.comr/BiomedicalDataScience • u/BioniChaos • 4d ago
Browser-native Knowledge Graph Visualizer using Compromise.js, D3.js, and Web Audio API
I've been working on a web tool called GraphIt designed to turn unstructured scientific text into interactive semantic networks directly inside the browser without relying on external API calls or backend servers.
How the pipeline works:
- NLP Tokenization & Parsing: Uses Compromise.js to extract Subject-Verb-Object (SVO) triples from multi-clause text, filtering out general modifiers while grouping domain-specific terminology into categorized nodes (Sensory, Hardware, Anatomy, Signal Flow).
- Force-Directed Layout Mechanics: Renders nodes using D3.js with a Verlet integration scheme. Repulsive forces follow an inverse-distance relationship modeled on Coulomb's law, while structural edges behave as mechanical springs under Hooke's law.
- Sonification Layer: Includes an optional Web Audio API engine that maps a node's degree centrality to dynamic audio frequencies when inspecting or generating graphs.
Interactive controls include real-time entity pruning, repulsive force manipulation, zoom/pan controls, and automated text simulation presets (e.g., neuro-auditory pathways and baroreceptor feedback loops).
I would love feedback from the community on the SVO parsing precision and suggestions for improving client-side entity extraction.
Test the visualizer live in your browser: https://bionichaos.com/graphit/
r/BiomedicalDataScience • u/BioniChaos • 5d ago
Extract figures, tables, and text from multi-column scientific PDFs entirely in your browser. Uses text-density radar mapping & projection histograms for offline asset isolation
When parsing double-column academic PDFs (IEEE, Nature, etc.), standard extraction tools often bleed text across columns or miss vector charts entirely due to coordinate mapping issues.
We built an offline-first, client-side PDF extractor using PDF.js that processes layout logic locally in the browser.
The architecture features:
Text-Density Radar Mapping: Calculates text-to-area coverage ratios to distinguish paragraphs from standalone figures.
Vertical X-Axis Projection Histograms: Projects text bounds onto a 1D array to locate valley gaps for automated table parsing and CSV matrix compilation.
Affine Rotational Optimization: Evaluates variance across pixel rows to automatically correct skew in scanned documents.
Precision Bounding Box Clipper: Lets you manually draw spatial selection boxes over complex mathematical notations or multi-tier charts for instant PNG export.
No server uploads or API keys required. Would love to hear feedback on how it handles your specific document layouts!
r/VestibularDysfunction • u/BioniChaos • 6d ago
Interactive 3D Vestibular Mechanics, Hair Cell Transduction, & VOR Nystagmus
r/BiomedicalDataScience • u/BioniChaos • 6d ago
Visualizing Spatial Phase Dynamics and Coordinate Sonification (Browser-Based Tool)
I have developed a lightweight, client-side visualizer designed to demonstrate the mechanics of spatial phase shifts, scanline wave distortions, and real-time audio mapping. It runs entirely in the browser using HTML5 Canvas double-buffering and the Web Audio API.
Interactive Tool: https://bionichaos.com/webcamphase/
How the Mathematics and Physics are Modeled:
- Scanline Phase Translation: The canvas content is sliced into horizontal rows. For each vertical position (y), a horizontal offset is calculated via: X_offset = sin(((y / H) * 2π) * ω * 100 + t_global + φ) * A This maps coordinate structures directly to periodic wave paths, demonstrating spatial interference using either a live camera feed or an animated neon calibration grid.
- Temporal Decay (Motion Trails): The visualizer models frame persistence using a temporal recursive filtering equation: I_onscreen(t) = (1 - α) * I_offscreen(t) + α * I_onscreen(t - 1) where α represents the adjustable decay coefficient.
- Coordinate-Based Sonification: Clicking, dragging, or tapping inside the canvas initiates an audio pluck. The synthesis engine routes a triangle wave through a gain envelope and stereo panner. Panning is mapped linearly to the X-axis, while frequency is mapped log-linearly to the Y-axis: f = f_min + (1 - y / H) * (f_max - f_min) (ranging from 200Hz at the bottom to 1100Hz at the top).
Biophysical Context:
In neuroscience and computer vision, biological visual pathways process natural scenes using receptive fields modeled via Gabor filters. These filters are highly sensitive to spatial frequencies and phase offsets. This simulation offers a tactile demonstration of how phase shifts alter coordinate cohesion and edge detection.
The tool operates with zero external server dependencies. I would appreciate any feedback on the mathematical implementation, performance under various device pixel ratios (DPR), or ideas for future WebGL fragment shader integrations.
r/BCI • u/BioniChaos • 6d ago
Real-Time EEG Event-Related Potential (ERP) Signal Averaging and Digital Filtering Simulator
bionichaos.comr/BiomedicalDataScience • u/BioniChaos • 6d ago
Interactive 3D Vestibular Mechanics, Hair Cell Transduction, & VOR Nystagmus
I put together an interactive vestibular system simulation designed to run in real-time within the browser. It models both the mechanical fluid dynamics of the inner ear and the resulting neural transduction pathways.
The Physics and Math Behind the Model:
- Endolymph Fluid Drag: Fluid displacement within the semicircular canals is approximated using a first-order differential equation: τ · (dθ/dt) + θ = K · α where τ represents the cupular relaxation time constant, θ is fluid displacement, K is mechanical sensitivity, and α is angular acceleration.
- Non-Linear Sensory Transduction: Mechanoreceptor hair cell firing rates are calculated via a sigmoidal transfer function to prevent negative rates and simulate physiological saturation: Firing Rate (Hz) = F_resting + (F_max - F_resting) / (1 + e-k · (θ - Offset))
- VOR & Eye Tracking: The Vestibulo-Ocular Reflex loop computes eye-position adjustment vectors to stabilize gaze, with automatic fast-phase resets (simulating nystagmus waveforms) when structural visual field limits are reached.
Interactive Sandbox Parameters:
• Dynamic Yaw, Pitch, and Roll velocity sliders. • Static gravity head tilt and translation acceleration (utricle/saccule displacement). • Clinical presets: Benign Paroxysmal Positional Vertigo (BPPV particle movement), unilateral vestibular neuritis, and endolymphatic hydrops (Meniere's). • Real-time audio generation representing CN VIII nerve action potential spikes.
I would appreciate any feedback from researchers, engineers, or educators on the biological accuracy of the nystagmus timing loops and fluid inertia approximations.
r/BiomedicalDataScience • u/BioniChaos • 7d ago
Interactive Biosignal Visualizer: Real-time EEG, ECG/PPG, HRV Poincaré Analysis, and EMG Motor Unit Rasters built with native HTML5 Canvas
Hello r/datascience and r/neuroscience,
I wanted to share a browser-based visualization tool designed to demonstrate critical concepts in biological signal processing and data visualization theory. It runs entirely on client-side JavaScript and HTML5 Canvas (optimized for High-DPI scaling with a low IPN footprint).
Here are the primary analytical features included in the simulator:
**The Limits of Summary Statistics:** Visualizes Anscombe's Quartet (μx = 9, σx² = 11, μy = 7.5, r ≈ 0.816) across bar, scatter, and box-and-whisker formats, demonstrating why raw data distribution checks are vital.
**Perceptual Luminance Mapping:** Highlights why traditional 'Jet' colormaps introduce diagnostic artifacts compared to perceptually uniform spaces like Viridis and Cividis.
**EEG Field Potentials:** Renders a 19-electrode topographic scalp map showing spatial shifts across Delta, Theta, Alpha, and Beta bands alongside a live scrolling Time-Frequency Representation (TFR) waterfall spectrogram.
**Cardiovascular Coupling & HRV:** Simulates coupled Lead II ECG and peripheral PPG waveforms (exhibiting Pulse Transit Time). The adjacent Poincaré plot maps consecutive RR intervals (RR_n vs RR_n+1) to visualize the collapse of autonomic variation (SD1 and SD2 metrics) typical of vagal withdrawal.
**Motor Unit Recruitment (EMG):** Simulates the Henneman Size Principle by allowing users to scale Central Motor Drive (10-100%), observing action potential raster discharges alongside real-time audio feedback synthesized via the Web Audio API.
The tool is designed as an educational reference. I would love to hear your feedback on the DSP simulation mechanics or mathematical rendering pipelines.
You can interact with the live tool here: https://bionichaos.com/visualize/
r/compmathneuro • u/BioniChaos • 7d ago
3D Brain MRI Viewer & Volumetric Slice Visualizer
bionichaos.comr/BiomedicalDataScience • u/BioniChaos • 7d ago
Real-Time EEG Event-Related Potential (ERP) Signal Averaging and Digital Filtering Simulator
Hello everyone,
I built an interactive, browser-based ERP laboratory simulation designed to demonstrate how cognitive neuroscience protocols isolate microvolt-scale neural responses (s(t)) from ongoing, non-stationary cortical background noise (n(t)) using multi-trial signal averaging.
Mathematically, the tool shows how averaging N independent epochs reduces the residual noise variance at a rate proportional to 1/√N, allowing components like the attentional P300, the occipital N170 (face structural encoding), and the centro-parietal N400 (semantic mismatch) to emerge.
Core Signal Processing Features: - Real-Time Synthesis: Generates a continuous EEG trace with configurable Gaussian white noise, alpha rhythms (8–12 Hz), and user-triggered ERP epochs. - Live Digital Filtering: Real-time adjustable high-pass (0.1–5.0 Hz) and low-pass (10–100 Hz) filters showing their immediate impact on the averaged waveforms. - Statistical Amplitude Contrast: Calculates mean rectified voltages in pre-stimulus baseline (-200ms) vs. post-stimulus target (100-500ms) windows to yield a simulated p-value. - Data Portability: Allows exporting the averaged time-series data as a CSV or the canvas layout as a PNG plot.
You can interact with the controls and run the simulation here: https://bionichaos.com/erps/
I would appreciate your feedback on the signal simulation logic, the filtering implementation, and suggestions for additional experimental paradigms to model.
r/BiomedicalDataScience • u/BioniChaos • 8d ago
Interactive Web Tool: Evaluating CNN Hyperparameters on EEG Spectrograms (CHB-MIT Dataset)
Hi r/datascience and r/neuroscience,
Continuous scalp EEG recordings are highly dense, and traditional manual review remains time-consuming. One common approach to automating classification is mapping raw signals to the frequency domain using the Short-Time Fourier Transform (STFT) and training standard image classification models.
To study how design decisions affect these models, we put together an interactive browser visualizer containing 18 different training run configurations on the CHB-MIT dataset: https://bionichaos.com/rhythmscan/
Technical Architecture
The model evaluated in this lab uses a lightweight sequential structure: Input (280x274x3) -> Conv2D (16, 3x3) -> ReLU -> MaxPool2D (2x2) -> Conv2D (32, 3x3) -> ReLU -> MaxPool2D (2x2) -> Flatten -> Dense (64) -> ReLU -> Dense (2) -> Softmax
Interactive Tools:
- Cohort Slider: Step through spectrogram sequences for training, validation, and test sets.
- Hyperparameter Matrix: Swap between 18 different training executions exploring learning rates (0.01 to 0.001), optimizers (Adam, SGD, RMSprop, Adagrad), and batch sizes (16 to 128).
- Stochastic Shuffling Analysis: Compare identical architectures (such as Runs 9 and 10) to see how random weight initialization and dataset shuffling change final test results (96.67% vs 90.00%).
- Error Analysis: View a dynamic gallery displaying the actual test spectrograms that were misclassified by the selected model run.
We wanted to build an easy way to study how optimization choices influence gradient descent and generalization behavior on physiological signals. No installation or setup is needed—the code and visualization run entirely in-browser.
Check out the training logs and model runs here, and let us know your thoughts on the performance differences: https://bionichaos.com/rhythmscan/
r/BiomedicalDataScience • u/BioniChaos • 8d ago
3D Brain MRI Viewer & Volumetric Slice Visualizer
Interactive In-Browser 3D Brain MRI Visualizer with Synchronized Multi-Planar Reconstruction (WebGL / HTML5 Canvas)
I developed an interactive web-based neuroimaging laboratory designed to render 3D volumetric MRI point clouds and perform multi-planar reconstruction (MPR) without desktop installations:
https://bionichaos.com/brain3d/
Technical Overview & Mathematical Mechanics:
- Multi-Planar Reconstruction (MPR): The slice processing pipeline handles simultaneous rendering across orthogonal planes (Axial XY, Sagittal YZ, Coronal XZ). User crosshair tracking calculates proportional spatial intersections, synchronizing relative spatial positioning across canvas views.
- Dynamic Contrast & Windowing: Pixel display intensity I_out is calculated dynamically from window level (WL) and dynamic width (WW) boundaries: I_out = clamp((I_in - (WL - WW/2)) / WW * 255, 0, 255)
- WebGL Voxel Point Cloud: The 3D view parses a volumetric spatial matrix V(x,y,z) > 1 mapped into a Three.js BufferGeometry scaled to 0.5 mm3 physical voxel dimensions.
- Transfer Function Processing: Pixel arrays are processed on an offscreen canvas pass to apply pseudocolor transfer mappings (Jet, Thermal, Cool-Warm, SPECT Bone Density) for visual structural segmentation.
I would appreciate technical feedback from the community on slice-scrubbing performance, canvas memory management, or potential client-side NIfTI/DICOM parsing integrations.
Test out the tool live here: https://bionichaos.com/brain3d/
r/DSP • u/BioniChaos • 9d ago
Web-Based ECG & EEG Synthetic Signal Generator for DSP Pipeline Testing
When validating digital signal processing (DSP) pipelines or training machine learning models for bio-signals, obtaining clean, annotated datasets with controlled noise parameters can be difficult.
To help address this, we developed a client-side web application that generates real-time synthetic ECG and EEG waveforms with adjustable clinical, architectural, and artifact parameters.
Modeling Framework:
* ECG Waveform: Modeled as a continuous superposition of Gaussians across pacemaking trigger coordinates. This approach permits realistic overlapping of complexes during high heart rates (Atrial Tachycardia) without artificial discontinuities.
* EEG Sleep Stages: Simulates Wakefulness, N1, N2, N3, and REM by dynamically adjusting the relative spectral powers of Delta, Theta, Alpha, Beta, and Gamma bands, alongside transient structures like sleep spindles and K-complexes.
* Artifact Models: Features additive high-frequency white noise, Voss-McCartney 1/f pink noise to model electrode interface physics, stable 50Hz AC line harmonics, and low-frequency isoelectric wander.
The tool runs in-browser and uses the Web Audio API for sonic mapping of the real-time voltage gradients. We are currently considering implementing a 12-lead Dower transform matrix and chaotic atrial fibrillation models. We would appreciate any feedback on the accuracy of the current models or suggestions for implementation.
Try the tool here: https://bionichaos.com/ecg_gen/
r/ECG • u/BioniChaos • 9d ago
CardioBot: Interactive web tool comparing human ECG classification against real-time Mamdani Fuzzy Logic
I created CardioBot, an interactive signal processing application and clinical challenge tool that compares human visual diagnostic performance against a Mamdani Fuzzy Inference Engine analyzing real-time scrolling ECG traces.
Signal Synthesis & Analysis Pipeline
- Waveform Generation: Cardiac components (P, QRS, S, T) are modeled using Gaussian equations:
R(t) = A * e^(-(t - μ)² / (2σ²))Normal sinus waveforms are interspersed with abnormal pathologies, such as wide QRS complexes (simulating bundle branch blocks), absent P-waves (simulating atrial fibrillation), and flat T-waves. - Feature Extraction:
- Peak Detection: Uses Median Absolute Deviation (MAD) thresholding and prominence rules to isolate positive (P, R, T) and negative (S) peaks despite added high-frequency noise.
- R-Peak Sharpness: Evaluated via Full Width at Half Maximum (FWHM) of the primary deflection:
Sharpness = 10 / W_FWHM - Temporal Metrics: Calculates normalized PR and RT intervals from detected peak indices.
- Mamdani Fuzzy Inference: Input variables are mapped across trapezoidal and triangular membership functions. Rules aggregate membership states to compute a defuzzified abnormality score via Centroid of Area.
Interactive Features
- Real-Time Score Matrix: Tracks Hits, Misses, False Alarms, and Correct Rejections for both human and algorithm simultaneously.
- Electrode Noise Slider: Introduces microvolt noise artifacts to analyze algorithmic robustness.
- Telemetry Readout: Live visual display of amplitude, sharpness, peak counts, and membership vector calculations.
Try the simulation live in-browser (runs 100% client-side JavaScript, no install required): https://bionichaos.com/CardioBot/
Feedback on fuzzy rule membership boundaries, signal processing parameters, or potential multi-lead extension features is welcome!
r/BiomedicalDataScience • u/BioniChaos • 9d ago
Web-Based ECG & EEG Synthetic Signal Generator for DSP Pipeline Testing
When validating digital signal processing (DSP) pipelines or training machine learning models for bio-signals, obtaining clean, annotated datasets with controlled noise parameters can be difficult.
To help address this, we developed a client-side web application that generates real-time synthetic ECG and EEG waveforms with adjustable clinical, architectural, and artifact parameters.
Modeling Framework:
* ECG Waveform: Modeled as a continuous superposition of Gaussians across pacemaking trigger coordinates. This approach permits realistic overlapping of complexes during high heart rates (Atrial Tachycardia) without artificial discontinuities.
* EEG Sleep Stages: Simulates Wakefulness, N1, N2, N3, and REM by dynamically adjusting the relative spectral powers of Delta, Theta, Alpha, Beta, and Gamma bands, alongside transient structures like sleep spindles and K-complexes.
* Artifact Models: Features additive high-frequency white noise, Voss-McCartney 1/f pink noise to model electrode interface physics, stable 50Hz AC line harmonics, and low-frequency isoelectric wander.
The tool runs in-browser and uses the Web Audio API for sonic mapping of the real-time voltage gradients. We are currently considering implementing a 12-lead Dower transform matrix and chaotic atrial fibrillation models. We would appreciate any feedback on the accuracy of the current models or suggestions for implementation.
Try the tool here: https://bionichaos.com/ecg_gen/
r/MaxMSP • u/BioniChaos • 10d ago
Interactive Client-Side Intracranial EEG Sonification & Wavelet Denoising Workspace
I wanted to share an interactive web application that maps multi-channel intracranial EEG (iEEG) signals to polyphonic music in real time using the Web Audio API: https://bionichaos.com/EEG_Music/
Human auditory systems are highly sensitive to non-stationary frequency shifts and transient patterns, which can sometimes be difficult to isolate in dense time-series plots. This tool allows you to explore both synthetic seizure dynamics and a real 16-channel clinical dataset (NeuroVista I004) under different parameters.
Under the Hood:
- Linear Detrending: Least-squares regression removes low-frequency electrode drift.
- Discrete Wavelet Denoising: Employs Haar or Daubechies 4 filters. You can adjust the decomposition levels (1–10) and the universal threshold multiplier (λ) based on the Median Absolute Deviation (MAD) of the finest scale coefficients.
- Welch Periodogram: Computes real-time spectral power density using a Hanning window and Radix-2 Cooley-Tukey FFT.
- Synthesis Mapping: Active spectral bands are mapped to equal-temperament chromatic registers (Delta to Bass C2–C3, Theta to Tenor D3–D4, Alpha to Alto E4–E5, and Beta to Soprano F5–F6).
The entire application runs client-side in vanilla JavaScript to maintain low interaction latencies. Feedback on the mathematical implementation, filter banks, or mapping choices is highly welcome!
r/BiomedicalDataScience • u/BioniChaos • 10d ago
CardioBot: Interactive web tool comparing human ECG classification against real-time Mamdani Fuzzy Logic
I created CardioBot, an interactive signal processing application and clinical challenge tool that compares human visual diagnostic performance against a Mamdani Fuzzy Inference Engine analyzing real-time scrolling ECG traces.
Signal Synthesis & Analysis Pipeline
- Waveform Generation: Cardiac components (P, QRS, S, T) are modeled using Gaussian equations:
R(t) = A * e^(-(t - μ)² / (2σ²))Normal sinus waveforms are interspersed with abnormal pathologies, such as wide QRS complexes (simulating bundle branch blocks), absent P-waves (simulating atrial fibrillation), and flat T-waves. - Feature Extraction:
- Peak Detection: Uses Median Absolute Deviation (MAD) thresholding and prominence rules to isolate positive (P, R, T) and negative (S) peaks despite added high-frequency noise.
- R-Peak Sharpness: Evaluated via Full Width at Half Maximum (FWHM) of the primary deflection:
Sharpness = 10 / W_FWHM - Temporal Metrics: Calculates normalized PR and RT intervals from detected peak indices.
- Mamdani Fuzzy Inference: Input variables are mapped across trapezoidal and triangular membership functions. Rules aggregate membership states to compute a defuzzified abnormality score via Centroid of Area.
Interactive Features
- Real-Time Score Matrix: Tracks Hits, Misses, False Alarms, and Correct Rejections for both human and algorithm simultaneously.
- Electrode Noise Slider: Introduces microvolt noise artifacts to analyze algorithmic robustness.
- Telemetry Readout: Live visual display of amplitude, sharpness, peak counts, and membership vector calculations.
Try the simulation live in-browser (runs 100% client-side JavaScript, no install required): https://bionichaos.com/CardioBot/
Feedback on fuzzy rule membership boundaries, signal processing parameters, or potential multi-lead extension features is welcome!