Package: thebeat
thebeat: Rhythms in Python for Sciencethebeatis 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,thebeatwill save you time when creating experiments or analyzing data.thebeatis 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.DocumentationThe package documentation is available fromhttps://thebeat.readthedocs.io. The documentation contains
detailed descriptions of all package functionality, as well as a large number of (copyable)
examples.Installationthebeatis available through PyPI, and can be installed using:pipinstallthebeatNote that if you want to usethebeat's functionality for plotting musical notation,
you have to install it using:pipinstall'thebeat[music_notation]'This will installthebeatwith the optional dependenciesabjadandLilypond.thebeatis actively tested on Linux, macOS, and Windows. We aim to provide support for allsupported versionsof Python (3.8 and higher).Try directly via BinderIf you first would like to trythebeat, or of you wish to use it in, for instance, an
educational setting, you can usethis linkto trythebeatin a Binder environment.Getting startedThe code below illustrates how we might create a simple trial for use in an experiment:fromthebeatimportSequence,SoundStimulus,SoundSequenceseq=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 loudspeakerstrial.plot_waveform()# plot as sound waveformtrial.plot_sequence()# plot as an event plottrial.write_wav('example_trial.wav')# save file to diskOpen discussionOne of the reasons for creatingthebeatwas the lack of a collection of standardized/accepted
methods for use in rhythm and timing research. Therefore, an important part ofthebeat'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 thatthebeatprovides.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 ourGitter chatroom. This is likely
the best place to go to with questions about howthebeatworks.Licensethebeatis distributed under the GPL-3 license. You are free to distribute or modify the code, both for non-commercial and commercial use. Seeherefor more info.CollaboratorsThe 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.