tempogram: Compute a tempogram from Spotify segment onsets

View source: R/tempo.R

tempogramR Documentation

Compute a tempogram from Spotify segment onsets

Description

Computes a Fourier-based tempogram based on onsets of Spotify segments. Returns a tibble with time, bpm, and power columns. Power is normalised to a max of 1 (Chebyshev norm) within each time point.

Usage

tempogram(
  track_analysis,
  window_size = 8,
  hop_size = 1,
  cyclic = FALSE,
  bpms = if (cyclic) 80:160 else 30:600,
  window_function = signal::hamming
)

Arguments

track_analysis

Spotify audio analysis as returned by get_tidy_audio_analysis.

window_size

Window size in seconds (default 8).

hop_size

Hop size in seconds (default 1).

cyclic

Boolean stating whether the tempogram should be cyclic (default not).

bpms

Vector of tempi in beats per minute to include in the tempogram (default 30–200 for non-cyclic and 80–160 for cyclic, inclusive of all integer tempi).

window_function

Window function for the Fourier analysis (default Hamming).

Examples

library(tidyverse)
get_tidy_audio_analysis("6PJasPKAzNLSOzxeAH33j2") %>%
  tempogram(window_size = 4, hop_size = 2)

jaburgoyne/compmus documentation built on Feb. 26, 2023, 3:44 a.m.