Skip to main content

Python package for working with rhythms and other temporal sequences in science

Project description

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.8 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 GPL-3 license. You are free to distribute or modify the code, both for non-commercial and commercial use. See here for more info.

Collaborators

The package was developed by the Comparative Bioacoustics Group at the Max Planck Institute for Psycholinguistics, in Nijmegen, the Netherlands.

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

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

thebeat-0.2.0.tar.gz (10.0 MB view details)

Uploaded Source

Built Distribution

thebeat-0.2.0-py3-none-any.whl (118.4 kB view details)

Uploaded Python 3

File details

Details for the file thebeat-0.2.0.tar.gz.

File metadata

  • Download URL: thebeat-0.2.0.tar.gz
  • Upload date:
  • Size: 10.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for thebeat-0.2.0.tar.gz
Algorithm Hash digest
SHA256 53b8f34bb6d07e85983a9b1df097203968d060a0fe21540afd164a01bd2dc4f1
MD5 6c88d214282b99143762623e8e631d9f
BLAKE2b-256 cfc6ee777b43a2b2b5eca46b34ee7845b9faad6df9fffb7b7438b14e84488e50

See more details on using hashes here.

File details

Details for the file thebeat-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: thebeat-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 118.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for thebeat-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dddc32858ab6995c1098b6fd5600f427650c97206e5f0127bdbc3129edcf2b4a
MD5 10e2272dec959c2512a946f527c3942a
BLAKE2b-256 3370ec92cbc27b951ce01e0c9d66e75f6632f6b6eb4419111e4df3e1e236e0c4

See more details on using hashes here.

Supported by

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