▲ 7 r/DSP

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/

bionichaos.com
u/BioniChaos — 16 days ago
▲ 1 r/ECG

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

  1. 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.
  2. 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.
  3. 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!

u/BioniChaos — 16 days ago
▲ 9 r/MaxMSP

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:

  1. Linear Detrending: Least-squares regression removes low-frequency electrode drift.
  2. 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.
  3. Welch Periodogram: Computes real-time spectral power density using a Hanning window and Radix-2 Cooley-Tukey FFT.
  4. 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!

u/BioniChaos — 17 days ago

Non-Contact Respiration Monitoring: Fusing Motion & Thermal Data for Physiological Signal Extraction

When building non-contact health monitoring systems, isolating respiratory components from standard video feeds presents a significant challenge. By leveraging pixel-flow decomposition and advanced optical flow, it's possible to filter out background noise and calculate the respiratory angle. This method allows for accurate pose estimation without traditional body skeleton mapping, working effectively even if the subject is covered by a blanket.

Additionally, there's a fascinating bio-signal hack for low-resolution thermal imaging: utilizing a standard facial mask as a thermal amplifier to concentrate heat changes. This allows cheap sensor arrays to reliably monitor breathing depth, rhythm, and classify nose versus mouth breathing using feature descriptors.

If you're interested in the intersection of computer vision, signal processing, and biomedical engineering, check out the full breakdown of the methodology here: https://youtu.be/jP0y8SuOVmU

youtu.be
u/BioniChaos — 1 month ago
▲ 2 r/AffinityPhoto+1 crossposts

Lilac Chaser Illusion: The Importance of Color Saturation and Alpha Values in Browser-Based Visual Perception

When implementing visual perception experiments in a browser environment, minor discrepancies in CSS values can completely disrupt cognitive phenomena like Troxler fading and negative afterimages.

We analyzed a digital version of the Lilac Chaser (Pac-Man) illusion where the visual effect failed to trigger. By adjusting the implementation from high-saturation purples to softer pastel values (such as #d8bfd8 with 0.45 alpha transparency), we allowed the stimulus to blend correctly with the background. Additionally, we corrected the script logic so the moving gap functions as a disappearing element matching the background, rather than a color-swapping element.

For those interested in the code adjustments and the underlying visual neuroscience, the full walk-through is available here: https://youtu.be/iQOVVnozkjA

How have you handled precise visual calibration or stimulus presentation in your own browser-based cognitive experiments?

youtu.be
u/BioniChaos — 1 month ago

Optimizing a gesture classification ML pipeline using automated feature selection and soft voting ensembles (XGBoost, LightGBM, RF)

I recently went through the process of optimizing a gesture classification model and wanted to share the workflow. The main focus is on automating feature selection—specifically parsing a dynamically generated JSON file to drop features with zero importance scores before training.

After cleaning up the feature space, the next step is analyzing the confusion matrix and F1 scores to identify underperforming classes. To push the accuracy higher (targeting an F1 of 0.898+), I implement a soft voting ensemble combining XGBoost, LightGBM, and Random Forest.

If you're dealing with noisy biometric or sensor data, this pipeline approach might be useful for your projects. You can watch the full terminal session and code walkthrough here: https://youtu.be/PDYT7f3BDqQ

I'd love to hear your thoughts on soft vs. hard voting for this type of multiclass sensor data!

youtu.be
u/BioniChaos — 2 months ago