How does a Mach Meter determine the speed of sound at a given altitude?
An (analog) machmeter looks something like this:



So it's more like an more complex version of the airspeed indicator, in this case correcting for the altitude in the process. That being said, I found this extract apparently from an FAA publication:


  Some older mechanical Machmeters not driven from an air data computer use an altitude aneroid inside the instrument that converts pitot-static pressure into Mach number. These systems assume that the temperature at any altitude is standard; therefore, the indicated Mach number is inaccurate whenever the temperature deviates from standard. These systems are called indicated Machmeters. Modern electronic Machmeters use information from an air data computer system to correct for temperature errors. These systems display true Mach number.


Most systems today use more detailed data from sensors to give a correct value through a variety of (complex) calculations.

A little more discussion is available on PPruNe.



Side note: Speed of sound ($a$) itself is solely determined by temperature (that being said, you are able to determine it from pressure, as pressure is a function of temperature) hence the problem with the analog system above.

For air:

$$a=\sqrt{R{\gamma}T}~m/s$$

Where:

$R=287$  Specific Gas constant [dimensionless]

$\gamma=1.4$  Specific heat ratio [dimensionless] 

$T=$ Absolute temperature [K]

Remember that you're reading off indicated airspeed [IAS] in knots in the cockpit, which is not the same as True airspeed [TAS] converted to m/s, in case you're trying to work out your mach speed manually ($M=\frac{TAS}{a}$)

For use without knowledge of airspeed &amp; temperature, Wikipedia gives the following formula for subsonic flows:

$$M=\sqrt{5((\frac{P_T}{P}+1)^\frac27-1)}$$

Where: 

$P_T=$ Total Pressure

$P=$ Static Pressure