Welcome Guest, you are in: Login

ScrewTurn Wiki



Search the wiki

Element Icon PSD Analyzer Element
Category: Signal Analysis AddIn: Signal Processing
Creator: OkazoLab Team Scope: Parent Event
Owns Snippets: no Usage: Status Screen, code snippets

Actions aligned with epochs of the parent event

After OnsetThe element starts analyzing the selected signal
Control Loop stepLatest signal samples is analyzed within the selected analysis window and the PSD plot gets updated.
Before OffsetThe element stops analyzing the selected signal


Generic Properties

NameProperty descriptionConstraintsTypeUpon change
Selected SignalDefines the signal for processing by the element. The signals are provided by the data acquisition elements.String
Sampling RateDefines the sampling rate of the original signal, in HzInt32
FFT Settings
Analysis Window SizeDefines the size (in samples) of the moving analysis window for signal processing.Int32
Range Of InterestDefines the 'range of interest' across all signal frequencies for statistics, such that the dominant frequency is searched within the range only. The range also restrains X-bounds on the generated plot.clRange
Bin SizeDefines the bin size for the frequency dimension in statistics and plotting.double
Power NormalizationDefines the normalization procedure that is automatically applied to the results of FFTenumThe selected procedure is applied on the next analysis cycle
Fourier OptionsDefines the computation options for the FFTenumThe selected options is applied on the next analysis cycle
Runtime Status
Is RunningDefines whether the analysis and plotting is going on in the present. You can use this property to temporally cease the signal processing for a sake of performance.Boolean
Dominant FrequencyReturns the dominant frequency in the signal power spectrum within the selected range of interest, in Hzdouble
Dominant PowerReturns the power of the dominant frequency in the signal power spectrum within the selected range of interest, in Hzdouble
XAML PSD PlotReturns a live XAML signal plot showing the power spectrum within the selected range of interest. The plot can be used for direct binding to the Content property of the XAML ContentControl element, e.g. The ContentControl with a generated plot can be shown on the status screen or by the XAML Layout element.XAML UIElement
Frequency SpectrumReturns an double array of the newest signal samples. The array length is equal to the size of the analysis window. The values are updated on every Control Loop cycle of the parent event. The last item in the array corresponds to the most recent signal sample.double[]
Plot TitleDefines the title of the generated PSD plotStringThe signal plot is updated
Plot ThemeDefines a visual theme of the generated PSD plotenumThe signal plot is updated
Bar ColorDefines the color of the bars on the generated PSD plotstColorThe signal plot is updated
Max Y-AxisDefines the range of the Y-axis (power) on the generated PSD plot. Zero value denotes the auto-range.DoubleThe signal plot is updated
Rendering SizeDefines the size of the generated plot in pixels. The plot is automatically stretched on rendering, but a larger rendering size improves the chart quality with some cost in performance. The rendering size is also used as the resulting image resolution, when the plot is exported into a file.clSize

+=== Properties inherited from clElement === Inherited properties of clElement
NameDescriptionConstraintsValue TypeUpon Change
Is EnabledIf set to false the element is completely omitted when the experiment is run.Boolean
TitleTitle of the element.String

The element allows to perform a simple power spectrum (PSD) analysis on a real-time signal that is provided by the signal acquisition elements in EventIDE.


The signal acquisition elements, e.g. OpenViBE Signal, communicate with recording hardware and buffer incoming data samples at the background of the experiment. If you want to obtain the instant frequency characteristics of a signal, you can use PSD Analyzer. The element operates on a single signal by estimating its power spectrum with the FFT. The estimation is run cyclically in the control loop of the parent event, within a analysis window that embraces the selected number of recent samples. The results include the descriptive statistics over a subset of the signal window: dominant frequency and its power. Other statistics can be done manually, hence the element delivers the FFT output as an array of double numbers. When power spectrum monitoring is required, the element generates a live power/frequency plot, which can be placed on the Status Screen (see the snapshot below).


Status Screen with the PSD plot, frequency statistics  and selected powers

Status Screen with the PSD plot, frequency statistics
and selected powers

Practical Use

Preparing the element for analysis

  1. Make sure that your experiment contains one of the data acquisition elements, e.g. OpenViBE Signal element
  2. Prepare the data acquisition element, such that it is set to collect at least one signal.
  3. Add new PSD Analyzer element to the event, where you plan to process the signal (the element operates only within the parent event).
  4. Select the added element to browse its properties in the Property panel.
  5. Define a signal for processing, via the Selected Signal property.
  6. Adjust the Sampling Rate property such that the value matches to the real sampling rate of the selected signal.
  7. Choose the size of the analysis window via the corresponding property.
  8. Select the Range Of Interest for statistics and plotting.
  9. Define the bin size for the frequency dimension in statistics and plotting.
  10. Choose the Power Normalization procedure (the default is normalization for the total signal maximum).

Creating the signal plot

  1. Create a proxy variable linked to the XAML PSD Plot property
  2. Check the plot's visualization settings in the Plot Settings group
  3. Add a XAML content control with data binding to the Status Screen code:
    <ContentControl Content='{Binding XAMLPSDPlot}'/>

Reading the FFT results in code

  1. Create a proxy variable linked to the Frequency Spectrum property
  2. Use the Control Loop snippet of the parent event to monitor all signal updates
  3. Create a loop to read all signal samples:
    // estimating the spectrum sum
    double Sum=0;
    for (int i=0;i,FrequencySpectrum.Length;i++)


  • The Frequency Spectrum values are raw, so you may need to make a conversion to Hz based on the size of analysis window and sampling rate. In contrast, element's statistics and plot automatically scale the FFT results to Hz.
  • The dominant frequency and power are searched only inside of the chosen range of interest.
  • The frequency spectrum is returned for the entire analysis window, irrelative to the chosen range of interest.
  • You can measure a time of one cycle of signal processing with the Control Loop Interval property on the parent event. With plotting on and off, the expected time for a 1000 sample window is ~10 and ~5 ms, correspondingly, given that there are no other processes in the parent event and in the experiment.
  • If you are in time-critical section of your experiment, you can temporally cease the signal processing by setting the Is Running property to false.
  Name Size
- psdicon.png 3.85 KB
- PSDPlot-sm.png 16.94 KB
- PSDPlot.png 18.85 KB

ScrewTurn Wiki version Some of the icons created by FamFamFam.