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 an audio descriptor to perform tonal key signature estimation on a buffer.

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.view('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.view('after analysis')