FM stereo modulation and pilot phase - sine vs cosine - Page 1
Forum section: electronics / rf-microwave

author: radiolistener
author_rank: Super Contributor
timestamp: August 08, 2025, 11:56:33 pm
content: I am developing a DSP demodulator for FM stereo in my receiver and encountered unexpected behavior with FM stereo receivers. I have an Octave script that generates an IQ recording of a WFM-modulated composite stereo signal for testing:Code:pkg load audio;Fs = 480000; % Sample rateN = 2^21; % Sample countwfm_df = 75000; % WFM frequency deviation 75 kHzpilotf = 19000; % stereo pilot tone 19 khzt = (0:N-1)' / Fs; % time vector% Test messageL = cos(700*2*pi*t); % L = 700 HzR = zeros(N, 1); % R = 0 Hz%-----------------------------------------------------------------------% CCIR WFM stereo composite modulatoradd_LR = (L + R) / 2; % L+R baseband monosub_LR = (L - R) / 2; % L-R difference signalpilot = sin(2*pi*pilotf*t); % Pilot tone 19 kHzcarrier_38 = sin(2 * 2*pi*pilotf*t); % DSB-SC carrier 2*19=38 kHzdsb_sc = sub_LR .* carrier_38; % DSB-SC L-R at 38 kHz% Composite MPX: L+R (baseband) + pilot + DSB-SC (L-R)composite = 0.4*add_LR + 0.1*pilot + 0.4*dsb_sc;%-----------------------------------------------------------------------% WFM IQ modulatorkf = 2*pi * wfm_df;phase = kf * cumsum(composite) / Fs;iq_out = complex(cos(phase), sin(phase));iq_out = iq_out / max(abs(iq_out(:))); % normalizeaudiowrite('test-iq-out.wav', [real(iq_out) imag(iq_out)], Fs, 'BitsPerSample', 32);This script generates a WAV file containing an IQ recording of a WFM stereo signal with a 700 Hz tone in the left channel and silence in the right channel.But there is an issue. When I generate the pilot tone and the DSB-SC carrier using sin() function, receivers decode the stereo signal correctly - a tone appears only in the left channel:Code:pilot = sin(2*pi*pilotf*t); % Pilot tone 19 kHzcarrier_38 = sin(2 * 2*pi*pilotf*t); % DSB-SC carrier 2*19=38 kHzHowever, when I use cos() function for both pilot and DSB-SC carriers, receivers decode the stereo signal incorrectly - the tone is audible in both channels:Code:pilot = cos(2*pi*pilotf*t); % Pilot tone 19 kHzcarrier_38 = cos(2 * 2*pi*pilotf*t); % DSB-SC carrier 2*19=38 kHzFM receivers that I use for testing use a PLL to lock to the pilot tone phase and recover the DSB-SC carrier by squaring the pilot’s IQ signal. Intuitively, there should be no difference between using sin or cos function, since the PLL compensates for phase offsets. Yet, in practice, this phase choice affects decoding.I analyzed the spectrum of the composite signal, and it appears excellent in both cases - using either sin or cos for the pilot carrier generation. Therefore, I don't understand why receivers fail to properly decode the signal when cos is used for the pilot carrier.Can someone help clarify why this happens and why it don't works with cos function?

author: gf
author_rank: Super Contributor
timestamp: August 09, 2025, 03:20:41 am
content: For sin vs. cos, the doubled frequency has a different phase relation to the pilot.Let y=x-pi/2. Then sin(x) = cos(y), but sin(2*x) != cos(2*y).

author: KE5FX
author_rank: Super Contributor
timestamp: August 09, 2025, 04:39:34 am
content: Nice catch. Not going to lie, this one had me stumped. I was about to port it to C and start adding printf()s.Goodbenchmark questionfor LLMs, too.

