Skip to main content

sing4me — Singing Experiments

Logo

Manuel Anglada-Tort, Peter Harrison, and Nori Jacoby
Computational Auditory Perception Group
Max Planck Institute for Empirical Aesthetics

sing4me is a Python package for singing extraction, optimized for laboratory and online singing experiments. It provides signal-processing code for sung-pitch extraction, plus a bundled Praat syllable_extract.praat script for syllable / rhythm extraction.

Quick Links

Citation

Please cite this package if you use it:

Anglada-Tort, M., Harrison, P. M., Lee, H., & Jacoby, N. (2023). Large-scale iterated singing experiments reveal oral transmission mechanisms underlying music evolution. https://doi.org/10.1016/j.cub.2023.02.070

Analysis code and datasets supporting the paper (2023): https://doi.org/10.17605/OSF.IO/UANGD

Installation

Prerequisites

  • Python 3.9 or newer (tested with 3.9–3.13)
  • macOS (primary testing platform)

Setting up a Virtual Environment

pip3 install virtualenv virtualenvwrapper

export WORKON_HOME=$HOME/.virtualenvs
mkdir -p $WORKON_HOME
export VIRTUALENVWRAPPER_PYTHON=$(which python3)
source $(which virtualenvwrapper.sh)

mkvirtualenv sing4me --python $(which python3)

The virtual environment is now active. To activate it later:

workon sing4me

Installing sing4me

To install the published package from PyPI:

pip install sing4me

To install from a source checkout in editable mode (this also installs the runtime dependencies declared in pyproject.toml):

git clone git@gitlab.com:computational-audition/sing4me.git
cd sing4me
pip install -e .

Optional extras:

  • dev — flake8, black
  • notebook — jupyter, sounddevice, soundfile (needed for the demo notebooks)
  • publish — build, twine (only needed if you intend to build and upload a release to PyPI)

Install an extra with, e.g.:

pip install -e ".[notebook]"

Verify installation

sing4me --version

Running Demos

The demo notebooks in demos/ rely on the local input/ directory of sample audio. Those audio assets are not shipped with the PyPI distribution — clone the repository if you want to run the demos:

git clone git@gitlab.com:computational-audition/sing4me.git
cd sing4me
pip install -e ".[notebook]"
jupyter notebook

Then open one of:

  • demos/singing_demo.ipynb
  • demos/debug_singing_extract.ipynb

Sample Audio

The directory sing4me/tests/ in the source checkout contains a large collection of sample .wav / .png / .txt files used for manual / pilot inspection. Those samples are kept in the repository for development but are not shipped with the PyPI distribution (they would exceed PyPI's per-file limits). To use them, work from a source checkout.

A simple helper called generate_pilot_analysis_suite will generate plots and analysis for a directory of recordings:

generate_pilot_analysis_suite(
    audio_dir=os.path.dirname(here) + "/tests/good_2int/",
)

License

MIT License

Future Improvements

  • Rename / clean up sing4me/tests/test_sing4me.py — it is a misleadingly-named manual debug script, not a real pytest test
  • Add a tag-triggered PyPI publish job to the GitLab CI pipeline (using PyPI Trusted Publishing) so releases don't need to be uploaded from a developer's local venv
  • Automate creation of a GitLab Release (with changelog and built artifacts) on every tagged version
  • Add type hints and a py.typed marker
  • Add code-formatting and linting configuration (black/ruff/flake8)
  • Add CONTRIBUTING.md and CODE_OF_CONDUCT.md

Metadata

Release files for sing4me 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sing4me 2.0.0
File Size Uploaded
sing4me-2.0.0.tar.gz 41.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sing4me 2.0.0
File Interpreter ABI Platform
sing4me-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 64.3 kB

Release files / sing4me-2.0.0.tar.gz

Download URL sing4me-2.0.0.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
01676a8ea5adde1ce838091d416499a911c9da8bcadc33778be8971445bbf0d1
BLAKE2b-256 checksum
How to use checksums
863129f68588c35d11ccf0d5492bd1430fc7c3f050ec292b0da303b2682bbc9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / sing4me-2.0.0-py3-none-any.whl

Download URL sing4me-2.0.0-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d54064ffbfe5961557d9aa223189e0ef8add0dff10cb1e17491f10cd10e07e0
BLAKE2b-256 checksum
How to use checksums
72a8411aa162834d0b966c63c0713489c024f7c4abaa1038e7e7d8126343d1b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page