The theory says that any band limited signal can be reconstructed perfectly, and that include its phase; any reasonably implemented sampling system (CD) is able to reproduce the phase shift with inaudible accuracy.
1. Shannon-Nyquist only applies exactly if you have infinite precision, i.e. exact discrete samples. Quantizing the samples limits the accuracy. Discretized quantized signal is limited in both bandwidth and phase resolution, and is limited in the resolution at which it can represent the wave packet arrival time.
2. Human time-domain signal arrival time discrimination between each ear is not exactly a phase shift; the ear does not work like that. You do need to model it as the arrival of a wave packet to understand exactly how it occurs. Specifically, it requires the leading edge of the incoming wave packet to be sufficiently steep and sufficiently high maximum amplitude; in a Fourier transform, this is not a single-frequency event.
You can easily simulate this, if you actually wanted to. Just generate a suitably shaped pulse as I described earlier at a higher sample rate. Generate several variants, delaying each by a one additional leading zero sample, then pad with lots of zeros to a suitable size. Decimate to CD audio sample rate and quantize to 16 bit samples, then resample back to original sample rate, and compare the initial and final waveforms.
For example, using the aforementioned waveform using \$f = 3675\text{ Hz}\$ at 176400 samples per second (4x CD audio rate), with four variants; containing one, two, and three leading zero samples compared to the first (corresponding to 5.7µs, 11.3µs, and 17µs delays), using Python 3 and SciPy:
import scipy
import scipy.signal
from math import sin, pi
from sys import stdout, stderr
# Original discrete waveform
wave = []
for i in range(0, 12001):
x = i / 12000.0
wave.append( (1.0 - x)*(1.0 - x)*sin(500.0 * pi * x) )
# Construct four samples, each delayed by one sample
orig1 = scipy.array(([0]*36000) + wave + ([0]*47999), dtype=scipy.float64)
orig2 = scipy.array(([0]*36001) + wave + ([0]*47998), dtype=scipy.float64)
orig3 = scipy.array(([0]*36002) + wave + ([0]*47997), dtype=scipy.float64)
orig4 = scipy.array(([0]*36003) + wave + ([0]*47996), dtype=scipy.float64)
# Resample by 1/4
audio1 = scipy.signal.resample(orig1, 24000)
audio2 = scipy.signal.resample(orig2, 24000)
audio3 = scipy.signal.resample(orig3, 24000)
audio4 = scipy.signal.resample(orig4, 24000)
# Quantize to 16 bit precision (but no clipping)
for i in range(0, 24000):
audio1[i] = round(32768.0 * audio1[i]) / 32768.0
audio2[i] = round(32768.0 * audio2[i]) / 32768.0
audio3[i] = round(32768.0 * audio3[i]) / 32768.0
audio4[i] = round(32768.0 * audio4[i]) / 32768.0
audio1 = scipy.array(audio1, dtype=scipy.float64)
audio2 = scipy.array(audio2, dtype=scipy.float64)
audio3 = scipy.array(audio3, dtype=scipy.float64)
audio4 = scipy.array(audio4, dtype=scipy.float64)
# Resample back to original rate
result1 = scipy.signal.resample(audio1, 96000)
result2 = scipy.signal.resample(audio2, 96000)
result3 = scipy.signal.resample(audio3, 96000)
result4 = scipy.signal.resample(audio4, 96000)
for i in range(0, 96000):
stdout.write("%5d %9.6f %9.6f %9.6f %9.6f %9.6f %9.6f %9.6f %9.6f\n" % (i, orig1[i], result1[i], orig2[i], result2[i], orig3[i], result3[i], orig4[i], result4[i]))
Note that
scipy.signal.resample() uses the Fourier method, i.e. it is the mathematically correct resampling method. Since it assumes the signal is periodic, we pad it with large number of zeroes before and after.
Each output line contains the sample index, and original and final sample amplitudes (-1 to +1) for each of the four waveforms.
Observe the first wavelength prior to the pulse, and two full 3675 Hz wavelengths at the beginning of the pulse (at sample 36001/36002/36003/36004), i.e. samples 36050 - 36099:
Original Delay +1 Delay +2 Delay +3
Index Initial Final Initial Final Initial Final Initial Final
35950 0.000000 -0.001446 0.000000 -0.001074 0.000000 -0.000089 0.000000 0.000918
35951 0.000000 -0.000985 0.000000 -0.001470 0.000000 -0.001077 0.000000 -0.000077
35952 0.000000 0.000092 0.000000 -0.001007 0.000000 -0.001465 0.000000 -0.001068
35953 0.000000 0.001165 0.000000 0.000072 0.000000 -0.000994 0.000000 -0.001463
35954 0.000000 0.001591 0.000000 0.001147 0.000000 0.000090 0.000000 -0.001000
35955 0.000000 0.001085 0.000000 0.001573 0.000000 0.001165 0.000000 0.000081
35956 0.000000 -0.000092 0.000000 0.001068 0.000000 0.001587 0.000000 0.001160
35957 0.000000 -0.001265 0.000000 -0.000108 0.000000 0.001075 0.000000 0.001593
35958 0.000000 -0.001730 0.000000 -0.001281 0.000000 -0.000106 0.000000 0.001094
35959 0.000000 -0.001173 0.000000 -0.001746 0.000000 -0.001279 0.000000 -0.000078
35960 0.000000 0.000122 0.000000 -0.001190 0.000000 -0.001740 0.000000 -0.001251
35961 0.000000 0.001415 0.000000 0.000102 0.000000 -0.001176 0.000000 -0.001721
35962 0.000000 0.001929 0.000000 0.001391 0.000000 0.000123 0.000000 -0.001171
35963 0.000000 0.001313 0.000000 0.001900 0.000000 0.001415 0.000000 0.000116
35964 0.000000 -0.000122 0.000000 0.001282 0.000000 0.001923 0.000000 0.001404
35965 0.000000 -0.001556 0.000000 -0.000151 0.000000 0.001300 0.000000 0.001917
35966 0.000000 -0.002122 0.000000 -0.001579 0.000000 -0.000140 0.000000 0.001304
35967 0.000000 -0.001428 0.000000 -0.002137 0.000000 -0.001574 0.000000 -0.000126
35968 0.000000 0.000183 0.000000 -0.001434 0.000000 -0.002136 0.000000 -0.001556
35969 0.000000 0.001793 0.000000 0.000182 0.000000 -0.001437 0.000000 -0.002124
35970 0.000000 0.002424 0.000000 0.001792 0.000000 0.000177 0.000000 -0.001436
35971 0.000000 0.001627 0.000000 0.002419 0.000000 0.001785 0.000000 0.000167
35972 0.000000 -0.000214 0.000000 0.001617 0.000000 0.002411 0.000000 0.001770
35973 0.000000 -0.002052 0.000000 -0.000225 0.000000 0.001608 0.000000 0.002400
35974 0.000000 -0.002767 0.000000 -0.002061 0.000000 -0.000235 0.000000 0.001610
35975 0.000000 -0.001835 0.000000 -0.002770 0.000000 -0.002070 0.000000 -0.000219
35976 0.000000 0.000305 0.000000 -0.001831 0.000000 -0.002777 0.000000 -0.002045
35977 0.000000 0.002442 0.000000 0.000315 0.000000 -0.001836 0.000000 -0.002752
35978 0.000000 0.003260 0.000000 0.002453 0.000000 0.000311 0.000000 -0.001819
35979 0.000000 0.002134 0.000000 0.003269 0.000000 0.002450 0.000000 0.000315
35980 0.000000 -0.000427 0.000000 0.002136 0.000000 0.003265 0.000000 0.002441
35981 0.000000 -0.002981 0.000000 -0.000432 0.000000 0.002135 0.000000 0.003251
35982 0.000000 -0.003938 0.000000 -0.002992 0.000000 -0.000430 0.000000 0.002120
35983 0.000000 -0.002519 0.000000 -0.003952 0.000000 -0.002984 0.000000 -0.000441
35984 0.000000 0.000671 0.000000 -0.002533 0.000000 -0.003937 0.000000 -0.002991
35985 0.000000 0.003848 0.000000 0.000658 0.000000 -0.002512 0.000000 -0.003943
35986 0.000000 0.004997 0.000000 0.003835 0.000000 0.000681 0.000000 -0.002521
35987 0.000000 0.003091 0.000000 0.004986 0.000000 0.003858 0.000000 0.000669
35988 0.000000 -0.001129 0.000000 0.003082 0.000000 0.005005 0.000000 0.003845
35989 0.000000 -0.005328 0.000000 -0.001133 0.000000 0.003096 0.000000 0.004996
35990 0.000000 -0.006761 0.000000 -0.005326 0.000000 -0.001123 0.000000 0.003095
35991 0.000000 -0.003919 0.000000 -0.006752 0.000000 -0.005317 0.000000 -0.001118
35992 0.000000 0.002258 0.000000 -0.003906 0.000000 -0.006744 0.000000 -0.005310
35993 0.000000 0.008398 0.000000 0.002270 0.000000 -0.003898 0.000000 -0.006741
35994 0.000000 0.010195 0.000000 0.008405 0.000000 0.002277 0.000000 -0.003903
35995 0.000000 0.004890 0.000000 0.010194 0.000000 0.008408 0.000000 0.002265
35996 0.000000 -0.006378 0.000000 0.004883 0.000000 0.010193 0.000000 0.008392
35997 0.000000 -0.017539 0.000000 -0.006386 0.000000 0.004876 0.000000 0.010180
35998 0.000000 -0.018608 0.000000 -0.017542 0.000000 -0.006398 0.000000 0.004871
35999 0.000000 0.001413 0.000000 -0.018599 0.000000 -0.017557 0.000000 -0.006394
36000 0.000000 0.050781 0.000000 0.001434 0.000000 -0.018616 0.000000 -0.017548
36001 0.130504 0.131896 0.000000 0.050812 0.000000 0.001418 0.000000 -0.018608
36002 0.258733 0.240106 0.130504 0.131929 0.000000 0.050794 0.000000 0.001419
36003 0.382492 0.364944 0.258733 0.240133 0.130504 0.131910 0.000000 0.050787
36004 0.499667 0.493286 0.382492 0.364960 0.258733 0.240112 0.130504 0.131897
36005 0.608254 0.613143 0.499667 0.493290 0.382492 0.364939 0.258733 0.240100
36006 0.706400 0.716591 0.608254 0.613137 0.499667 0.493273 0.382492 0.364931
36007 0.792428 0.800821 0.706400 0.716581 0.608254 0.613128 0.499667 0.493271
36008 0.864871 0.867126 0.792428 0.800812 0.706400 0.716583 0.608254 0.613129
36009 0.922494 0.918578 0.864871 0.867121 0.792428 0.800824 0.706400 0.716581
36010 0.964317 0.957566 0.922494 0.918576 0.864871 0.867140 0.792428 0.800815
36011 0.989628 0.984315 0.964317 0.957565 0.922494 0.918597 0.864871 0.867125
36012 0.998001 0.996887 0.989628 0.984314 0.964317 0.957581 0.922494 0.918579
36013 0.989298 0.992400 0.998001 0.996885 0.989628 0.984320 0.964317 0.957568
36014 0.963673 0.968675 0.989298 0.992397 0.998001 0.996881 0.989628 0.984318
36015 0.921571 0.925416 0.963673 0.968672 0.989298 0.992386 0.998001 0.996890
36016 0.863718 0.864380 0.921571 0.925415 0.963673 0.968658 0.989298 0.992401
36017 0.791107 0.788576 0.863718 0.864382 0.921571 0.925404 0.963673 0.968674
36018 0.704987 0.701035 0.791107 0.788582 0.863718 0.864377 0.921571 0.925413
36019 0.606835 0.603840 0.704987 0.701044 0.791107 0.788583 0.863718 0.864376
36020 0.498335 0.497894 0.606835 0.603851 0.704987 0.701050 0.791107 0.788574
36021 0.381345 0.383468 0.498335 0.497908 0.606835 0.603858 0.704987 0.701038
36022 0.257871 0.261123 0.381345 0.383484 0.498335 0.497914 0.606835 0.603849
36023 0.130026 0.132465 0.257871 0.261138 0.381345 0.383487 0.498335 0.497909
36024 0.000000 0.000305 0.130026 0.132477 0.257871 0.261139 0.381345 0.383484
36025 -0.129983 -0.131816 0.000000 0.000312 0.130026 0.132477 0.257871 0.261134
36026 -0.257699 -0.260466 -0.129983 -0.131815 0.000000 0.000313 0.130026 0.132465
36027 -0.380963 -0.383020 -0.257699 -0.260470 -0.129983 -0.131813 0.000000 0.000294
36028 -0.497669 -0.497894 -0.380963 -0.383026 -0.257699 -0.260468 -0.129983 -0.131836
36029 -0.605823 -0.604212 -0.497669 -0.497899 -0.380963 -0.383026 -0.257699 -0.260488
36030 -0.703576 -0.701168 -0.605823 -0.604212 -0.497669 -0.497901 -0.380963 -0.383038
36031 -0.789260 -0.787480 -0.703576 -0.701165 -0.605823 -0.604218 -0.497669 -0.497906
36032 -0.861413 -0.861237 -0.789260 -0.787476 -0.703576 -0.701172 -0.605823 -0.604218
36033 -0.918805 -0.920235 -0.861413 -0.861236 -0.789260 -0.787481 -0.703576 -0.701173
36034 -0.960460 -0.962583 -0.918805 -0.920241 -0.861413 -0.861236 -0.789260 -0.787490
36035 -0.985670 -0.987229 -0.960460 -0.962595 -0.918805 -0.920235 -0.861413 -0.861254
36036 -0.994009 -0.994141 -0.985670 -0.987244 -0.960460 -0.962585 -0.918805 -0.920258
36037 -0.985340 -0.984042 -0.994009 -0.994152 -0.985670 -0.987235 -0.960460 -0.962604
36038 -0.959818 -0.957904 -0.985340 -0.984047 -0.994009 -0.994149 -0.985670 -0.987244
36039 -0.917884 -0.916478 -0.959818 -0.957903 -0.985340 -0.984053 -0.994009 -0.994145
36040 -0.860262 -0.860138 -0.917884 -0.916473 -0.959818 -0.957916 -0.985340 -0.984039
36041 -0.787941 -0.789103 -0.860262 -0.860137 -0.917884 -0.916491 -0.959818 -0.957900
36042 -0.702166 -0.703879 -0.787941 -0.789111 -0.860262 -0.860152 -0.917884 -0.916481
36043 -0.604406 -0.605658 -0.702166 -0.703897 -0.787941 -0.789116 -0.860262 -0.860151
36044 -0.496340 -0.496429 -0.604406 -0.605682 -0.702166 -0.703888 -0.787941 -0.789124
36045 -0.379819 -0.378746 -0.496340 -0.496452 -0.604406 -0.605660 -0.702166 -0.703899
36046 -0.256839 -0.255274 -0.379819 -0.378759 -0.496340 -0.496422 -0.604406 -0.605667
36047 -0.129506 -0.128374 -0.256839 -0.255271 -0.379819 -0.378729 -0.496340 -0.496422
36048 -0.000000 0.000061 -0.129506 -0.128357 -0.256839 -0.255249 -0.379819 -0.378723
36049 0.129462 0.128455 -0.000000 0.000085 -0.129506 -0.128347 -0.256839 -0.255243
36050 0.256667 0.255207 0.129462 0.128478 -0.000000 0.000084 -0.129506 -0.128347
36051 0.379438 0.378378 0.256667 0.255224 0.129462 0.128472 -0.000000 0.000073
36052 0.495676 0.495605 0.379438 0.378387 0.256667 0.255219 0.129462 0.128448
36053 0.603396 0.604311 0.495676 0.495612 0.379438 0.378389 0.256667 0.255188
36054 0.700757 0.702087 0.603396 0.604321 0.495676 0.495621 0.379438 0.378355
36055 0.786098 0.787055 0.700757 0.702105 0.603396 0.604334 0.495676 0.495590
36056 0.857961 0.858002 0.786098 0.787079 0.700757 0.702118 0.603396 0.604309
36057 0.915124 0.914252 0.857961 0.858025 0.786098 0.787086 0.700757 0.702097
36058 0.956611 0.955360 0.915124 0.914266 0.857961 0.858025 0.786098 0.787068
36059 0.981720 0.980823 0.956611 0.955358 0.915124 0.914261 0.857961 0.858008
36060 0.990025 0.989990 0.981720 0.980804 0.956611 0.955353 0.915124 0.914246
36061 0.981391 0.982211 0.990025 0.989961 0.981720 0.980806 0.956611 0.955342
36062 0.955970 0.957145 0.981391 0.982181 0.990025 0.989973 0.981720 0.980801
36063 0.914204 0.915044 0.955970 0.957125 0.981391 0.982204 0.990025 0.989974
36064 0.856812 0.856842 0.914204 0.915039 0.955970 0.957153 0.981391 0.982208
36065 0.784782 0.784007 0.856812 0.856850 0.914204 0.915065 0.955970 0.957158
36066 0.699350 0.698242 0.784782 0.784022 0.856812 0.856866 0.914204 0.915067
36067 0.601983 0.601191 0.699350 0.698255 0.784782 0.784024 0.856812 0.856867
36068 0.494349 0.494324 0.601983 0.601196 0.699350 0.698242 0.784782 0.784027
36069 0.378295 0.379030 0.494349 0.494319 0.601983 0.601174 0.699350 0.698253
36070 0.255808 0.256860 0.378295 0.379019 0.494349 0.494294 0.601983 0.601194
36071 0.128986 0.129740 0.255808 0.256848 0.378295 0.378998 0.494349 0.494322
36072 0.000000 0.000031 0.128986 0.129730 0.255808 0.256836 0.378295 0.379028
36073 -0.128943 -0.129632 0.000000 0.000024 0.128986 0.129729 0.255808 0.256859
36074 -0.255637 -0.256627 -0.128943 -0.129637 0.000000 0.000032 0.128986 0.129739
36075 -0.377915 -0.378625 -0.255637 -0.256632 -0.128943 -0.129625 0.000000 0.000027
36076 -0.493687 -0.493713 -0.377915 -0.378632 -0.255637 -0.256622 -0.128943 -0.129639
36077 -0.600974 -0.600319 -0.493687 -0.493719 -0.377915 -0.378628 -0.255637 -0.256635
36078 -0.697944 -0.697004 -0.600974 -0.600321 -0.493687 -0.493724 -0.377915 -0.378630
36079 -0.782942 -0.782268 -0.697944 -0.696999 -0.600974 -0.600336 -0.493687 -0.493713
36080 -0.854517 -0.854492 -0.782942 -0.782257 -0.697944 -0.697021 -0.600974 -0.600311
36081 -0.911449 -0.912073 -0.854517 -0.854479 -0.782942 -0.782282 -0.697944 -0.696992
36082 -0.952770 -0.953668 -0.911449 -0.912063 -0.854517 -0.854503 -0.782942 -0.782257
36083 -0.977777 -0.978426 -0.952770 -0.953662 -0.911449 -0.912081 -0.854517 -0.854488
36084 -0.986049 -0.986084 -0.977777 -0.978424 -0.952770 -0.953674 -0.911449 -0.912079
36085 -0.977449 -0.976871 -0.986049 -0.986081 -0.977777 -0.978432 -0.952770 -0.953680
36086 -0.952131 -0.951297 -0.977449 -0.976862 -0.986049 -0.986089 -0.977777 -0.978439
36087 -0.910532 -0.909939 -0.952131 -0.951277 -0.977449 -0.976873 -0.986049 -0.986091
36088 -0.853370 -0.853363 -0.910532 -0.909912 -0.952131 -0.951294 -0.977449 -0.976868
36089 -0.781629 -0.782204 -0.853370 -0.853337 -0.910532 -0.909932 -0.952131 -0.951283
36090 -0.696540 -0.697354 -0.781629 -0.782188 -0.853370 -0.853356 -0.910532 -0.909921
36091 -0.599564 -0.600140 -0.696540 -0.697355 -0.781629 -0.782200 -0.853370 -0.853348
36092 -0.492363 -0.492371 -0.599564 -0.600159 -0.696540 -0.697357 -0.781629 -0.782196
36093 -0.376775 -0.376217 -0.492363 -0.492399 -0.599564 -0.600150 -0.696540 -0.697354
36094 -0.254780 -0.253986 -0.376775 -0.376245 -0.492363 -0.492386 -0.599564 -0.600146
36095 -0.128468 -0.127896 -0.254780 -0.254004 -0.376775 -0.376233 -0.492363 -0.492377
36096 -0.000000 0.000031 -0.128468 -0.127899 -0.254780 -0.253998 -0.376775 -0.376221
36097 0.128425 0.127915 -0.000000 0.000037 -0.128468 -0.127901 -0.254780 -0.253988
36098 0.254609 0.253873 0.128425 0.127922 -0.000000 0.000030 -0.128468 -0.127899
36099 0.376395 0.375873 0.254609 0.253871 0.128425 0.127917 -0.000000 0.000022
The 0° and 180° phases are correctly positioned, but the very first half wave – that which triggers the stereocilia, and humans being able to discriminate down to 10µs differences in the triggering time of same frequency bands between ears – is deformed. There is also quite a lot of quantization noise, and a spurious pre-pulse wave with significant amplitude (0.005, with quantization units of at 0.000030 or so). Essentially, the pulse leading edge is "smeared".
If you examine the full output of the above Python script, you'll see that after the first wave or so, the output wave tracks very closely to the initial signal. The error or difference between initial and final signals are concentrated around the beginning of the wave packet, and this is what affects the signal arrival time difference discrimination in human hearing.