stringcalc.frets.length_from_distance

stringcalc.frets.length_from_distance#

stringcalc.frets.length_from_distance(ab, d)#

Calculate the scale length implied by a->b distance d.

Parameters:
  • ab (tuple[int | None, int | None]) – ab is a 2-tuple (a, b) specifying the bounds of the input distance d in terms of fret number. Use None to indicate the bridge/saddle end of the fretboard (and 0 to indicate the nut end).

  • d (float | Quantity | str) –

    Distance between a and b.

    Note

    Can use a quantity string that Pint will recognize, e.g. '25.5 in'. Then, the output will be a pint.Quantity with the same units.

Return type:

float | Quantity

Examples

>>> from stringcalc.frets import length_from_distance
>>> round(length_from_distance((0, 1), 1.4), 2)
24.94
>>> round(length_from_distance((0, 1), "3 cm").to("inch"), 2)
<Quantity(21.04, 'inch')>