Analog-to-Dgtal Convrson (Samplng and Quantzaton Dgtal Spch Procssng Lctur 5 Spch Codng Mthods Basd on Spch Wavform Rprsntatons and Spch Modls Unform and Non- Unform Codng Mthods Class of wavform codrs can b rprsntd n ths mannr Informaton Rat Spch Informaton Rats Wavform codr nformaton rat, I of th dgtal rprsntaton of th sgnal, ( t, dfnd as: a I = B F = B/ T w S whr B s th numbr of bts usd to rprsnt ach sampl and F numbr of sampls/scond S w =, s th T, Producton lvl: -5 phonms/scond for contnuous spch 3-64 phonms pr languag => 6 bts/phonm Informaton Rat=6-9 bps at th sourc Wavform lvl spch bandwdth from 4 khz => samplng rat from 8 khz nd -6 bt quantzaton for hgh qualty dgtal codng Informaton Rat=96-3 Kbps => mor than 3 ordrs of magntud dffrnc n Informaton Rats btwn th producton and wavform lvls 3 4 Spch Analyss/Synthss Systms Spch Codr Comparsons Scond class of dgtal spch codng systms: o analyss/synthss systms o modl-basd systms o hybrd codrs o vocodr (voc codr systms Dtald wavform proprts gnrally not prsrvd o codr stmats paramtrs of a modl for spch producton o codr trs to prsrv ntllgblty and qualty of rproducton from th dgtal rprsntaton 5 Spch paramtrs (th chosn rprsntaton ar ncodd for transmsson or storag analyss and ncodng gvs a data paramtr vctor data paramtr vctor computd at a samplng rat much lowr than th sgnal samplng rat dnot th fram rat of th analyss as F fr total nformaton rat for modl-basd codrs s: Im = Bc Ffr whr B c s th total numbr of bts rqurd to rprsnt th paramtr vctor 6
Spch Codr Comparsons Introducton to Wavform Codng wavform codrs charactrzd by: hgh bt rats (4 Kbps Mbps low complty low flblty analyss/synthss systms charactrzd by: low bt rats ( Kbps 6 bps hgh complty grat flblty (.g., tm panson/comprsson 7 n ( = ( nt a jωt jπ k X ( = Xa( jω+ T T k = jω jω jπ k ω =ΩT X( = Xa( + T T T k = 8 Introducton to Wavform Codng Samplng Spch Sounds T=/ F s to prfctly rcovr a (t (or quvalntly a lowpass fltrd vrson of t from th st of dgtal sampls (as yt unquantzd w rqur that F s = /T > twc th hghst frquncy n th nput sgnal ths mpls that a (t must frst b lowpass fltrd snc spch s not nhrntly lowpass for tlphon bandwdth th frquncy rang of ntrst s -3 Hz (fltrng rang => F s = 64 Hz, 8 Hz for wdband spch th frquncy rang of ntrst s -7 Hz (fltrng rang => F s = 6 Hz 9 notc hgh frquncy componnts of vowls and frcatvs (up to khz => nd F s > khz wthout lowpass fltrng nd only about 4 khz to stmat formant frquncs nd only about 3. khz for tlphon spch codng Tlphon Channl Rspons Statstcal Modl of Spch assum a (t s a sampl functon of a contnuous-tm random procss thn (n (drvd from a (t by samplng s also a sampl squnc of a dscrt-tm random procss a (t has frst ordr probablty dnsty, p(, wth autocorrlaton and powr spctrum of th form [ τ ] φ ( τ = E ( t ( t + a a a t s clar that 4 khz bandwdth s suffcnt for most applcatons usng tlphon spch bcaus of nhrnt channl band lmtatons from th transmsson path Φa( Ω = φa( τ jωτ dτ
Statstcal Modl of Spch n ( has autocorrlaton and powr spctrum of th form: φ( m = E[ ( n ( n+ m ] = E[ a( nt a( nt + mt ] = φa( mt jωt jωtm Φ ( = φ( m m= π k = Φa( Ω+ T k = T snc φ( m s a sampld vrson of φa( τ, ts transform s an nfnt sum π k of th powr spctrum, shftd by => alasd vrson of th powr T spctrum of th orgnal analog sgnal 3 Spch Probablty Dnsty Functon probablty dnsty functon for (n s th sam as for a (t snc (n= a (nt => th man and varanc ar th sam for both (n and a (t nd to stmat probablty dnsty and powr spctrum from spch wavforms probablty dnsty stmatd from long trm hstogram of ampltuds good appromaton s a gamma dstrbuton, of th form: / 3 3 p ( = p( = 8 π smplr appromaton s Laplacan dnsty, of th form: p ( = p( = 4 Masurd Spch Dnsts dstrbuton normalzd so man s and varanc s (=, = gamma dnsty mor closly appromats masurd dstrbuton for spch than Laplacan Laplacan s stll a good modl and s usd n analytcal studs small ampltuds much mor lkly than larg ampltuds by : rato 5 Long-Tm Autocorrlaton and Powr Spctrum analog sgnal jωτ φa( τ = E{ a( t a( t + τ } Φa( Ω = φa( τ dτ dscrt-tm sgnal φ( m = E{ nn ( ( + m } = E{ a( nt a( nt+ mt } = φa( mt j Ω T j Ω Tm π k Φ ( = φ( m = Φa( Ω+ m= T k= T stmatd corrlaton and powr spctrum Estmats Epctatons L m ˆ( φ m = ( n ( n+ m, m L, taprng wth m du to L n= fnt wndows L s larg ntgr nd wndow on stmatd M corrlaton for smoothng ˆ jωt ( ( ˆ jωtm Φ = w mφ( m bcaus of dscontnuty at m= M ±M 6 Spch AC and Powr Spctrum Spch Powr Spctrum can stmat long trm autocorrlaton and powr spctrum usng tm-srs analyss mthods ˆ[ φ m] ˆ[ ρ m ] = ˆ[ φ ] L m n ( n ( + m L n= =, L m n ( L n= m L, L s wndow lngth Bandpass fltrd spch Lowpass fltrd spch 8 khz sampld spch for svral spakrs hgh corrlaton btwn adjacnt sampls lowpass spch mor hghly corrlatd than bandpass spch powr spctrum stmat drvd from on mnut of spch paks at 5-5 Hz (rgon of mamal spctral nformaton spctrum falls at about 8- db/octav computd from st of bandpass fltrs 7 8 3
Altrnatv Powr Spctrum Estmat stmat long trm corrlaton, ˆ φ( m, usng sampld spch, thn wght and transform, gvng: Φ ˆ ( = M w( m ˆ φ( m πk j / N j πkm/ N m= M ths lts us us ˆ φ( m to gt a powr spctrum stmat Φˆ j ( π k / N va th wghtng wndow, wm ( Contrast lnar vrsus logarthmc scal for powr spctrum plots 9 Estmatng Powr Spctrum va Mthod of Avragd Prodograms Prodogram dfnd as: P ( = nwn ( ( LU L jω jωn n= whr wn [ ] s an L-pont wndow (.g., Hammng wndow, and L U = ( w( n L n= U s a normalzng constant that compnsats for wndow taprng us th DFT to comput th prodogram as: L j( πk/ N j( π/ N kn P ( = nwn ( (, k N, LU N s sz of DFT n= Avragng (Short Prodograms varablty of spctral stmats can b rducd by avragng short prodograms, computd ovr a long sgmnt of spch usng an L-pont wndow, a short prodogram s th sam as th STFT of th wghtd spch ntrval, namly: Xr[ k] = X ( rr+ L = [ m] w[ rr m], k N πk j / N j πkm/ N rr m= rr whr N s th DFT transform sz (numbr of frquncy stmats Consdr usng N sampls of spch (whr N s larg; th S S avragd prodogram s dfnd as: Φ ( K = X KLU r= (, k N πk j / N j πk/ N rr whr K s th numbr of wndowd sgmnts n N sampls, S L s th wndow lngth, and U s th wndow normalzaton factor us R= L/(shft wndow by half th wndow duraton btwn adjacnt prodogram stmats 88,-Pont FFT Fmal Spakr Sngl spctral stmat usng all sgnal sampls Long Tm Avrag Spctrum Long Tm Avrag Spctrum Fmal spakr Mal spakr 3 4 4
Instantanous Quantzaton sparatng th procsss of samplng and quantzaton assum (n obtand by samplng a bandlmtd sgnal at a rat at or abov th Nyqust rat assum (n s known to nfnt prcson n ampltud nd to quantz (n n som sutabl mannr 5 Quantzaton and Codng assum Δ =Δ Codng s a two-stag procss. quantzaton procss: n ( n ˆ(. ncodng procss: n ˆ( cn ( - whr Δ s th (assumd fd quantzaton stp sz Dcodng s a sngl-stag procss. dcodng procss: c ( n ˆ ( n f c ( n = c( n, (no rrors n transmsson thn ˆ ( n = ˆ( n ˆ ( n ( n codng and 6 quantzaton loss nformaton B-bt Quantzaton us B-bt bnary numbrs to rprsnt th quantzd sampls => B quantzaton lvls Informaton Rat of Codr: I=B F S = total bt rat n bts/scond B=6, F S = 8 khz => I=8 Kbps B=8, F S = 8 khz => I=64 Kbps B=4, F S = 8 khz => I=3 Kbps goal of wavform codng s to gt th hghst qualty at a fd valu of I (Kbps, or quvalntly to gt th lowst valu of I for a fd qualty snc F S s fd, nd most ffcnt quantzaton mthods to mnmz I 7 Quantzaton Bascs assum (n X ma (possbly for Laplacan dnsty (whr X ma =, can show that.35% of th sampls fall outsd th rang -4 (n 4 => larg quantzaton rrors for.35% of th sampls can safly assum that X ma s proportonal to 8 Quantzaton Procss quantzaton => dvdng ampltud rang nto a fnt st of rangs, and assgnng th sam bn to all sampls n a gvn rang 3-bt quantzr => 8 lvls Unform Quantzaton choc of quantzaton rangs and lvls so that sgnal can asly b procssd dgtally = < ( n ˆ ( < ( n ˆ ( < ( n ˆ ( 3 3 < ( n < ˆ ( 3 4 < ( n = ˆ ( < ( n ˆ ( < ( n ˆ ( 3 3 < n ( ˆ ( 3 4 rang lvl codword codwords ar arbtrary!! => thr ar good chocs that can b mad (and bad chocs 9 md-rsr = Δ ˆ ˆ = Δ md-trad Δ= quantzaton stp sz 3 5
Md-Rsr and Md-Trad Quantzrs md-rsr orgn (= n mddl of rsng part of th starcas sam numbr of postv and ngatv lvls symmtrcal around orgn md-trad orgn (= n mddl of quantzaton lvl on mor ngatv lvl than postv on quantzaton lvl of (whr a lot of actvty occurs cod words hav drct numrcal sgnfcanc (sgn-magntud rprsntaton for md-rsr, two s complmnt for md-trad - for md-rsr quantzr: Δ n ˆ( = sgncn [ ( ] +Δcn ( whr sgncn [ ( ] =+ f frst bt of cn ( = = f frst bt of cn ( = - for md-trad quantzr cod words ar 3-bt two's complmnt rprsntaton, gvng n ˆ( =Δcn ( 3 A-to-D and D-to to-a Convrson ˆ B [n] ˆ [n] [n] n [ ] = n ˆ[ ] n [ ] Quantzaton rror 3 Quantzaton of a Sn Wav Δ Δ Unquantzd snwav 3-bt quantzaton wavform 3-bt quantzaton rror 8-bt quantzaton rror 33 Quantzaton of Compl Sgnal [ n] = sn(. n +.3cos(.3 n (a Unquantzd sgnal (b 3-bt quantzd [n] (c 3-bt quantzaton rror, [n] (d 8-bt quantzaton rror, [n] 34 Unform Quantzrs Unform Quantzrs charactrzd by: numbr of lvls B (B bts quantzaton stp sz-δ f (n X ma and (n s a symmtrc dnsty, thn Δ B = X ma Δ= X B ma / f w lt n ˆ( = n ( + n ( wth (n th unquantzd spch sampl, and (n th quantzaton rror (nos, thn Δ Δ n ( (cpt for last quantzaton lvl whch can cd X ma and thus th rror can cd Δ/ 35 Quantzaton Nos Modl. quantzaton nos s a zro-man, statonary wht nos procss Enn [ ( ( + m ] =, m= = othrws. quantzaton nos s uncorrlatd wth th nput sgnal E[ ( n ( n+ m ] = m 3. dstrbuton of quantzaton rrors s unform ovr ach quantzaton ntrval Δ p( = / Δ Δ/ Δ/ =, = = othrws 36 6
Quantzaton Eampls Typcal Ampltud Dstrbutons Laplacan dstrbuton s oftn usd as a modl for spch sgnals Spch Sgnal how good s th modl of th prvous sld? 3-bt Quantzaton Error A 3-bt quantzd sgnal has only 8 dffrnt valus 8-bt Quantzaton Error (scald 37 38 3-Bt Spch Quantzaton 3-Bt Spch Quantzaton Error Input to quantzr Input to quantzr 3-bt quantzaton wavform 3-bt quantzaton rror 39 4 5-Bt Spch Quantzaton 5-Bt Spch Quantzaton Error Input to quantzr Input to quantzr 5-bt quantzaton wavform 5-bt quantzaton rror 4 4 7
Hstograms of Quantzaton Nos Spctra of Quantzaton Nos 3-bt quantzaton hstogram db 8-bt quantzaton hstogram 43 44 Corrlaton of Quantzaton Error Sound Dmo Orgnal spch sampld at 6kHz, 6 bts/sampl Quantzd to bts/sampl 3-bt Quantzaton Quantzaton rror (3 for bts/sampl Quantzd to 5 bts/sampl 8-bt Quantzaton assumptons look good at 8-bt quantzaton, not as good at 3-bt lvls 45 (howvr only 6 db varaton n powr spctrum lvl Quantzaton rror for 5 bts/sampl 46 SNR for Quantzaton can dtrmn SNR for quantzd spch as ( ( n ( ( n E n E n SNR = = = ( n ( n Xma Δ= (unform quantzr stp sz B Δ Δ assum p ( = (unform dstrbuton Δ = othrws Δ Xma = = B ( 3 47 SNR for Quantzaton can dtrmn SNR for quantzd spch as ( ( n ( ( n SNR = = = ( n E E n ( n n Δ Xma = = ( 3 B = B ( 3 ; ( = log = 6 X + 4. 77 log ma X 4 SNR 6B 7 ma X ma SNR SNR db B f w choos =, thn =. B = 6, SNR = 88. 8 db B = 8, SNR = 4. 8 db B = 3, SNR =. 8 db Th trm X ma / tlls how bg a sgnal can b accuratly rprsntd 48 8
Varaton of SNR wth Sgnal Lvl Clppng Statstcs Ovrload from clppng SNR mprovs 6 db/bt, but t dcrass 6 db for ach halvng of th nput sgnal ampltud db 49 5 Rvw--Lnar Nos Modl E{( [ n] } = assum spch s statonary random sgnal. rror s uncorrlatd wth th nput. E{ nn [ ] [ ]} = E{ n [ ]} E{ n [ ]} = rror s unformly dstrbutd ovr th ntrval Δ ( / < n [ ] ( Δ/. rror s statonary wht nos, (.. flat spctrum Δ P ( ω = =, ω π 5 Rvw of Quantzaton Assumptons. nput sgnal fluctuats n a complcatd mannr so a statstcal modl s vald. quantzaton stp sz s small nough to rmov any sgnal corrlatd pattrns n quantzaton rror 3. rang of quantzr matchs pak-to-pak rang of sgnal, utlzng full quantzr rang wth ssntally no clppng 4. for a unform quantzr wth a pak-topak rang of ±4, th rsultng SNR(dB s 6B-7. 5 Unform Quantzr SNR Issus SNR=6B-7. to gt an SNR of at last 3 db, nd at last B 6 bts (assumng X ma =4 ths assumpton s wak across spakrs and dffrnt transmsson nvronmnts snc vars so much (ordr of 4 db across sounds, spakrs, and nput condtons SNR(dB prdctons can b off by sgnfcant amounts f full quantzr rang s not usd;.g., for unvocd sgmnts => nd mor than 6 bts for ral communcaton systms, mor lk - bts nd a quantzng systm whr th SNR s ndpndnt of th sgnal lvl => constant prcntag rror rathr than constant varanc rror => nd non-unform quantzaton Instantanous Compandng to ordr to gt constant prcntag rror (rathr than constant varanc rror, nd logarthmcally spacd quantzaton lvls quantz logarthm of nput sgnal rathr than nput sgnal tslf 53 54 9
μ-law Compandng μ-law Compandng [n] μ Law Compandr y[n] Quantzr y ˆ [n] yn ( = ln n ( n ( = p [ y( n ] sgn [ ( n ] whr sgn[ n ( ] = + n ( = n ( < th quantzd log magntud s y(n ˆ = Q [ log (n ] = log n ( + ε( n nw rror sgnal 55 assum that ε( n s ndpndnt of log ( n. Th nvrs s (n ˆ = p y(n ˆ sgn[ ( n ] = n ( sgnn [ ( ] p [ ε( n ] = n ( p [ ε( n ] [ ] (n ˆ = ( n [ + ε ] ε assum ε( n s small, thn p ε( n + ε( n +... ( n = n ( + ( nn ( = n ( + fn ( snc w assum n ( and ε( n ar ndpndnt, thn f = ε SNR = = f ε SNR s ndpndnt of --t dpnds only on stp sz 56 Psudo-Logarthmc Comprsson unfortunatly tru logarthmc comprsson s not practcal, snc th dynamc rang (rato btwn th largst and smallst valus s nfnt => nd an nfnt numbr of quantzaton lvls nd an appromaton to logarthmc comprsson => μ-law/a-law comprsson [ ] y(n = F (n μ-law Comprsson n ( log + μ Xma = X ma sgn[ (n ] log( + μ whn n ( = yn ( = whn μ =, yn ( = n ( lnar comprsson whn μ s larg, and for larg n ( X μ n ( yn logμ Xma ma ( log 57 58 Hstogram for μ -Law Compandng Spch wavform μ-law appromaton to log μ law ncodng gvs a good appromaton to constant prcntag rror ( yn ( log n ( Output of μ-law compandr 59 6
SNR for μ-law Quantzr μ-law Compandng SNR( db = 6B + 4. 77 log [ ln( + μ ] log X ma Xma + + μ μ 6 B dpndnc on B good Xma much lss dpndnc on good Xma for larg μ, SNR s lss snstv to changs n good - μ-law quantzr usd n wrln tlphony for mor than 4 yars Mu-law comprssd sgnal utlzs almost th full dynamc rang (± much mor ffctvly than th orgnal spch sgnal 6 6 μ-law Quantzaton Error (a Input spch sgnal Comparson of Lnar and μ-law Quantzrs Dashd ln lnar (unform quantzrs wth 6, 7, 8 and bt quantzrs (b Hstogram of μ=55 comprssd spch Sold ln μ- law quantzrs wth 6, 7 and 8 bt quantzrs (μ= (c Hstogram of 8- bt compandd quantzaton rror 63 can s n ths plots that X ma charactrzs th quantzr (t spcfs th ovrload ampltud, and charactrzs th sgnal (t spcfs th sgnal ampltud, wth th rato (X ma / showng how th sgnal s matchd to th quantzr 64 Comparson of Lnar and μ-law Quantzrs Dashd ln lnar (unform quantzrs wth 6, 7, 8 and 3 bt quantzrs Sold ln μ- law quantzrs wth 6, 7 and 8 bt quantzrs (μ=55 65 Analyss of μ-law Prformanc curvs show that μ-law quantzaton can mantan roughly th sam SNR ovr a wd rang of X ma /, for rasonably larg valus of μ for μ=, SNR stays wthn db for 8< X ma / <3 for μ=5,, SNR stays wthn db for 8< X ma / <5 loss n SNR n gong from μ= to μ=5 s about.6 db => rathr small sacrfc for much gratr dynamc rang B=7 gvs SNR=34 db for μ= => ths s 7-bt μ-law PCM-th standard for toll qualty spch codng n th PSTN => would nd about bts to achv ths dynamc rang and SNR usng a lnar quantzr 66
CCITT G.7 Standard Mu-law charactrstc s appromatd by 5 lnar sgmnts wth unform quantzaton wthn a sgmnt. uss a md-trad quantzr. + and ar dfnd. dcson and rconstructon lvls dfnd to b ntgrs A-law charactrstc s appromatd by 3 lnar sgmnts uss a md-rsr quantzr 67 Summary of Unform and μ-law PCM quantzaton of sampl valus s unavodabl n DSP applcatons and n dgtal transmsson and storag of spch w can analyz quantzaton rror usng a random nos modl th mor bts n th numbr rprsntaton, th lowr th nos. Th fundamntal thorm of unform quantzaton s that th sgnal-to-nos rato ncrass 6 db wth ach addd bt n th quantzr ; howvr, f th sgnal lvl dcrass whl kpng th quantzr stpsz th sam, t s quvalnt to throwng away on bt for ach halvng of th nput sgnal ampltud μ-law comprsson can mantan constant SNR ovr a wd dynamc rang, thrby rducng th dpndncy on sgnal lvl rmanng constant 68 Quantzaton for Optmum SNR (MMSE goal s to match quantzr to actual sgnal dnsty to achv optmum SNR μ-law trs to achv constant SNR ovr wd rang of sgnal varancs => som sacrfc ovr SNR prformanc whn quantzr stp sz s matchd to sgnal varanc f s known, you can choos quantzr lvls to mnmz quantzaton rror varanc and mamz SNR 69 Quantzaton for MMSE f w know th sz of th sgnal (.., w know th sgnal varanc, thn w can dsgn a quantzr to mnmz th man-squard quantzaton rror. th basc da s to quantz th most probabl sampls wth low rror and last probabl bl wth hghr h rror. ths would mamz th SNR gnral quantzr s dfnd by dfnng M rconstructon lvls and a st of M dcson lvls dfnng th quantzaton slots. ths problm was frst studd by J. Ma, Quantzng for Mnmum Dstorton, IRE Trans. Info. Thory, March,96. 7 Quantzr Lvls for Mamum SNR varanc of quantzaton nos s: ( ( ˆ( ( = E n = E n n wth n ˆ( = Qn [ ( ]. Assum Mquantzaton lvls ˆ, ˆ,..., ˆ ˆ ˆ,,..., ( + M M M ( / ( / / assocatng quantzaton lvl wth sgnal ntrvals as: ˆ quantzaton lvl for ntrval j =, j j for symmtrc, zro-man dstrbutons, wth larg ampltuds ( t maks sns to dfn th boundary ponts: = (cntral boundary pont, ± M / = ± th rror varanc s thus = p( d 7 Optmum Quantzaton Lvls by dfnton, = ˆ ; thus w can mak a chang of varabls to gv: p ( ( ˆ = p = p ( / ˆ = p( / ˆ gvng = M / ˆ / + = M ( p ( d assumng p ( = p( so that th optmum quantzr s antsymmtrc, thn ˆ ˆ = and = thus w can wrt th rror varanc as M / = ( ˆ p ( d = goal s to mnmz through chocs of { } and { ˆ } 7
Soluton for Optmum Lvls Optmum Quantzrs for Laplac Dnsty ˆ th paramtrs, st th drvatv to, and solv numrcally: to solv for optmum valus for { } and { }, w dffrntat wrt ( ˆ p( d = =,,..., M/ ( = ( ˆ ˆ + =,,..., M/ ( + wth boundary condtons of =, = ± ( 3 ± M / can also constran quantzr to b unform and solv for valu of Δ that mamzs SNR - optmum boundary ponts l halfway btwn M / quantzr lvls - optmum locaton of quantzaton lvl ˆ s at th cntrod of th probablty dnsty ovr th ntrval to - solv th abov st of quatons (,,3 tratvly for ˆ, { } { } 73 Assums = M. D. Paz and T. H. Glsson, Mnmum Man-Squard Error Quantzaton In Spch, IEEE Trans. Comm., Aprl 97. 74 Optmum Quantzr for 3-bt Laplac Dnsty; Unform Cas Prformanc of Optmum Quantzrs quantzaton lvls gt furthr apart as th probablty dnsty dcrass stp sz dcrass roughly ponntally 75 wth ncrasng numbr of bts 76 Summary amnd a statstcal modl of spch showng probablty dnsts, autocorrlatons, and powr spctra studd nstantanous unform quantzaton modl and drvd SNR as a functon of th numbr of bts n th quantzr, and th rato of sgnal pak to sgnal varanc studd a compandd modl of spch that appromatd logarthmc comprsson and showd that t th rsultng SNR was a wakr functon of th rato of sgnal pak to sgnal varanc amnd a modl for drvng quantzaton lvls that wr optmum n th sns of matchng th quantzr to th actual sgnal dnsty, thrby achvng optmum SNR for a gvn numbr of bts n th quantzr 77 3