Like the Fourier transform a constant Q transform is a bank of 57356lters but in contrast to the former it has geometrically spaced center frequencies 0 where dictates the number of 57356lters per octave To make the 57356lter domains adjectant one ID: 8891
Download Pdf The PPT/PDF document "The Constant Q Transform Benjamin Blanke..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
TheConstantQTransform[BenjaminBlankertz]1IntroductionTheconstantQtransformasintroducedin[Brown,1991]isverycloserelatedtotheFouriertransform.LiketheFouriertransformaconstantQtransformisabankoflters,butincontrasttotheformerithasgeometricallyspacedcenterfrequencies ),wheredictatesthenumberofltersperoctave.Tomakethelterdomainsadjectantonechoosesthebandwidthofthe-thlteras 1).Thisyieldsaconstantratiooffrequencytoresolution =(2 .WhatmakestheconstantQtransformsousefulisthatbyanappropriatechoicefor(minimalcenterfrequency)andthecenterfrequenciesdirectlycorrespondtomusicalnotes.Forinstancechoosing=12andasthefrequencyofmidinote0makesthe-thcq-bincorrespondthemidinotenumberAnothernicefeatureoftheconstantQtransformisitsincreasingtimeresolutiontowardshigherfrequencies.Thisresemblesthesituationinourauditorysystem.Itisnotonlythedigitalcomputerthatneedsmoretimetoperceivethefrequencyofalowtonebutalsoourauditorysense.Thisisrelatedtomusicusuallybeinglessagitatedinthelowerregisters.2DerivingFilterParametersfortheConstantQTransformToderivethecalculationoftheconstantQtransformofsomesequencewebeginwithaninspectionofthefamiliarformulaofaFourierlterattn]e2inz=NEachcomponentoftheconstantQtransform,inthesequelcalledcq-bin,willbecalculatedassuchalter,butsuitablevaluesforandwindowlengthhavetobefoundinordertomatchthepropertiesdiscussedabove.Thebandwidthofthelter(1)isdenotesthesamplingrate)independentlyof.Thusthedesiredbandwidthcanberealizedbychoosingawindowoflength k=Qfs .Thefrequencytoresolutionratioofthelterin(1)is .Toachieveaconstantvalue forthefrequencytoresolutionratioofeachcq-binonehastoselectThusforintegervaluesthe-thcq-binisthe-thDFT-binwithwindowlength Summerizingwegetthefollowingrecipeforthecalculationofacon-stantQtransform:Firstchooseminimalfrequencyandthenumberofbinsperoctaveaccordingtotherequirementsoftheapplication.Themax-imalfrequencymaxonlyaectsthenumberofcq-binstobecalculatedmax :=(2 andforkKset k]:= n]wNk[n]e2inToreducespectralleakage(cf.[Harris,1978]),itisadvisabletousethelterinconjunctionwithsomewindowfunction::n]:nNissomeanalysiswindowoflength.WefollowedJudithBrownbyusingHammingwindows.3DirectImplementationForcomparisonrsttheusualFT-algorithmisgiven,notinitscompactft=(x.*win)*exp(-2*pi*i*(0:N-1)'*(0:N-1)/N),butwithaloop.functionft=slowFT(x,N)fork=0:N-1;ft(k+1)=x(1:N)*(hamming(N).*exp(-2*pi*i*k*(0:N-1)'/N))/N;AndhereisthedirectimplementationoftheconstantQtransform.functioncq=slowQ(x,minFreq,maxFreq,bins,fs)Q=1/(2(1/bins)-1);fork=1:ceil(bins*log2(maxFreq/minFreq));N=round(Q*fs/(minFreq*2((k-1)/bins)));cq(k)=x(1:N)*(hamming(N).*exp(-2*pi*i*Q*(0:N-1)'/N))/N; denotestheleastintergergreaterthanorequalto 4AnEcientAlgorithmSincethecalculationoftheconstantQtransformaccordingtotheformula(5)isverytimeconsuming,anecientalgorithmishighlydesirable.UsingmatrixmultiplicationtheconstantQtransformofarowvectoroflengthforallkK)iswhereisthecomplexconjugateofthetemporalkernel;k n]e2in0otherwiseSincethetemporalkernelisindependentoftheinputsignalonecanspeedupsuccessiveconstantQtransformsbyprecalculating.Butthisisverymemoryconsumingandsincetherearemanynonvanishingelementsinthecalculationofthematrixproductstilltakesquiteawhile.LuckilyJudithBrownandMillerPuckettecameupwithaverycleverideaforimprovingthecalculation[BrownandPuckette,1992].Theideaistocarryoutthematrixmultiplicationinthespectraldomain.Sincethewin-dowedcomplexexponentialsofthetemporalkernelhaveaDFTthatvan-ishesalmosteverywhereexceptfortheimmediatevicinityofthecorrespond-ingfrequencythespectralkernel:=DFT()(onedimensionalDFTsappliedcolumnwise)isasparsematrix(aftereliminatingcomponentsbelowsomethresholdvalue).Thisfactcanbeexploitedforthecalculationofowingtotheidentity n]yft[n](9)whereandaresequencesoflengthanddenotetheirunnor-malizeddiscreteFouriertransform.ApplyingthisidentitytotheformulaofconstantQtransform(5)usingdenitions(7)and(8)yields NXx[n]S In(7)wecenterthelterdomainsontheleftfortheeaseofnotation.Right-centeringismoreappropriateforreal-timeapplications.Middle-centeringhastheadvantageofmakingthespectralkernel(8)real. orequivalentlyinmatrixnotation DuetothesparsenessofthecalculationoftheproductinvolvesessentiallylessmultiplicationsthanTheFouriertransformsthatariseintheecientalgorithmshouldofcoursebecalculatedusingFFTs.Tothisendischosenasthelowestpowerof2greaterthanorequalto(whichisthemaximumofall).Thecalculationofthespectralkernelisquiteexpensive,buthavingdonethisonceallsucceedingconstantQtransformsareperformedmuchfaster.5ImplementationoftheEcientAlgorithmfunctionsparKernel=sparseKernel(minFreq,maxFreq,bins,fs,thresh)ifnarginthresh=0.0054;end%forHammingwindowQ=1/(2(1/bins)-1);(3)K=ceil(bins*log2(maxFreq/minFreq));(2)fftLen=2nextpow2(ceil(Q*fs/minFreq));tempKernel=zeros(fftLen,1);sparKernel=[];fork=K:-1:1;len=ceil(Q*fs/(minFreq*2((k-1)/bins)));(4)tempKernel(1:len)=...hamming(len)/len.*exp(2*pi*i*Q*(0:len-1)'/len);(7)specKernel=fft(tempKernel);(8)specKernel(find(abs(specKernel)resh))=0;sparKernel=sparse([specKernelsparKernel]);sparKernel=conj(sparKernel)/fftLen;(10)functioncq=constQ(x,sparKernel)%xmustbearowvectorcq=fft(x,size(sparKernel,1))*sparKernel;(10)AmatlabimplementationoftheecientalgorithmfortheconstantQtransform[BrownandPuckette,1992]codedbyBenjaminBlankertz.Thehasonlytobecalculatedonce.Thismighttakesomeseconds.Afterthat,constantQtransformsofanyrowvectorcanbedonevery ecientlybycalling.Thefunctionisincludedinthedsp-toolbox.ItreturnstheHammingwindowofthegivenlength:hamming(len)=0.46-0.54*cos(2*pi*(0:len-1)'/len)ReferencesJudithC.Brown,CalculationofaconstantQspectraltransform,J.Acoust.Soc.Am.,89(1):425{434,1991.JudithC.BrownandMillerS.Puckette,Anecientalgorithmforthecal-culationofaconstantQtransform,J.Acoust.Soc.Am.,92(5):2698{2701,F.J.Harris,OntheUseofWindowsforHarmonicAnalysiswithDiscreteFourierTransform,in:Proc.IEEE,Bd.66,pp.51{83,1978.