The primary function of the middle ear is to efficiently transfer acoustic energy from compression waves in air to fluid–membrane waves within the cochlea.