import math


def frequencyToMidi(frequency):
    """
    Convert a given frequency in Hertz to its corresponding MIDI pitch number (60 = Middle C)
    """
    return int(round(69 + 12 * math.log(frequency / 440.0, 2)))