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
Classes
The waveform, with a grid and one frame of persistence. |
Functions
|
Screen y of one sample. Positive samples sit above the centre. |
|
The scope's range after a frame whose largest sample is |
Module Contents
- 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_scaleis 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.QWidgetThe 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]
- 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/maxright – Optional[np.ndarray]
(columns, 2)min/max
- Returns:
None
- _draw_trace(painter: PySide6.QtGui.QPainter, wave: numpy.ndarray | None, color: PySide6.QtGui.QColor) None[source]