A lightweight Python application for real-time ECG (Electrocardiogram) signal visualization from audio input.
PythonECG is a simple desktop application that allows you to visualize ECG machine signals captured from your computer's audio input. It's designed to be minimalist and focuses solely on real-time visualization.
This tool can be used for:
- Educational demonstrations of signal processing
- Testing audio input devices
- Visualizing audio waveforms in a medical-style display
- Prototyping ECG-related applications
- Real-time audio signal visualization with ECG-like display, simply connect your ecg using cro output to pc soundcard
- Simple toggle button to start/stop signal tracing
- Automatic scaling to show the last 10 seconds of data
- Clean, medical-inspired interface with grid lines
- Python 3.6+
- NumPy
- Matplotlib
- PyAudio
- Tkinter (usually comes with Python)
-
Clone this repository:
git clone https://github.com/yourusername/pythonecg.git cd pythonecg -
Install required dependencies:
pip install numpy matplotlib pyaudio -
Run the application:
python ecgbasic.py
- Connect an ecg machine cro output to your computer (microphone, line-in, etc.)
- Launch the application
- Click "Start Tracing" to begin visualizing the audio signal
- Click "Stop Tracing" to halt the visualization
The application captures audio from your system's input device at a sampling rate of 44.1kHz. This raw audio data is then plotted in real-time to create an ECG-like visualization. The display shows a 10-second window that automatically scrolls as new data comes in.
- Sampling rate: 44.1kHz
- Bit depth: 16-bit
- Single channel (mono) input
- Window size: 10 seconds
This is a simplified version of a more comprehensive ECG application. If you need additional features such as recording, file operations, or settings adjustment, you can extend this codebase as needed, or sponsor me and we hit sustainable sponsorship i will release a full featured version which includes tons of features, automatic diagnostics, recording, patient info input, lots more.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
This license:
- Allows users to use, modify, and distribute the software
- Requires any modified versions to be distributed under the same license
- Requires source code to be made available when the software is used over a network
- Makes it difficult to use the code in proprietary commercial applications without explicit permission
For more details: https://www.gnu.org/licenses/agpl-3.0.en.html
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- This project was inspired by medical visualization tools
- Thanks to the PyAudio, NumPy, and Matplotlib communities for their excellent libraries