author: radiolistener
author_rank: Super Contributor
timestamp: August 09, 2025, 11:07:26 am
content: Yeah, this is quite a tricky pitfall.If I understand correctly, the issue is not in my stereo composite generation code, but in the stereo composite decoders of the receivers I used for testing. As I see it, the problem is as follows:In both the pairssin(theta), sin(2*theta)andcos(theta), cos(2*theta), the relative phase remains constant - they are coherent. However, the initial phase differs between the two pairs. Forcos(theta), cos(2*theta), the constant-phase point is at +1, whereas forsin(theta), sin(2*theta)it is at 0. This means that forcos(theta), cos(2*theta)the condition of phase alignment at zero crossing is not met.If a stereo composite decoder relies on zero-crossings to recover the DSB-SC carrier phase, it will only be able to correctly decode signals generated usingsin(theta), sin(2*theta)carriers, since these align at zero. Usingcos(theta), cos(2*theta)will not work in this case, because their phase alignment occurs at +1, preventing the decoder from recovering the correct phase for DSB-SC demodulation.The remaining question is: does the broadcasting standard actually permit the use ofcos(theta), cos(2*theta)for the carriers?In the Gemini LLM response linked above, it states:QuoteThis is an interesting detail, but I am not sure whether such a requirement actually exists in the WFM stereo composite standard, or if it is simply an LLM hallucination. So I asked ChatGPT-5 about this and he respond that such a requirement exists in U.S. regulations, specifically47 CFR §73.322. However, international standards are more general, requiring only that the DSB-SC subcarrier be an integer multiple of, and phase-locked to, the pilot tone.This raises the question: under international standards, is there an equivalent requirement for simultaneous zero crossings, or in some countries would generating the subcarrier ascos(theta), cos(2*theta)be considered fully compliant, with receivers expected to correctly recover such a carrier?Where can I find an authoritative source confirming or refuting this?

author: gf
author_rank: Super Contributor
timestamp: August 09, 2025, 11:09:13 am
content: Quote from: KE5FX on August 09, 2025, 04:39:34 amNicely explained in more detail.

author: radiolistener
author_rank: Super Contributor
timestamp: August 09, 2025, 11:49:47 am
content: So, in order to comply with US regulations, carriers should be generated as:Code:pilot = sin(2*pi*pilotf*t); % pilot tone 19 kHzc38 = sin(2 * 2*pi*pilotf*t); % DSB-SC carrier 2*19=38 kHzdsbsc = sub_LR .* c38; % DSB-SC L-R at 38 kHzcomposite = 0.4*add_LR + 0.1*pilot + 0.4*dsbsc;or as:Code:pilot = cos(2*pi*pilotf*t); % pilot tone 19 kHzc38 = -sin(2 * 2*pi*pilotf*t); % DSB-SC carrier 2*19=38 kHzdsbsc = sub_LR .* c38; % DSB-SC L-R at 38 kHzcomposite = 0.4*add_LR + 0.1*pilot + 0.4*dsbsc;

author: KE5FX
author_rank: Super Contributor
timestamp: August 09, 2025, 04:28:01 pm
content: Quote from: radiolistener on August 09, 2025, 11:07:26 amGemini's explanation was very well done (GPT5 was down when I tried it), but I thought the citation sounded hallucinated too.I asked for clarification, but it was still crunching when I went to bed. Ultimately, while it correctly pointed towards 47 CFR § 73.322 for the US version of the regulation and quoted it verbatim, it paraphrased § 2.2.2.5 in ITU-R BS.450-3.So I'll give HAL half credit for that part. It didn't spin a complete fairy tale like previous versions tended to, but when the user asks for a citation, it shouldn't rewrite what it finds.

author: Tation
author_rank: Regular Contributor
timestamp: August 09, 2025, 04:34:09 pm
content: The ultimate reference seems ITU-R BS.450. It states:2.2.2.5 The relative phase of the pilot signal and the sub-carrier is such that, when the transmitter is modulated by a multiplex signal for which A is positive and B = – A, this signal crosses the time axis with a positive slope each time the pilot signal has an instantaneous value of zero. The phase tolerance of the pilot signal should not exceed ± 3º from the above state. Moreover, a positive value of the multiplex signal corresponds to a positive frequency deviation of the main carrier.A and B refer to the left and right audio channels.Regards.

author: radiolistener
author_rank: Super Contributor
timestamp: August 09, 2025, 09:00:36 pm
content: Quote from: KE5FX on August 09, 2025, 04:28:01 pmThanks for reference. Yes, it appears that it also have such limitation:https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.450-3-200111-S!!PDF-E.pdfCode:2.2.2.5 The relative phase of the pilot signal and the sub-carrier is such that, when the transmitter ismodulated by a multiplex signal for which A is positive and B = - A, this signal crosses the timeaxis with a positive slope each time the pilot signal has an instantaneous value of zero. The phasetolerance of the pilot signal should not exceed ± 3° from the above state. Moreover, a positive valueof the multiplex signal corresponds to a positive frequency deviation of the main carrier.Such behavior can be satisfied withsin(theta), sin(2 * theta)or withcos(theta), -sin(2 * theta).

