Skip to main content

pitchdiff

pitchdiff(
@source ## int/float (required)
@targets ## int/float/list (required)
) -> int/float

Given a list of target midicents and/or pitch classes, returns the signed difference between a pitch in midicents and the nearest midicent/pitch class target.


Arguments

  • @source [int/float]: Reference pitch in midicents. (required)
  • @targets [int/float/list]: List of midicent or pitch class targets. (required)

Output

Signed difference to closest target, in cents. [int/float]


Usage

pitchdiff(6300, 0 4 7); ## 100
pitchdiff(5500, 5300 6000); ## -200
pitchdiff(7200, 7) ## -500