Phase Detector

Phase Detector plugin settings interface
Emits events when a continuous signal arrives at a specific “phase,” which really means a peak, falling zero-crossing, trough, or rising zero-crossing. It was originally designed to trigger output at specific phases of an 8 Hz theta oscillation in mouse hippocampus.

Plugin Type



Windows, Linux, macOS

Built in?


Key Developers

Josh Siegle

Source Code


The Phase Detector uses the simplest possible algorithm to trigger outputs when an incoming signal reaches a peak, trough, or zero-crossing. If you would like to perform more precise phase-specific stimulation, you should use the Phase Calculator plugin, which uses a Hilbert transform to predict the timing of each cycle with a higher degree of accuracy.

Plugin configuration

There are four parameters for each Phase Detector:

  • TTL_OUT: The TTL output line to use. When the Phase Detector detects a peak, trough, or zero-crossing, it will emit events on this line. If you’re using the output of this plugin to trigger closed-loop feedback, be sure that this line does not overlap with those used by incoming events from your data source or other plugins.

  • GATE_LINE: The TTL input line used to gate the output of this plugin. If this is set to 0, then the gate is disable and all relevant events will be emitted. If this is set to line 1-16, then the Phase Detector will only generate outputs when the selected line is “high.”

  • Channel: The continuous channel that will be analyzed. It’s possible to select any incoming channel within the currently active stream (see below for details about how this plugin handles multiple incoming streams).

  • Selected phase: In the upper right of the editor, there’s an interface for choosing the phase on which events will be triggered. By default, the peak is selected, but it’s also possible to choose falling zero-crossings, the trough, or rising zero-crossings.

Working with multiple data streams

The Phase Detector can only process one continuous channel from one data stream at a time. If the Phase Detector has multiple data streams as input, you can specify which stream to use by clicking the vertical lines on the right of the editor to open the stream selection drawer. Click the arrow buttons or use the popup menu to select the active stream for this plugin.

Phase detector stream selection interface

To trigger outputs on several continuous channels, or at different phases, you can place multiple Phase Detectors in succession.’’