MHz Speed Analog Reading + High Quality 40kHz Square Wave

Rigelation:
I thought that maybe I could achieve this with ultrasound transducers, by looking at the travel time from a sender to a receiver. The idea is really straightforward, but the catch is that I would need to be sampling a 40kHz sine wave at a minimum of 3MHz for the resolution required.

When working with ultrasound transducers, you need to amplify the received signal (using an op-amp) into the logic level range of your microcontroller/Arduino. You can then sample the signal digitally (edge detect) at 16Mhz. Speed of sound through air is about 343m/s and the theoretical resolution is then in the low micrometer range (343m / 16e6). It is not practical to build a device with such accuracy for a number of reasons, but sub-centimeter is within reach after calibration.