pitch_round

pitchtools.pitch_round(midinote, semitone_divisions=1)[source]

Round midinote to the next (possibly microtonal) note

Returns the rounded notename and the cents deviation from the original pitch to the nearest semitone

Parameters:
  • midinote (float) – the midinote to round, as float

  • semitone_divisions – the number of division per semitone

Return type:

tuple[str, int]

Returns:

a tuple (rounded note, cents deviation). NB – the cents deviation can be negative (see example below)

Example

>>> pitch_round(60.1)
("4C", 10)
>>> pitch_round(60.75)
("4D<", -25)