SpHr_HilbertEnvelope [ /dB /dtdB /Pa /dtPa ] srcWaveName [, srcWaveName2


Calculates amplitude envelopes using the Hilbert transformation.


Parameters

srcWaveName  Specifies the single precision wave for which envelopes are obtained using the Hilbert transformation. The function is applied across rows and is multithreaded if srcWaveName consists of more than one column, layer, or chuck. 


srcWaveName(startX, endX)  Specifies an x-range in the source wave.


srcWaveName[startP, endP]  Specifies a point-range in the source wave.


srcWaveName2  Optional second source wave for which envelopes are obtained. When included, srcWaveName and srcWaveName2 must both have (1) one dimension (no columns), (2) the same x-scaling, and (3) the same number of points. Envelopes for srcWaveName and srcWaveName2 are written to the first two columns of one or more multidimensional destination waves (see destination flags). Because SpHr_HilbertEnvelope is multithreaded, this is slightly faster than calling the function separately for each wave.


Flags

/O = [ overwrite ]    

    srcWaveName (and optionally srcWaveName2) are overwritten with results of the operation. Only one output type flag may be specified when overwriting (i.e., /dB, dtdB, /Pa, or /dtPa).

    overwrite = 0, same as no /O flag

    overwrite = 1, same as /O flag alone.


/DF = dfRef    dfRef is an optional datafolder reference. Destination waves are written to this existing datafolder, overriding any datafolder specified by destWaveName. Waves are written to the current datafolder if not specified here or in destWaveName.


/N = nameStr      optional string to take the place of srcWaveName if destWaveName is not specified.


/dB = [ destWaveName ]    

    Amplitude envelope scaled in decibels (20*log[Pa]). If destWaveName is omitted, the destination wave uses the name of srcWaveName or nameStr (see /N flag) as a prefix and appends '_EnvdB' as a suffix. The wave is single precision and always overwritten.


/dtdB = [ destWaveName ]    

    Derivatives of amplitude envelopes scaled in decibels (20*log[Pa]). If destWaveName is omitted, the destination wave uses the name of srcWaveName or nameStr (see /N flag) as a prefix and appends '_EnvdtdB' as a suffix. The wave is single precision and always overwritten.


/Pa = [ destWaveName ]    

    Linearly scaled amplitude envelope (Pa). If destWaveName is omitted, the destination wave uses the name of srcWaveName or nameStr (see /N flag) as a prefix and appends '_EnvPa' as a suffix. The wave is single precision and always overwritten.


/dtPa = [ destWaveName ]    

    Derivatives of linearly scaled amplitude envelopes. If destWaveName is omitted, the destination wave uses the name of srcWaveName or nameStr (see /N flag) as a prefix and appends '_EnvdtPa' as a suffix. The wave is single precision and always overwritten.


/B = [ buffSec ]     

    When possible, a time buffer of length buffSec is inserted to minimize DFT artifacts at the beginning and end of each envelope. The /B flag alone adds a 0.01 second buffer. The buffer is always zero if startX (and optionally startP) are not specified. A time buffer naturally exists at the end of each envelope if the chosen envelope length does not correspond to a DFT-compatible number of points. If a DFT-compatible number of points is specified, buffers to minimize DFT artifacts should be implemented in Igor before calling the SpHr_HilbertEnvelope operation.


Example

Function SpHr_HilbertEnvelope_Example()

    variable fs = 48000

    SpHr_SignalGaussian/ms=50/Sp=0/dB=70/Ramp=10/Buff={0,20} fs, Noise

    variable Hz = 500

    SpHr_FilterBiquad /CF=(Hz)/Dest=filteredNoise Noise

    SpHr_HilbertEnvelope/Pa=Envelope filteredNoise

    Display/K=1 filteredNoise

    AppendToGraph Envelope

    ModifyGraph lsize=0.5,rgb(filteredNoise)=(34952,34952,34952)

    ModifyGraph lsize(Envelope)=0.75,rgb(Envelope)=(0,0,0)

    Label left "amplitude (\\U)"

    Label bottom "time (\\U)"

End

Contact: Brian