SPECTRUM

From STX Wiki
Jump to navigationJump to search

SPECTRUM - fft spectrum

Usage:

SPECTRUM X TYP C LFFT SP MAMI MAMX MPV

Inputs:
Name Description Default
X signal vector (nX samples) no default
TYP selects the type of output spectrum def.=LOGARITHMIC
C spectrum scale factor (linear; def=1) or offset (dB, def=0)
LFFT fft length for spectrum computation def.= next 2M >= nX
SP starting point for phase locking (in samples)
MAMI,MAMX minimum and maximum amplitude for phase masking
MPV value for masked phase def.=0
Outputs:
Name Description
Y complex or amplitude spectrum (depends on TYP)
P phase spectrum (if TYP not equal COMPLEX)
LFFT fft length used for spectrum computation (may differ from input LFFT)
Function:

This function computes the complex spectrum or the amplitude and phase spectrum of the input signal by using the fft. The output format is selected by the input TYP.

If SP is connected, phase locking is performed and the value of SP is used as analysis starting point (in samples). The phase locking algorithm converts the fft phase of the current frame to a phase relative to the specified starting point (e.g. the begin of the 1st frame)

1278.png

with:

reI, imI the real and imaginary part of fft-bin I 1307.png unlocked phase 1308.png locked phase SP starting time of signal in samples (reference time) N fft length

The inputs MAMI and MAMX can be used to set the phase values for amplitudes outside the specified (linear!) amplitude range to the constant value supplied with input MPV (default=0). This 'masking' method was implemented to compute the phases for 'relevant components' only and is applied only if one or both of the inputs MAMI and MAMX are connected.

phase masking:

PI = 1307.png or 1309.png if MAMI <= aI (<= MAMX ) MPV otherwise

with:

PI is the value of output P and aI is the amplitude of fft-bin I

Note: it is also possible to supply a minimum amplitude MAMI only

The phase algorithms are still in development and we are working on more efficient methods for phase locking, unwrapping and masking.

To get comparable amplitudes for different frame lengths (= NX, length of vector X), the signal is scaled by the factor 1/NX. If NX is not a power of 2, the fft-length is set to the next power of 2 greater than NX and the signal is zero padded.

The value of C can be used to shift/scale the amplitudes into a user defined range (e.g. to get absolute sound pressure values).

Spectrum parameters

value of TYP output Y output P
0 or COMPLEX complex spectrum:Y2I = C.reI, Y2I+1 = C.imI not used
1 or POWER power spectrum:YI = C.aI2 phase spectrum:1307.png if input SP is not connected and1308.png if input SP is connectedphase values are scaled to the range –p to +p (using a module operation)
2 or LINEAR amplitude spectrum:YI = C.aI
3 or LOGARITHMIC logarithmic amplitude spectrum in dB:YI = 20.log10(aI) + C
4 or REALIMAG real part of complex spectrum:YI = C.reI imaginary part of complex spectrum:YI = C.imI

with: N is the length of the fft, I is the index of the fft-bin (I=0..N/2+1)

Navigation menu

Personal tools