STx 3.9 Documentation

Book

SPU Reference

Previous

SPBCOEFS - compute spectral band coefficients

Next

SSIGIN - read signal (for filters, …)

SPECTRUM - fft spectrum

Usage:

SPECTRUM X TYP C LFFT SP MAMI MAMX MPV

Inputs:

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:

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)

with:

reI, imI the real and imaginary part of fft-bin I
unlocked phase
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 = or 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:

if input SP is not connected and

if input SP is connected

phase 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)

© 2009 The Austrian Academy of Sciences Acoustics Research Institute