def key_freq(key_number: int, a4: float=440.0) ->float:
    """
    Return the note frequency for the given piano key number.
    C4 is key 40 and A4 is key 49 (=440 hz).
    https://en.wikipedia.org/wiki/Piano_key_frequencies
    """
    return 2 ** ((key_number - 49) / 12) * a4
