Sorry, I should have given more detail to start. This project is for an ultrasonic receiver. I run the output through an op-amp, then a cap to strip DC, then a diode to toss out the negative voltages, so it's a 1/2 sine wave in the diagram above. I then feed this to an A/D.
Mathematically, it's simply a matter of picking up the peaks at the apex at 40kHz, tossing out the balance, and running a simple curvefit.
The real heart of the issue is feeding a 1/2 sine signal into an A/D and getting meaningful results. Even with a high rate of conversion, the peaks are read as well as the non-peaks, so deciphering the peaks is a bit difficult. I'm doing it in an AVR 8-Bit RISC chip, but it takes a lot of somewhat messy code to get there - a curve like I drew to the right would be much more meaningful to me. I thought about a peak detector/peak hold, but I'm looking for all peaks across a time frame, not a single peak. For example, after the transducer rings down, I would want to get an output of all the peaks above a given threshold for, say 50ms.