EMG-GUI
A high-performance, multithreaded, real-time visualization engine for acquiring, recording, and exploring raw and filtered EMG signals from OpenBCI boards.
1. Overview
1.1 Installation
EMG-GUI can be installed from pypi using pip:
pip install emg-gui
1.2 How to Run
TODO
2. Architecture and Project Structure
2.1 Architecture
The application separates sensor acquisition, interface controls, signal processing, and GPU rendering. Sensor polling and board stream control run on a dedicated thread, while Qt interface updates, filtering, and ModernGL rendering currently run on the main thread.
EMG GUI
├── app.py
├── Acquisition
│ ├── DataSource
│ └── SensorWorker
│ └── RingBuffer
├── UI
│ ├── EMGVisualizerWindow
│ └── EMGControlPanel
├── Processing
│ ├── EMG filtering
│ └── Window functions
└── Visualization
├── EMGOpenGLWidget
├── TimeSeriesRenderer
├── SpectrogramRenderer
├── TicksRenderer
└── TextRenderer
The DataSource provides hardware-independent acquisition from either an
OpenBCI board or a playback recording. The current application entry point uses
OpenBCIBoard by default, with playback available as an alternate source.
SensorWorker reads EMG samples into a fixed-size ring buffer, and
EMGOpenGLWidget owns duplicate-snapshot checks, snapshot filtering, and
ModernGL rendering. TimeSeriesRenderer and SpectrogramRenderer are connected
to the live rendering path. Channel counts come from the selected data source,
so synthetic and real boards can expose different numbers of EMG channels. The
display window is sample-based, while the rendered layout is derived from the
OpenGL widget size and the selected EMG channel count.
See the architecture guide for the detailed component hierarchy, data flow, and thread interaction sequences.
2.2 Directory Layout
Inside this project, you'll see the following folders and files:
/
├── docs/
│ ├── diagrams/
│ │ ├── Ability_Logo.svg
│ │ ├── current-filter-frequency-response.png
│ │ └── interface-contracts.svg
│ └── architecture.md
├── src/
│ └── emg_gui/
│ ├── app.py
│ ├── acquisition/
│ │ ├── data_source.py
│ │ ├── dataset_files.py
│ │ └── sensor_worker.py
│ ├── config/
│ │ ├── constants.py
│ │ └── Roboto-Black.ttf
│ ├── core/
│ │ ├── enums.py
│ │ ├── logger.py
│ │ └── types.py
│ ├── processing/
│ │ ├── filter.py
│ │ └── window_functions.py
│ ├── ui/
│ │ ├── control_panel.py
│ │ └── window.py
│ └── visualizer/
│ ├── shaders/
│ │ ├── shader_loader.py
│ │ ├── spec/
│ │ │ ├── vertex.glsl
│ │ │ └── fragment.glsl
│ │ ├── text/
│ │ │ ├── vertex.glsl
│ │ │ └── fragment.glsl
│ │ ├── ticks/
│ │ │ ├── vertex.glsl
│ │ │ └── fragment.glsl
│ │ └── time_series/
│ │ ├── vertex.glsl
│ │ └── fragment.glsl
│ ├── open_gl_widget.py
│ ├── spectrogram_renderer.py
│ ├── text_renderer.py
│ ├── ticks_renderer.py
│ └── time_series_renderer.py
├── tests/
├── CONTRIBUTING.md
├── pyproject.toml
└── README.md
2.3 Planned Live Frequency-Domain View
A future interface will add a live frequency-domain view rendered with ModernGL, using the same GPU-based approach as the raw and filtered EMG time-series view. The interface will show one selected EMG channel at a time with:
- raw and filtered Welch power spectral density (PSD) curves;
- an attenuation curve calculated from the filtered and raw PSDs;
- frequency and decibel axes, a channel selector, and a raw/filtered legend.
The existing filtering path will continue to run only once per snapshot. The raw and filtered arrays will then be shared by the time-domain and frequency-domain renderers. Welch calculations should be vectorized across channels, performed only for new snapshots, and throttled to approximately 5–10 updates per second so they do not delay the main Qt/OpenGL render loop. The resulting frequency and power values will be uploaded to dynamic ModernGL buffers and drawn as line strips using the existing line-shader approach.
The following white-noise measurement is a development reference for the current filter configuration at a 250 Hz sampling rate with 50 Hz mains-noise removal. The planned live interface should present the same two relationships: raw versus filtered PSD and attenuation by frequency.
3. Contributing
Contributions are welcome! See the contributing guide for development and linting guidelines.
4. Acknowledgements
4.1 BrainFlow
This project uses BrainFlow for biosignal acquisition and hardware integration. BrainFlow provides a uniform API for acquiring, parsing, and analyzing EEG, EMG, ECG, and other biosensor data across a wide range of supported boards, including OpenBCI devices. BrainFlow is distributed under the MIT License.
4.2 ModernGL Spectrogram
This project uses nickcercone/spectrogram as a reference for parts of its ModernGL spectrogram rendering implementation. The referenced project demonstrates real-time audio spectrogram visualization using ModernGL and is distributed under the MIT License.
4.3 Text Rendering
This project adapts the code in How to render text with PyOpenGL? by exiled (question) and Rabbid76 (answer) for its ModernGL text renderer. The referenced contributions demonstrate text rendering with PyOpenGL and are distributed under the CC BY-SA 4.0 License.
5. Tech Debt
- Add setup and installation instructions to this readme.
- Create new repo-emg-ability.
- Folder portability use EMGFlow & system path reference.
- Add legends for raw and filtered emg in timeseries renderer.
- Processing latency in the performance metrics.
- Improve the GUI toggle controls and expose their options in the left sidebar.
- Add timer and countdown visualizations.
- Move signal processing from the GUI thread to a dedicated processing thread.
- Move the complete data-source lifecycle into the sensor thread, including initialization, streaming, recording, stopping, and release.
- Implement the live ModernGL frequency-domain view.
Metadata
Release files for emg-gui 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| emg_gui-0.1.6.tar.gz | 2.4 MB | With provenance | Details for emg_gui-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| emg_gui-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for emg_gui-0.1.6-py3-none-any.whl |
Total release size: 4.8 MB
Release files / emg_gui-0.1.6.tar.gz
| Download URL | emg_gui-0.1.6.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1faee3b31dc9aabdf2e343472c9098919452fa1a74d408054f40cff16d1e99a
|
|
BLAKE2b-256 checksum How to use checksums |
d8b5c11786186dadc598e04a1a882d50d0099b9020851924c908f541b7d298de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / emg_gui-0.1.6-py3-none-any.whl
| Download URL | emg_gui-0.1.6-py3-none-any.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2be6547c8fcb8903f2d852b4f51d143c1ea01f75eb5fe2496b4d870ddbdb022b
|
|
BLAKE2b-256 checksum How to use checksums |
757a0a4dab6410f91e094343e9d684897754c69e3d89e89b8d4705373d19c1b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for emg-gui 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for emg_gui-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.