Skip to content

WolfExplode/bpm_analysis

Repository files navigation

English | 日本語

Heartbeat BPM Analyzer

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.

GUI Interface:

You only need to generate the heart rate graph but there are other options in case you need more information

image

Watch the video|857x482

Spectrogram View:

This script includes a spectrogram view for debugging but it is very slow to generate brave_ykQQ36DQv

Heartbeat BPM Analyzer

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.

GUI Interface:

You only need to generate the heart rate graph but there are other options in case you need more information

image

Watch the video|857x482

Spectrogram View:

This script includes a spectrogram view for debugging but it is very slow to generate brave_ykQQ36DQv

Configuration

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.

Dependencies

To run this script, you will need Python and the following libraries:

  • numpy
  • pandas
  • scipy
  • plotly
  • ttkbootstrap
  • pydub
  • soxr
  • librosa (handles audio loading and resampling)
  • PyWavelets (provides the pywt module used for wavelet denoising)
  • pyPCG-toolbox (enables optional, tunable pyPCG denoising; the feature is only active when you configure denoising_method in config.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.

How to Run

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

Extra Features:

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

Import BlenderAsj3vbrst4v

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
Place BlenderAsj3zdst4v Adjust BlenderAsj3zny4v

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

About

heartbeat bpm analysis from audio file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •