jdxi_editor.ui.widgets.audio.oscilloscope

A phosphor oscilloscope for the two captured channels.

The left trace is the display colour. The right trace is the dimmer colour. The previous frame is drawn first, so a trace leaves a short trail.

Attributes

RANGE_RELEASE

Classes

Oscilloscope

The waveform, with a grid and one frame of persistence.

Functions

trace_y(height, sample[, margin, full_scale]) → float

Screen y of one sample. Positive samples sit above the centre.

next_full_scale(current, peak[, release]) → float

The scope's range after a frame whose largest sample is peak.

Module Contents

jdxi_editor.ui.widgets.audio.oscilloscope.RANGE_RELEASE = 0.9[source]
jdxi_editor.ui.widgets.audio.oscilloscope.trace_y(height: float, sample: float, margin: float = 6.0, full_scale: float = 1.0) → float[source]

Screen y of one sample. Positive samples sit above the centre.

full_scale is the value drawn at the top and bottom edges. A sample beyond it is held at the edge, so a trace never leaves the chart.

Parameters:
  • height – float widget height

  • sample – float about -full_scale..full_scale

  • margin – float px kept clear of the edges

  • full_scale – float sample value at the edges, at least 1.0

Returns:

float

jdxi_editor.ui.widgets.audio.oscilloscope.next_full_scale(current: float, peak: float, release: float = RANGE_RELEASE) → float[source]

The scope’s range after a frame whose largest sample is peak.

It never drops below 1.0, so an ordinary signal is drawn as it always was. A louder peak widens it at once; afterwards it eases back towards the signal rather than jumping, so the trace does not pump.

Parameters:
  • current – float the range so far

  • peak – float largest absolute sample in the new frame

  • release – float share of the excess over the target kept per frame

Returns:

float

class jdxi_editor.ui.widgets.audio.oscilloscope.Oscilloscope(parent: PySide6.QtWidgets.QWidget | None = None)[source]

Bases: PySide6.QtWidgets.QWidget

The waveform, with a grid and one frame of persistence.

_left: numpy.ndarray | None = None[source]
_right: numpy.ndarray | None = None[source]
_persist_left: numpy.ndarray | None = None[source]
_persist_right: numpy.ndarray | None = None[source]
full_scale = 1.0[source]
set_waveform(left: numpy.ndarray | None, right: numpy.ndarray | None) → None[source]

Replace the traces. The previous ones stay for one frame.

Parameters:
  • left – Optional[np.ndarray] (columns, 2) min/max

  • right – Optional[np.ndarray] (columns, 2) min/max

Returns:

None

paintEvent(_event) → None[source]
_draw_grid(painter: PySide6.QtGui.QPainter, color: PySide6.QtGui.QColor) → None[source]
_draw_trace(painter: PySide6.QtGui.QPainter, wave: numpy.ndarray | None, color: PySide6.QtGui.QColor) → None[source]