author: gf
author_rank: Super Contributor
timestamp: August 09, 2025, 09:14:24 pm
content: Quote from: radiolistener on August 09, 2025, 09:00:36 pmWhy do you consider this a limitation? How would you recover the correct carrier phase if the phase relationship between the carrier and pilot tone were arbitrary at the transmitter? Some kind of relationship must be specified/defined.Edit: And the specified relationship is basically the same as that obtained from a frequency divider, triggered by rising edge, when the output of the PLL's 38 kHz VCO is halved for phase comparison with the pilot tone. So I think it makes even sense.

author: radiolistener
author_rank: Super Contributor
timestamp: August 09, 2025, 09:31:43 pm
content: I'm not talking about the carrier-pilot phase relationship being truly arbitrary, but about coherent phase combinations that don’t meet the standard specific "zero-crossing on pilot’s positive slope" criterion. For sin/cos combinations and their sign variants, the number of such cases is actually small, and they are in principle detectable because each has a predictable set of pilot phase coincidences. A receiver could, in theory, test these few hypotheses and select the correct carrier reconstruction scheme. However, since the standard explicitly fixes the allowable phase relationship, there’s no practical need for such detection logic in compliant systems.

author: gf
author_rank: Super Contributor
timestamp: August 09, 2025, 09:38:00 pm
content: Quote from: radiolistener on August 09, 2025, 09:31:43 pmWouldn't that make the receiver more complicated? Early receivers used analogue circuitry rather than a DSP program.

author: radiolistener
author_rank: Super Contributor
timestamp: August 09, 2025, 09:43:43 pm
content: Quote from: gf on August 09, 2025, 09:38:00 pmdifferent countries have historically used different WFM and stereo composite standards, each with their own stereo composite system specifications. It is quite possible that some systems employ phase relationships or constraints differing from the CCIR standard. Naturally, if a receiver assumes one phase scheme but the transmitter uses an incompatible one, this will cause decoding errors and incompatibility.However, this situation is not unusual - multiple incompatible stereo composite standards coexist worldwide, and receivers are typically designed to handle or select among them. Early analogue receivers often had simpler, fixed-phase designs matched to their local standard, whereas modern DSP-based receivers can adapt more flexibly. So complexity trade-offs were historically balanced by regional standardization.As far as I recall, early analog receivers supporting multiple standards typically employed manual switches on the back panel to select the desired stereo composite system.By the way, do you happen to know if the same "zero-crossing on the pilot’s positive slope" phase constraint was also used in the OIRT stereo composite system, which employs a 31.25 kHz sub-carrier? Also, if anyone happens to have an IQ recording with a stereo signal in this format, I’d greatly appreciate it.

author: gf
author_rank: Super Contributor
timestamp: August 09, 2025, 10:25:40 pm
content: Quote from: radiolistener on August 09, 2025, 09:31:43 pmWith sin/cos combinations and their sign variants there are IMO four cases where the recovered carrier has an offset of either 0°, 90°, 180° or 270° from the true carrier phase. The first one gives the correct stereo output, the 2nd and 4th one demodulate L-R to zero (resulting in a false mono output), and the 3rd one demodulates L-R to R-L (resulting in swapped R and L). I have no idea how the receiver could detect automatically whether L and R are falsely swapped?

author: radiolistener
author_rank: Super Contributor
timestamp: August 10, 2025, 08:42:06 am
content: Quote from: gf on August 09, 2025, 10:25:40 pmYes, detecting the correct phase relationship can be problematic if you rely solely on the DSB-SC L-R subcarrier, especially in cases where the only effect of a phase offset is swapping the left and right channels. However, in most stereo composite systems, there is also a BPSK-modulated RDS subcarrier at 3x the pilot frequency (19*3=57 kHz). This can be exploited by testing different phase hypotheses and checking which one yields valid RDS decoding. The result can then be used to infer the correct phase relationship for the DSB-SC subcarrier.I haven’t implemented this in practice, but at first glance it appears feasible. In any case, it is always possible to provide the user with a manual option to select the carrier phase reference scheme.