Skip to main content

PyPI version PyPI Python versions pre-commit.ci status GitHub CI status License Binder

thebeat logo

thebeat: Rhythms in Python for Science

thebeat is a Python package for working with temporal sequences and rhythms in the behavioural and cognitive sciences. It provides functionality for creating stimuli, and for visualizing and analyzing temporal data.

As a collection of accepted methods for use in music and timing research, thebeat will save you time when creating experiments or analyzing data.

thebeat is an open-source, on-going, and collaborative project, integrating easily with the existing Python ecosystem, and with your own scripts. The package was specifically designed to be useful for both skilled and novice programmers.

Documentation

The package documentation is available from https://thebeat.readthedocs.io. The documentation contains detailed descriptions of all package functionality, as well as a large number of (copyable) examples.

Installation

thebeat is available through PyPI, and can be installed using:

pip install thebeat

Note that if you want to use thebeat's functionality for plotting musical notation, you have to install it using:

pip install 'thebeat[music-notation]'

This will install thebeat with the optional dependencies abjad and Lilypond.

thebeat is actively tested on Linux, macOS, and Windows. We aim to provide support for all supported versions of Python (3.10 and higher).

Try directly via Binder

If you first would like to try thebeat, or of you wish to use it in, for instance, an educational setting, you can use this link to try thebeat in a Binder environment.

Getting started

The code below illustrates how we might create a simple trial for use in an experiment:

from thebeat import Sequence, SoundStimulus, SoundSequence

seq = Sequence.generate_isochronous(n_events=10, ioi=500)
sound = SoundStimulus.generate(freq=440, duration_ms=50, onramp_ms=10, offramp_ms=10)
trial = SoundSequence(sound, seq)

trial.play()  # play sound over loudspeakers
trial.plot_waveform()  # plot as sound waveform
trial.plot_sequence()  # plot as an event plot
trial.write_wav('example_trial.wav')  # save file to disk

Open discussion

One of the reasons for creating thebeat was the lack of a collection of standardized/accepted methods for use in rhythm and timing research. Therefore, an important part of thebeat's merit lies in opening discussions about the methods that are included. As an example, there are different ways of calculating phase differences and integer ratios, and we imagine people to have different opinions about which method to use. Where possible, we have included references to the literature in the package documentation. But, we encourage anyone with an opinion to openly question the methods that thebeat provides.

There are two places where you can go with comments and/or questions:

  • You can click the 'Issues' tab at the top of this GitHub page, and start a thread. Note that this place is mostly for questioning methods, or for reporting bugs.
  • You can drop by in our Gitter chatroom. This is likely the best place to go to with questions about how thebeat works.

License

thebeat is distributed under the GNU General Public License, version 3 or later. You are free to distribute or modify the code, both for non-commercial and commercial use. See here for more info.

Acknowledgements

The package was initially developed by the Comparative Bioacoustics Group at the Max Planck Institute for Psycholinguistics, in Nijmegen, the Netherlands. It is currently maintained by the same group at Sapienza University of Rome, Italy.

The collaborators are Jelle van der Werff, Andrea Ravignani, and Yannick Jadoul.

thebeat was described in an article in Behavior Research Methods:

van der Werff, J., Ravignani, A., & Jadoul, Y. (2024). thebeat: A python package for working with rhythms and other temporal sequences. Behavior Research Methods, 56(4), 3725–3736. https://doi.org/10.3758/s13428-023-02334-8

Check out the documentation for more details on citing thebeat.

Metadata

Release files for thebeat 0.3.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 thebeat 0.3.0
File Size Uploaded Provenance Actions
thebeat-0.3.0.tar.gz 8.0 MB Without provenance Details for thebeat-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 8.1 MB

Release files / thebeat-0.3.0.tar.gz

Download URL thebeat-0.3.0.tar.gz
Size 8.0 MB
Tags Source
SHA-256 checksum
How to use checksums
36e3992f7b0dd4ed99ff3e48a6ecdc3676f7b2d11c9314917b6d18c11c7ffd04
BLAKE2b-256 checksum
How to use checksums
0c4b97929811a39f57ae285f602261378d01c9f40ed0fdbe3200619a5578c631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / thebeat-0.3.0-py3-none-any.whl

Download URL thebeat-0.3.0-py3-none-any.whl
Size 118.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6f7bc69dd7c3eef08608b3735f92abe272df556bd959a3f0fdd8d45b7150354
BLAKE2b-256 checksum
How to use checksums
3361342237ded8447e59708784211e2b8938f463f99f1b4267c4b88e854eed83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for thebeat 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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