What do the muscles of the middle ear do?
From "The Ear and the Voice"
There are two tiny muscles in the middle ear: the tensor tympanum, which is associated with the hammer, and the stapedius, which is associated with the stirrup.
What do they do?
Using a compact description from Brtbalu's otolaryngology, we see that the contraction of the stapedius fixes the stirrup and 1) reduces the "transmission by up to 30 dB for frequencies less than 1-2 KHz," while both muscles serve to 2) "dampen unwanted resonances in the middle ear system causing spoken words to be heard with clarity." These two muscles also 3) protect the ear from "damage due to excess noise" and 4) attenuate the low-frequency sounds from within the body.
This is the standard view.
However, it should be pointed out that the four points above outline a passive rather than an active perspective, this being the difference between hearing and listening, the latter the observation of Alfred A. Tomatis, who had very different ideas regarding the role of the muscles in the middle ear arising from his astute observation that there is a space between the stirrup and the cochlea which does not permit the full transmission of frequencies. As such, his view —as I understand it—is that the middle ear acts less like a transducer than an antenna, the actual transmission of sound taking place via the bone in which the anatomy of the middle ear is encased.
Excellent listening is most likely when accompanied by exceedingly functional hearing. Fitness of muscles in the middle ear makes possible the optimal use of hearing. This requires an ongoing coordination between the muscles of the hammer and the stirrup. Under optimal conditions, these muscles act synergistically rather than antagonistically. Their reciprocal actions induce an optimal tone resulting from a balance between the flexors and the extensor muscles.
The muscle of the stirrup is an extensor; the muscle of the hammer is a flexor. The muscle of the stirrup regulates the inner ear. It is the last of the extensors to have developed and controls a set of synergies that will be described in the chapter about posture.
The regulatory system controlled by the ear impacts the whole body and prepares it for singing. In fact, to "prick up one's ears" is to open them. Moreover, it also opens the entire body by acting on all the extensors.
—Alfred A. Tomatis, The Ear and the Voice: 52.
Tomatis was the first person to observe the integration of the muscles of the ear with those of the body, specifically the interplay of the extensors and flexors. It's a matter which many singing teachers perceive intuitively by observing how the student enters the studio. The student who enters upright with an open countenance and resonant speaking voice (they go together, don't you know) will have a very different lesson than the student who enters with head hanging and mouth mumbling. In the case of the latter, a teacher who can enable the student to extend is nothing short of a miracle worker.