Skip to main content

pitchmelodia

pitchmelodia(
@binresolution 10
@filteriterations 3
@framesize 2048
@guessunvoiced 0
@harmonicweight 0.8
@hopsize 1024
@magnitudecompression 1
@magnitudethreshold 40
@maxfrequency 20000
@minduration 100
@minfrequency 40
@numberharmonics 20
@peakdistributionthreshold 0.9
@peakframethreshold 0.9
@pitchcontinuity 27.5625
@referencefrequency 55
@samplerate 44100
@timecontinuity 100
@polyphonic 0
@voicevibrato 0
@voicingtolerance 0.2
@mode 0
) -> llll

Generates audio descriptor to estimate the fundamental frequency corresponding to the melody of a monophonic music signal based on the MELODIA algorithm. While the algorithm is originally designed to extract the predominant melody from polyphonic music, this implementation is adapted for monophonic signals. The approach is based on the creation and characterization of pitch contours, time continuous sequences of pitch candidates grouped using auditory streaming cues. It is strongly advised to use the default parameter values which are optimized for this task, except for @minfrequency and @maxfrequency, which will be context-dependent. See analyze.

The resulting buffer will be updated with the following keys:

  • pitchmelodia
  • pitchmelodia_confidence
info

pitchmelodia 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

  • @binresolution [int]: salience function bin resolution, in cents. (default: 10).
  • @filteriterations [int]: number of iterations for the octave errors / pitch outlier filtering process. (default: 3).
  • @framesize [int]: frame size for computing pitch salience. (default: 2048).
  • @guessunvoiced [int]: estimate pitch for non-voiced segments. (default: 0).
    • 0: off
    • 1: on
  • @harmonicweight [int/float]: weight decay ratio between two consequent harmonics. Use 1 for no decay. (default: 0.8).
  • @hopsize [int]: hop size with which the pitch salience function was computed. (default: 1024).
  • @magnitudecompression [int]: magnitude compression parameter for the salience function. (default: 1).
    • 0: maximum compression
    • 1: no compression
  • @magnitudethreshold [int]: spectral peak magnitude threshold, in decibels. (default: 40).
  • @maxfrequency [int/float]: the maximum allowed frequency for salience function peaks. (default: 20000).
  • @minduration [int]: the minimum allowed contour duration. (default: 100).
  • @minfrequency [int/float]: the minimum allowed frequency for salience function peaks. (default: 40).
  • @numberharmonics [int]: number of considered harmonics. (default: 20).
  • @peakdistributionthreshold [int/float]: allowed deviation below the peak salience mean over all frames. (default: 0.9).
  • @peakframethreshold [int/float]: per-frame salience threshold factor. (default: 0.9).
  • @pitchcontinuity [int/float]: maximum allowed pitch change during 1 ms time period, in cents. (default: 27.5625).
  • @referencefrequency [int/float]: the reference frequency to cent conversion corresponding to the 0th cent bin. (default: 55).
  • @samplerate [int]: the sampling rate of the audio signal. (default: 44100).
  • @timecontinuity [int]: maximum allowed gap duration for a pitch contour, in milliseconds. (default: 100).
  • @polyphonic [int]: optimize for polyphonic buffer. (default: 0).
    • 0: off
    • 1: on
  • @voicevibrato [int]: detect voice vibrato, when @polyphonic is 1. (default: 0).
    • 0: off
    • 1: on
  • @voicingtolerance [int/float]: voicing tolerance between -1 and 1.4, when @polyphonic is 1. (default: 0.2).
  • @mode [int]: analysis mode. (default: 0).
    • 0: global
    • 1: time series
    • 2: time-tagged time series
    • 3: buffer

Output

pitchmelodia descriptor [llll]


Usage

pitchmelodia is meant to be used with the analyze function:

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