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
  • Update the LICENSE copyright line — it still reads Copyright (c) 2018 Computational Auditory Perception Research Group. Decide between an institutional or named-individual form, confirm with the listed authors, and refresh the year (and optionally add an explicit MIT License header line)
  • 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.0rc0.tar.gz (40.9 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.0rc0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sing4me-2.0.0rc0.tar.gz
  • Upload date:
  • Size: 40.9 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.0rc0.tar.gz
Algorithm Hash digest
SHA256 5b53b78fb5f261fab27e9168c4b8f1d581eec79dbdd97822cfe6a2d6d791d178
MD5 7cc3da03e1f4e6348d2803b36d278785
BLAKE2b-256 02c18b32e0c25acf3a9ded7e9169115f50a5f2ceea5f3f7085d8e45b7d689617

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sing4me-2.0.0rc0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 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.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 88411f121c0f4a2aef35ac40e72e78b77d6a429cf2a1121addc549bd811c623f
MD5 0bf80d239c0401ab1f91c805731e33a9
BLAKE2b-256 72484f822d09f820462a5a4166c84d1ff338a99e77947ef6a87fe2980e4b4a86

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