Skip to main content

tonalkey

tonalkey(
@numharmonics 4
@pcpsize 36
@profiletype 'bgate'
@slope 0.6
@usemajmin 0
@usepolyphony 1
@usethreechords 1
@mode 0
) -> llll

Generates audio descriptor to perform tonal key signature estimation on a buffer. See analyze.

The resulting buffer will be updated with the following keys:

  • tonalkey
info

tonalkey is a mirror implementation of the same algorithm in the Essentia library. For more details on the algorithm, please check the Essentia Algorithms reference.


Arguments

  • @numharmonics [int]: number of harmonics that should contribute to the polyphonic profile. (default: 4).
  • @pcpsize [int]: pitch class profile size. (default: 36).
  • @profiletype [list]: the type of polyphic profile to use for correlation calculation. (default: 'bgate').
    • 'diatonic': binary profile with diatonic notes of both modes.
    • 'tonic triad': just the notes of the major and minor chords. exclusively for testing.
    • 'krumhansl': reference key profiles based on cognitive experiments—useful for pop music.
    • 'temperley': key profiles extracted from corpus analysis of euroclassical music, especially in minor keys.
    • 'shaath': profiles based on Krumhansl's specifically tuned to popular and electronic music.
    • 'noland': profiles from Bach's Well Tempered Klavier.
    • 'edma': automatic profiles extracted from corpus analysis of EDM—better than Shaath's
    • 'edmm': same as edma, but manually tweaked according to heuristic observation.
    • 'braw': profiles obtained by calculating the median profile for each mode from a subset of BeatPort dataset.
    • 'bgate': same as braw but zeroing the 4 less relevant elements of each profile.
  • @slope [int/float]: value of the slope of the exponential harmonic contribution to the polyphonic profile. (default: 0.6).
  • @usemajmin [int]: use a third profile called 'majmin' for ambiguous tracks. Only avalable for the edma, bgate and braw profiles. (default: 0).
    • 0: off
    • 1: on
  • @usepolyphony [int]: enables the use of polyphonic profiles to define key profiles—this includes the contributions from triads as well as pitch harmonics. (default: 1).
    • 0: off
    • 1: on
  • @usethreechords [int]: consider only the 3 main triad chords of the key—i.e., T, D, SD—to build the polyphonic profiles. (default: 1).
    • 0: off
    • 1: on
  • @mode [int]: analysis mode. (default: 0).
    • 0: global
    • 1: time series
    • 2: time-tagged time series

Output

tonalkey descriptor [llll]


Usage

tonalkey is meant to be used with the analyze function:

$buffer = importaudio('singing.wav'); ## input buffer
$descr = tonalkey(); ## generate tonalkey audio descriptor
$buffer.inspect('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.inspect('after analysis')