Skip to main content

Python package for online and laboratory singing experiments

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sing4me-2.0.0.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sing4me-2.0.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file sing4me-2.0.0.tar.gz.

File metadata

  • Download URL: sing4me-2.0.0.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sing4me-2.0.0.tar.gz
Algorithm Hash digest
SHA256 01676a8ea5adde1ce838091d416499a911c9da8bcadc33778be8971445bbf0d1
MD5 9c37fa71de7e799d2656afb651923bcf
BLAKE2b-256 863129f68588c35d11ccf0d5492bd1430fc7c3f050ec292b0da303b2682bbc9e

See more details on using hashes here.

File details

Details for the file sing4me-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: sing4me-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sing4me-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d54064ffbfe5961557d9aa223189e0ef8add0dff10cb1e17491f10cd10e07e0
MD5 628aa094a15643680dfd30724f930eea
BLAKE2b-256 72a8411aa162834d0b966c63c0713489c024f7c4abaa1038e7e7d8126343d1b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page