An M code envelope detector receives an incoming binary offset carrier (BOC) signal, such as the M code signal, and generates inphase BOC and quadraphase BOC signals, separated by an offset, that have respective ambiguous correlation envelopes, that when combined, provide a near unimodal correlation function with respect to code phase error of the BOC signal having an inherent multimodal autoco