MIT OpenCourseWare http://ocw.mit.edu MAS.160 / MAS.510 / MAS.511 Signals, Systems and Information for Media Technology Fall 2007 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Shannon Sampling Theorem Sampling f s > 2 f max x ( t ) = cos(2 1500t) f s = 2 f max t = Tsn fo = 1 x [ n ] = cos(2 �1500 � Tsn ) t = Tsn f max < f s 2 Ts = Nyquist rate 1 fs 1500 Hz 0.5 f s = 8000 Hz Ts = 1 = 8000 sec 1 fs fs = 8000Hz 0 -0.5 1 x [ n ] = cos(2 �1500 � 8000 n) f o = 1 -1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 2 x 10-3 oversampling 1 1500 Hz 0.8 2A 0.5 0.6 0.4 0 0.2 � f max 2 -0.5 0 -1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 -1 x 10 -0.5 � fs 2 � f2s Time domain 0.9 0.6 0.8 0.4 x 0.2 1 fs x 104 sampled sinewave sampling 0.6 0.5 -0.2 0.4 -0.4 0.3 -0.6 0.2 1500 Hz 1 0.5 0 0.1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 0 2 x 10 -3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 10-4 Ts 0 2Ts 3Ts -0.5 4Ts Frequency domain 1 1 0.9 0.9 0.8 0.8 0.7 -1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 2 x 10-3 oversampling 1 � fo 0.8 fo 0.7 0.6 0.6 0.6 2A 0.5 comb 0.5 0.4 0.4 0.3 � fs + fo 2A 0.4 � f2s 0.2 0.3 fs � fo fs + fo � fs � fo 0.2 fs 2 0.2 0 0.1 0.1 0 fs 2 0.7 0 -0.8 2A fo Hz 1 0.8 -1 0 f - freq -3 1500 Hz 1 � fo f max 2 0.5 -1 -0.5 0 f/fs - freq � fo 0.5 1 x 10 fo 4 0 -2 -1.5 �2 f s -1 -0.5 � fs 0 0.5 1 fs 1.5 2 x 104 2 f s -1 -0.5 0 ff - freq Hz 0.5 1 x 104 sinewave spectrum copied around each comb “tooth” D-to-C only reconstructs frequencies between � fs 2 � f � fs 2 Normalized frequency Sampling: Folding x[n] = x(nTs ) = cos(2f o nTs ) = cos(� o nTs ) f̂ = �ˆ (2 ) = fTs = f f s �ˆ = �Ts ˆ ) = cos(n�ˆ ) x[n] = cos(2fn fo = 1 fs 2 < fo < fs 0.5 < f̂ o < 1 1500 Hz fo = 1 f s = 8000 Hz 5600 Hz f o �, f apparent � 0.5 0.5 f apparent = f s � f o 0 -0.5 -1 0 0.2 0.4 0.6 0.8 1.4 �1+ f o f s 0.6 0.4 1.2 1.6 1.8 2 x 10-3 waveform spectrum copies centered at integer values of f̂ f̂ = f o f s � fo fs 0.8 2A 1 t - sec oversampling 1 o +freq x -freq R -copy B orig G +copy 0 frequencies divided by sampling rate 1� f o f s �1� f o f s o +freq x -freq K 2nd - copy R 1st -copy B orig G 1st +copy K 2nd +copy 2A -1 = 2400Hz 0 0.2 0.4 0.6 0.8 1 t - sec �1+ f o f s 0.8 0.4 1.4 1.6 1.8 2 x 10-3 folding 1 0.6 1.2 f̂ Bo > 1� f o f s � fo fs fo fs 2 � fo fs �2 + f o f s reconstructed -1 -0.5 0 0.5 f̂f - freq 1 f̂ max < 0 > f̂Gx > 0.2 Shannon Sampling Theorem 1.5 1 2 f̂ Bx < � 12 1+ f o f s 0.2 0 -1.5 = 8000 � 5600Hz -0.5 0 -1.5 -1 -0.5 0 0.5 f̂f - freq 1 2 Sampling: Aliasing 1 1.5 � < f̂ Ro < 0 x >o " flipped" Sampling: f s � f o < 1.5 f s 1 � f̂ o < 1.5 f o = 8700 Hz 1 f s = 8000 Hz f apparent = f o � f s 0 = 8700 � 8000Hz = 800Hz -0.5 o +freq x -freq K 2nd - copy R 1st -copy B orig G 1st +copy K 2nd +copy 2A -1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 2 x 10-3 apparent frequency f o �, f apparent � 0.5 fs 2 … aliasing 1 �1+ f o f s 0.8 oversampled fold 0 fs f̂ Bo > 1 1� f o f s f̂ Bx < �1 alias fs 2 0.6 2 � fo fs 0.4 0.2 0 -1.5 � fo fs -1 -0.5 0 f - freq 0.5 reconstructed fo fs �2 + f o f s 1 0 > f̂ Ro > 1.5 1 2 � 12 < f̂Gx < 0 o> x 1 2 1 2 input frequency fo freqramp Vary Sample rate Vary Sample rate x(t ) = cos(2 1200t ) t = Tsn x(t ) = cos(2 1200t ) t = Tsn var y Ts x[n] = cos(2 �1200 � Ts n) fs=4200 Hz, 1 fo=1200Hz folding fo=1200Hz 0.5 0 0 -0.5 -0.5 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 -1 2 x 10-3 0 0.2 0.4 0.6 0.8 oversampling 1 1 t - sec 1.2 1.4 1.6 1.8 2 x 10-3 folding 1 0.8 0.8 0.6 2A fs=1900 Hz, 1 0.5 -1 var y Ts x[n] = cos(2 �1200 � Ts n) � fs 2 fs 2 � f2s 0.6 fs 2 2A 0.4 0.4 0.2 0.2 0 -6000 -4000 -2000 0 f/fsf- freq 2000 4000 0 6000 -2500 -2000 Sampling: Composite Signal fs=3800 Hz, -1000 -500 0 500 f/fsf - freq 1000 1500 2000 changerate 2500 Sampling: Composite Signal x ( t ) = cos(2 1200t ) + cos(2 600t ) x [ n ] = cos(2 �1200 � Tsn ) + cos(2 � 600 � Tsn ) 1 -1500 x ( t ) = cos(2 1200t ) + cos(2 600t ) x [ n ] = cos(2 �1200 � Tsn ) + cos(2 � 600 � Tsn ) f s = 3800Hz fo=1200Hz, f1=600Hz fs=2200 Hz, 1 f s = 2200Hz fo=1200Hz, f1=600Hz 0.5 0.5 0 0 -0.5 -0.5 -1 o +freq1 x -freq1 d +freq2 + -freq2 R -copy B orig 2A G +copy 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 2 x 10-3 oversampling 1 0.8 0.6 0.4 0.2 o +freq1 x -freq1 d +freq2 + -freq2 K 2nd - copy R 1st - copy B orig G 1st +copy K 2nd +copy -1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 -3 1200Hz folded 600Hz oversample folding 1 2 x 10 0.8 0.6 0.4 0.2 0 -1.5 -1 -0.5 0 f/fs - freq 0.5 1 1.5 0 -1.5 -1 -0.5 0 f/fs - freq 0.5 1 1.5 Resampling Sampling: Composite Signal x ( t ) = cos(2 1200t ) + cos(2 600t ) x [ n ] = cos(2 �1200 � Tsn ) + cos(2 � 600 � Tsn ) fs=1000 Hz, 1 fs = 1000Hz fo=1200Hz, f1=600Hz Resized (nearest­ Neighbor) no pre-blur 0.5 0 -0.5 o +freq1 x -freq1 d +freq2 + -freq2 K 2nd - copy R 1st - copy B orig G 1st +copy K 2nd +copy -1 0 0.2 0.4 0.6 0.8 1 t - sec 1.2 1.4 1.6 1.8 2 x 10-3 folding 1 1200Hz folded 600Hz fold 0.8 Resized (nearestNeighbor) with pre-blur 0.6 0.4 0.2 0 -1.5 -1 -0.5 0 f/fs - freq 0.5 1 Psychophysics:Vision 1.5 Courtesy of Sean T. McHugh. Used with permission. Aliased Voice Expt. Color Matching Surround field Psychophysics Test light the relationship between physical stimuli and what you perceive absolute thresholds, discrimination thresholds, and scaling. T Bipartite white screen Subject Threshold: the point of intensity that you can just detect the presence of, or difference in, a stimulus. absolute threshold -- level at which the subject is able to detect the presence of the stimulus (50%) R difference threshold -- the difference between two stimuli of differing intensities you can detect (50%) adjust one stimulus until it is perceived as the same as the other, describe the magnitude of the difference between two stimuli detect a stimulus against a background. discrimination experiments --what point the difference between two stimuli is detectable. RGB mixed light G B Primary lights Figure by MIT OpenCourseWare. After Wandell, Foundations of Vision. http://en.wikipedia.org/wiki/Psychophysics Turn knobs for R,G, &B until combined light matches color of test light. http://www.ling.upenn.edu/courses/ling525/color_vision.html Psychophysics: Vision Psychophysics: Vision Unsharp Mask 200 50 00 50 0 20 40 Courtesy of Wayne Fulton, http://www.scantips.com. Used with permission. 250 By exaggerating contrast along edges in the image, the edges stand out more, making them 200 appear sharper.” 50 00 50 0 0 20 40 Psychophysics: Vision Unsharp Mask before Psychophysics: Vision Unsharp Mask 200 200 50 50 original 00 50 0 20 40 00 50 + 0 20 40 after unsharp mask invert + blur 250 200 50 00 50 0 250 “unsharp mask” 200 50 00 50 0 20 40 0 0 20 40 Psychoacoustics: Sound Masking You know I can't hear you when the water is running! This statement carries the essentials of the conventional wisdom about sound masking. Low- frequency, broad banded sounds (like water running) will mask higher frequency sounds which are softer at the listener's ear (a conversational tone from across the room) Image removed due to copyright restrictions. http://hyperphysics.phy-astr.gsu.edu/hbase/sound/mask.html Chirp +1200Hz Broadband white noise tends to mask all frequencies, and is approximately linear in that masking. By linear you mean that if you raise the white noise by 10 dB, you have to raise everything else 10 dB to hear it. -- http://hyperphysics.phy-astr.gsu.edu/hbase/sound/mask.html Psychoacoustics The following MATLAB function performs a simple psychoacoustic test. It creates bandlimited noise, centered at 1000 Hz and also creates a sinusoid. It then plays the noise alone and then the noise plus the sinusoid. Try different values of f and A to see whether you can detect the sinusoid. For a particular value of f we’ll call Amin(f) the minimum amplitude at which the frequency f sinusoid could still be heard. Plot several values on the graph of f vs. Amin to determine a simple masking curve. A typical masking experiment might proceed as follows. A short, about 400 msec, pulse of a 1,000 Hz sine wave acts as the target, or the sound the listener is trying to hear. Another sound, the masker, is a band of noise centered on the frequency of the target (the masker could also be another pure tone). The intensity of the masker is increased until the target cannot be heard Psychoacoustics Minimum audible sinusoid amplitude with noise centered at 1000Hz (A=1) mask.m plays noise, then noise plus a sinewave of amplitude A and frequency f. You are supposed to determine the smallest amplitude that you can hear the sinewave over the noise. Repeat this for several values of f, and plot f vs. Amin. 0.25 0.20 mask.m is linked in the assignments section. 0.15 Amin Tip: In mask.m change sound(wf,22050) A %add so you get feedback of A %pause %comment out, so you don’t wait sound(wf+s,22050) >> f=1000; for A=0.01:.01:.1; mask(f,A); end Press cmd+. to stop when you detect sinewave. 0.10 0.05 0.00 0 2000 4000 6000 f 8000 10000 12000 f Amin 250 0.0003 500 0.00003 750 0.006 825 0.03 900 0.19 1000 0.215 1100 0.19 1250 0.08 1500 0.074 1750 0.052 2000 0.07 3000 0.04 4000 0.014 5000 0.0023 6000 0.001 7000 0.0012 8000 0.0007 9000 0.0004 10000 0.0007