90-degree out of phase generally means an uncorrelated, diffuse field, which AFAIK is handled through inter-channel coherence (IC), rather than with inter-channel phase difference (IPD).

I have to disagree with the first part of your sentence. Attached are three WAV files I created with the Octave/Matlab script below:

- [attachment=8480:noise90.wav]fully correlated (i.e. identical) noise sources in both channels, left channel created using forward MDCT + inverse MDCT, right channel created using forward MDCT + inverse MD
**S**T to achieve a 90-degree phase shift, - [attachment=8481:noiseUC.wav]fully uncorrelated (i.e. independent) noise sources for the two channels, both left and right channel created using forward MDCT + inverse MDCT,
- [attachment=8482:noiseUC90.wav]same as noiseUC, but right channel created using forward MDCT + inverse MD
**S**T (which doesn't matter since the noise sources are uncorrelated).

I find the noise90 file to sound much more like a (somewhat distorted) point source than the (truly diffuse sounding) noiseUC* files. By the way, I could have used a FFT instead of the MDCT/MDST here as well, the results sound the same.

I haven't checked, but a parametric stereo codec without IPD support would probably turn noise90 either into true mono or into something which sounds like the noiseUC* versions, by handling the IPD by way of the IC parameter, as you say.

Of course, this is an extreme demonstration. I have only observed such stable long-term IPDs in some very few Dolby Surround encoded tracks. And the CantWait sample.

OTOH, IPD is related to time delay of arrival, which is a cue that we only perceive below about 1-2 kHz. The problem is that in that range the ear is very sensitive to phase, and messing it up causes really bad artefacts. I believe it's the reason why HE-AACv2 makes me motion sick when I listen to it with headphones.

Indeed. I don't like the sound of HE-AAC's Parametric Stereo either. In fact, its phase coding is so expensive and unintuitive that I'm not even sure it's actually used. Which might be the reason why HE-AAC v2 sounds quite bad on "phasy" items like the abovementioned CantWait. Extended HE-AAC (USAC) sounds much better in such cases.

N = 1024; % frame length

F = 94; % number of frames

% mdct4() and imdct4() are from www.ee.columbia.edu/~marios/mdct/mdct_giraffe.html

w_sin = sin(pi*(0.5:2*N)'/(2*N));

outUC = zeros(F*N, 2);

out90 = zeros(F*N, 2);

outUC90 = zeros(F*N, 2);

rand1 = rand(F*N, 1) - rand(F*N, 1) + rand(F*N, 1) - rand(F*N, 1);

rand2 = rand(F*N, 1) - rand(F*N, 1) + rand(F*N, 1) - rand(F*N, 1);

for i = 0 : F-2

spec = mdct4(w_sin .* rand1(i*N+1 : i*N+2*N));

out90(i*N+1 : i*N+2*N, 1) = out90(i*N+1 : i*N+2*N, 1) + w_sin .* imdct4(spec);

outUC(i*N+1 : i*N+2*N, 1) = outUC(i*N+1 : i*N+2*N, 1) + w_sin .* imdct4(spec);

outUC90(i*N+1 : i*N+2*N, 1) = outUC90(i*N+1 : i*N+2*N, 1) + w_sin .* imdct4(spec);

spec(1:2:end) = -spec(1:2:end);

temp = w_sin .* imdct4(spec); % IMDST via IMDCT

out90(i*N+1 : i*N+2*N, 2) = out90(i*N+1 : i*N+2*N, 2) + temp(end:-1:1);

spec = mdct4(w_sin .* rand2(i*N+1 : i*N+2*N)); % uncorrelated second channel

outUC(i*N+1 : i*N+2*N, 2) = outUC(i*N+1 : i*N+2*N, 2) + w_sin .* imdct4(spec);

spec(1:2:end) = -spec(1:2:end);

temp = w_sin .* imdct4(spec); % IMDST via IMDCT

outUC90(i*N+1 : i*N+2*N, 2) = outUC90(i*N+1 : i*N+2*N, 2) + temp(end:-1:1);

end

wavwrite(out90*0.25, 48000, 16, 'noise90.wav');

wavwrite(outUC*0.25, 48000, 16, 'noiseUC.wav');

wavwrite(outUC90*0.25, 48000, 16, 'noiseUC90.wav');

Chris