Programmer Guide/SPU Reference/SPECTRUM: Difference between revisions
No edit summary |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
{{SPAtomTemplate}} | |||
====SPECTRUM - fft spectrum==== | ====SPECTRUM - fft spectrum==== | ||
Line 9: | Line 10: | ||
{| | {| | ||
! style="text-align:leftr;"|Name | |||
! Description | |||
! Default | |||
|- | |- | ||
|X | |X | ||
Line 39: | Line 43: | ||
{| | {| | ||
! style="text-align:leftr;"|Name | |||
! Description | |||
|- | |- | ||
| | |Y | ||
|complex or amplitude spectrum (depends on TYP) | |complex or amplitude spectrum (depends on TYP) | ||
|- | |- | ||
Line 85: | Line 91: | ||
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). | 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{| | Spectrum parameters | ||
{| | |||
|- | |- | ||
|value of TYP | |value of TYP |
Latest revision as of 15:10, 13 October 2015
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)
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
with: N is the length of the fft, I is the index of the fft-bin (I=0..N/2+1)