def cents_to_pitchbend(cents, pb_range) -> int:
    """
    Convert cent offset to pitch bend value (capped to range 0-16383)
    :param cents: cent offset
    :param pb_range: pitch bend range in either direction (+/-) as per setting on Roli Dashboard / Equator
    :return:
    """
    pb = 8192 + 16384 * cents / (pb_range * 200)
    if 0 > pb > 16383:
        print(f'warning: pitchbend range too small to bend {cents} cents')
    return int(max(0, min(16383, pb)))