This tool is a heuristic based algorithm for phonocardiogram (PCG) Analysis. It analyzes audio recordings of heart sounds to detect heartbeats and graphs the Beats Per Minute (BPM) over time.
You only need to generate the heart rate graph but there are other options in case you need more information
This script includes a spectrogram view for debugging but it is very slow to generate

This tool is a heuristic based algorithm for phonocardiogram (PCG) Analysis. It analyzes audio recordings of heart sounds to detect heartbeats and graphs the Beats Per Minute (BPM) over time.
You only need to generate the heart rate graph but there are other options in case you need more information
This script includes a spectrogram view for debugging but it is very slow to generate

All tunable parameters for the bpm_analysis.py engine are located in config.py
The parameters are organized into logical categories for easier navigation and tuning.
- Multi-Format Audio Support: Accepts most common media files such as WAV, MP3, M4A, MOV, by converting them to .wav format for analysis.
All tunable parameters for the bpm_analysis.py engine are located in config.py
The parameters are organized into logical categories for easier navigation and tuning.
- Multi-Format Audio Support: Accepts most common media files such as WAV, MP3, M4A, MOV, by converting them to .wav format for analysis.
To run this script, you will need Python and the following libraries:
numpypandasscipyplotlyttkbootstrappydubsoxrlibrosa(handles audio loading and resampling)PyWavelets(provides thepywtmodule used for wavelet denoising)pyPCG-toolbox(enables optional, tunable pyPCG denoising; the feature is only active when you configuredenoising_methodinconfig.py)
Install FFmpeg: Follow the installation instructions for your operating system from the official FFmpeg website.
Install FFmpeg: Follow the installation instructions for your operating system from the official FFmpeg website.
You will also need FFmpeg installed and accessible in your system's PATH for pydub to function correctly.
- Double check to make sure you have Microsoft Visual C++ Redistributable Latest supported v14 (for Visual Studio 2017–2026)
Install Dependencies:
pip install numpy pandas scipy plotly ttkbootstrap pydub librosa PyWavelets pyPCG-toolbox
Run the Script via cmd prompt from the same directory:
python main.py
Tip: you can rename the file to main.pyw to avoid using cmd prompt. Just double click it to launch like a .exe file
Import the generated heart rate graph into Blender to easily calculate the change in bpm over time. Blender file and scripts are located in Blender BPM tool folder
Select the Geometry Nodes object and enter edit mode. This will allow you to calculate:
- Heart Rate Recovery (HRR)
- maximal rate of heart rate increase
You can also make any BPM/Time graph and export it out of blender using the Export graph data.py script
Import any CSV file with format: Time(Seconds), Beats Per Minute
