Musical Gestures Toolbox for Python
Project description
MGT-python
The Musical Gestures Toolbox for Python is a collection of tools for visualizing and analysing audio and video files.
Quick Start
Installation
pip install musicalgestures
musicalgestures installs its core Python dependencies automatically. You still need a working ffmpeg installation on your system for video processing.
Basic Usage
import musicalgestures as mg
# Load a video (mp4, avi, mov, … all supported)
v = mg.MgVideo('dance.mp4')
# Create visualizations — call .show() to display the result
v.grid().show()
v.videograms().show()
v.average().show()
v.history().show()
v.heatmap().show() # where the video changes most
# Motion analysis
v.motion().show()
v.motiontempo().show() # dominant movement tempo (Hz/BPM)
v.eulerian(mode='motion').show() # amplify subtle motion (EVM)
# Audio analysis
v.audio.waveform().show()
v.audio.spectrogram().show()
v.audio.mfcc().show()
v.audio.tempo().show() # tempo + beat tracking
v.sonomotiongram().show() # sonify the motiongram
# Pose estimation (MediaPipe is GPU-capable on the standard pip OpenCV)
v.pose(model='mediapipe').show()
Display happens via
.show()— analysis methods return result objects (MgVideo/MgImage/MgFigure) and do not auto-render.
Runtime Notes
ffmpegis required for video I/O and preprocessing.pose()downloads OpenPose weights on first use if they are missing.- In notebooks and other non-interactive runs, missing pose weights are downloaded automatically when possible.
- If
device='gpu'is requested but OpenCV CUDA support is unavailable,pose()falls back to CPU execution. flow.dense(),flow.sparse(), andblur_faces()use CPU by default (use_gpu=False). Setuse_gpu=Trueto opt into CUDA acceleration with automatic CPU fallback.get_cuda_device_count()is available to quickly check whether OpenCV sees CUDA devices.blur_faces()returns the generated result object consistently, including whensave_data=True.
Try Online
Quick Links
Features
- Video Analysis: Motion detection, optical flow, motion vectors, movement tempo, Eulerian Video Magnification
- Pose Estimation: MediaPipe (GPU-capable) and OpenPose backends, with average-pose and trajectory summaries (per-marker quantity of motion + dominant frequency)
- Audio Processing: Waveforms, spectrograms, MFCC, chromagrams, tempo/beat tracking, spectral descriptors
- Visualizations: Motiongrams, videograms, motion history, heatmaps, sonomotiongrams (motion → sound)
- Space-time displays: Stroboscope (chronophotography), silhouette waterfall, Motion History Image, 3D space-time volume, combined motion SSM
- Integration: Works with NumPy, SciPy, librosa, and Matplotlib ecosystems
- Cross-platform: Linux, macOS, Windows support
Presentation
See this short video presentation made for the Nordic Sound and Music Computing Conference 2021:
Requirements
- Python 3.10+
- FFmpeg
- See installation guide for complete requirements
Research Background
This toolbox builds on the Musical Gestures Toolbox for Matlab, which again builds on the Musical Gestures Toolbox for Max. Many researchers and research assistants have helped its development over the years, including Balint Laczko, Joachim Poutaraud, Frida Furmyr, Marcus Widmer, Alexander Refsum Jensenius
The software is currently maintained by the fourMs lab at RITMO Centre for Interdisciplinary Studies in Rhythm, Time and Motion at the University of Oslo.
Reference
If you use this toolbox in your research, please cite this article:
- Laczkó, B., & Jensenius, A. R. (2021). Reflections on the Development of the Musical Gestures Toolbox for Python. Proceedings of the Nordic Sound and Music Computing Conference, Copenhagen.
@inproceedings{laczkoReflectionsDevelopmentMusical2021,
title = {Reflections on the Development of the Musical Gestures Toolbox for Python},
author = {Laczkó, Bálint and Jensenius, Alexander Refsum},
booktitle = {Proceedings of the Nordic Sound and Music Computing Conference},
year = {2021},
address = {Copenhagen},
url = {http://urn.nb.no/URN:NBN:no-91935}
}
License
This toolbox is released under the GNU General Public License 3.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file musicalgestures-1.4.7.tar.gz.
File metadata
- Download URL: musicalgestures-1.4.7.tar.gz
- Upload date:
- Size: 52.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebcbb22ee345b1a852cc32c250d68fe9367fb5954f522830c5d9ef433911094f
|
|
| MD5 |
2767ba747f2965c365ebacf5b5508165
|
|
| BLAKE2b-256 |
264f65d0dac4e730e99e9360b02381a5b44aa3faf1873d60e2b3d7f4f5ded7f8
|
Provenance
The following attestation bundles were made for musicalgestures-1.4.7.tar.gz:
Publisher:
pypi-publish.yml on fourMs/MGT-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
musicalgestures-1.4.7.tar.gz -
Subject digest:
ebcbb22ee345b1a852cc32c250d68fe9367fb5954f522830c5d9ef433911094f - Sigstore transparency entry: 1979737895
- Sigstore integration time:
-
Permalink:
fourMs/MGT-python@fc55c3473cc941bf68c1d212bc4cbe157bca2c68 -
Branch / Tag:
refs/tags/v1.4.7 - Owner: https://github.com/fourMs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@fc55c3473cc941bf68c1d212bc4cbe157bca2c68 -
Trigger Event:
release
-
Statement type:
File details
Details for the file musicalgestures-1.4.7-py3-none-any.whl.
File metadata
- Download URL: musicalgestures-1.4.7-py3-none-any.whl
- Upload date:
- Size: 52.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d925dfaa7fa1165396866ae88f28b72354e686c89b9879ea255f2ad8ab9513b6
|
|
| MD5 |
c6ecbc7d505665d025c92e99ffa1aa6a
|
|
| BLAKE2b-256 |
b890c5483e0ac3c76c0aaabe97a47866e3a52d4ce588bfbaf0737b4cc682ae13
|
Provenance
The following attestation bundles were made for musicalgestures-1.4.7-py3-none-any.whl:
Publisher:
pypi-publish.yml on fourMs/MGT-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
musicalgestures-1.4.7-py3-none-any.whl -
Subject digest:
d925dfaa7fa1165396866ae88f28b72354e686c89b9879ea255f2ad8ab9513b6 - Sigstore transparency entry: 1979738282
- Sigstore integration time:
-
Permalink:
fourMs/MGT-python@fc55c3473cc941bf68c1d212bc4cbe157bca2c68 -
Branch / Tag:
refs/tags/v1.4.7 - Owner: https://github.com/fourMs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@fc55c3473cc941bf68c1d212bc4cbe157bca2c68 -
Trigger Event:
release
-
Statement type: