:Qc@sddlZddlmZdZdZdZdZdZdZ d Z d d*d YZ d+Z e d%Z d&d,d'YZd(Zd)ZdS(-iN(t HanningWindowgX@cCs!tjdtdtj|S(sT Returns the SPL corresponding to intensity (in units where 1 implies 96dB) ig$@(tnptmaximumt FULLSCALESPLtlog10(t intensity((s psychoac.pytSPLscCstjd|ddS(sW Returns the intensity (in units of the reference intensity level) for SPL spl g$@i`(Rtpower(tspl((s psychoac.pyt Intensity scCsktj|d}dtj|dddtjd|dd|dddtj|dd S( sEReturns the threshold in quiet measured in SPL at frequency f (in Hz)g$@gQ @g@@gg@g333333gffffff @gMbP?i(RRRtexp(tf((s psychoac.pytThreshscCs6dtjd|ddtj|d|dS(s?Returns the bark-scale frequency for input frequency f (in Hz) g*@gRQ?g@@g @gL@(Rtarctan(R ((s psychoac.pytBarksg.@g@tMaskercBs5eZdZedZdZdZdZRS(sm a Masker whose masking curve drops linearly in Bark beyond 0.5 Bark from the masker frequency cCs@||_||_t||_t|_|s<t|_ndS(sl initialized with the frequency and SPL of a masker and whether or not it is Tonal N(RR Rtzt MASKTONALDROPtdropt MASKNOISEDROP(tselfR RtisTonal((s psychoac.pyt__init__'s    cCs|jt|S(s.The intensity of this masker at frequency freq(tIntensityAtBarkR(Rtfreq((s psychoac.pytIntensityAtFreq3scCs|j|j}t|j|dkr|j|krT|d|j|d8}q|jd}tj||krd}n|dd|||jd8}nt|S(s/The intensity of this masker at Bark location zg?g;@gD@ggrh|?(RRtabsRRR (RRtmaskedDBtiEffect((s psychoac.pyR7s  $cCstjtj|tj}|j|j|j|jd|k}||cd|j||d8<|jd}|dkrd}n|jd|k}||cdd||||jd8 )( #    )((gY@gi@gr@gy@g@g@g@g@g@gؓ@g @g@g@@g @g@g@g@g0@g@g@g@g@gp@gF@gp@((tnumpyRtwindowRRRR R RRRRt cbFreqLimitsR5R6R@RZ(((s psychoac.pyts$     ;