onsetsync

onsetsync: An R Package for Onset Synchrony Analysis - Published in JOSS (2024)

https://github.com/tuomaseerola/onsetsync

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software
Last synced: 6 months ago · JSON representation

Repository

Onset synchrony functions

Basic Info
  • Host: GitHub
  • Owner: tuomaseerola
  • License: other
  • Language: R
  • Default Branch: master
  • Size: 19.9 MB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 3
  • Releases: 1
Created about 8 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog Contributing License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "75%"
)
```

# onsetsync - Analysis and Visualisation of Synchronisation of Music Onset Data


[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)


`onsetsync` is a R package for musical assessing synchrony between onsets in music. There are functions for common operations such as adding isochronous beats based on metrical structure, adding annotations, calculating classic measures of synchrony between performers, and assessing periodicity of the onsets, and visualising synchrony across cycles, time, or another property.

For documentation, see [ Quick Guide](https://tuomaseerola.github.io/onsetsync/articles/onsetsync.html).

## Installation

You can install the current version of `onsetsync` from Github by
entering the following commands into R:

```{r,eval=FALSE}
if (!require(devtools)) install.packages("devtools")
devtools::install_github("tuomaseerola/onsetsync",force = TRUE)
```

## Usage

```{r, message=FALSE, warning=FALSE,echo=TRUE}
library(onsetsync)
library(dplyr)
library(ggplot2)
packageVersion("onsetsync")
```
### Reading in data

Read onsets of one Cuban Son performance titled _Palo Santo_ from _IEMP_ dataset at [https://osf.io/sfxa2/](https://osf.io/sfxa2/). This song has the onsets and the annotations about the metric cycles already extracted and defined and **comes with the package**.

Go and listen to the song at OSF.

```{r message=FALSE,warning=FALSE,eval=TRUE,results='asis'}
CSS_Song2 <- onsetsync::CSS_IEMP[[2]]  # Read one song from internal data
CSS_Song2 <- dplyr::select(CSS_Song2,Label.SD,SD,Clave,Bass,Guitar,Tres,
                           CycleTime,Cycle,Isochronous.SD.Time) # Select some columns
print(knitr::kable(head(CSS_Song2),format = "simple",digits = 2))
```

Reading data from is easy either from CSV files in your computer or directly from OSF using `get_OSF_csv` function.

### Visualise onsets structures

As an overview, we can visualise the onsets across the beat sub-divisions for each instrument and do this across the time. Note that time run vertically (from bottom to up) here.

```{r synch2isochron,fig.width=7.4, fig.asp=.75}
fig1 <- plot_by_beat(df = CSS_Song2, 
                     instr = c('Bass','Clave','Guitar','Tres'), 
                     beat = 'SD', 
                     virtual='Isochronous.SD.Time',
                     pcols=2)
print(fig1)
```

### Calculate asynchronies

To what degree are the pairs of instruments synchronised to each other? Let's visualise the synchrony of all pairings of the instruments in this example.

```{r fig2,warning=FALSE,fig.width=7.4, fig.asp=.7}
inst <- c('Clave','Bass','Guitar','Tres')              # Define instruments 
dn <- sync_execute_pairs(CSS_Song2, inst, beat = 'SD') # Calculate ansychr.
fig2 <- plot_by_pair(dn)                               # Plot
print(fig2)  
```

As we saw in the first figure, the instruments usually play widely different amounts of onsets in a piece, and these are bound to be at different beats sub-divisions, the mutual amount of comparable onsets for each pair often varies dramatically. Comparison of mean asynchronies across sub-divisions can be facilitated by taking random samples of the joint onsets. Here we choose a random 200 matching onsets and re-calculate the comparison of asynchrony with this subset 1000 times.

```{r paired1}
set.seed(1234) # set random seed
N <- 200 # Let's select 200 onsets
Bootstrap <- 100 # Let's bootstrap this 100 times
d1 <- sync_sample_paired(df=CSS_Song2,
                         instr1 = 'Clave',
                         instr2 = 'Bass',
                         n = N,
                         bootn = Bootstrap,
                         beat = 'SD')
dplyr::summarise(data.frame(d1), N=n(), M = mean(asynch*1000), SD = sd(asynch*1000))
```

There are other measures to summarise the asynchronies and visualise them. 

For more examples, see [Get started](https://tuomaseerola.github.io/onsetsync/articles/onsetsync.html).

Read the [community guidelines](CONTRIBUTING.md) for contributing to the package or asking questions.

Owner

  • Name: Tuomas Eerola
  • Login: tuomaseerola
  • Kind: user
  • Location: Durham, UK
  • Company: Durham University

Empirical music research, music and emotions, acoustic analysis and modelling, i.e. systematic musicology in the 21st century.

JOSS Publication

onsetsync: An R Package for Onset Synchrony Analysis
Published
January 06, 2024
Volume 9, Issue 93, Page 5395
Authors
Tuomas Eerola ORCID
Department of Music, Durham University
Martin Clayton ORCID
Department of Music, Durham University
Editor
Fabian-Robert Stöter ORCID
Tags
music entrainment periodicity synchrony

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 139
  • Total Committers: 3
  • Avg Commits per committer: 46.333
  • Development Distribution Score (DDS): 0.108
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
tuomaseerola t****a@b****m 124
tuomaseerola t****a@k****i 14
Fabian-Robert Stöter f****t 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 10
  • Total pull requests: 3
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 1.2
  • Average comments per pull request: 0.33
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pmcharrison (5)
  • mrocamora (2)
Pull Request Authors
  • tuomaseerola (1)
  • faroit (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

DESCRIPTION cran
  • R >= 3.3.2 depends
  • dplyr * imports
  • ggplot2 * imports
  • magrittr * imports
  • moments * imports
  • reshape2 * imports
  • scales * imports
  • seewave * imports
  • signal * imports
  • tidyr * imports
  • devtools * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/draft-pdf.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite