I've found many, many sites which describe what the MESA sine wave looks like and how to interpret it. But I have yet to find any site that describes the actual formula used to calculate the sine wave. (The lead wave I assume is simply the sine wave phase-shifted 45 degrees.)
Elher's website has a technical papers section wherein you can find a paper called "MAMA." At the end of this paper there is Easylanguage code to calculate the phase. You are right that the lead sine is just phase plus 45 degrees. Just take the sine of these calculated phases for the indicator.