jdxi_editor.ui.widgets.audio.oscilloscope ========================================= .. py:module:: jdxi_editor.ui.widgets.audio.oscilloscope .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: jdxi_editor.ui.widgets.audio.oscilloscope.RANGE_RELEASE Classes ------- .. autoapisummary:: jdxi_editor.ui.widgets.audio.oscilloscope.Oscilloscope Functions --------- .. autoapisummary:: jdxi_editor.ui.widgets.audio.oscilloscope.trace_y jdxi_editor.ui.widgets.audio.oscilloscope.next_full_scale Module Contents --------------- .. py:data:: RANGE_RELEASE :value: 0.9 .. py:function:: trace_y(height: float, sample: float, margin: float = 6.0, full_scale: float = 1.0) -> float 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. :param height: float widget height :param sample: float about -full_scale..full_scale :param margin: float px kept clear of the edges :param full_scale: float sample value at the edges, at least 1.0 :return: float .. py:function:: next_full_scale(current: float, peak: float, release: float = RANGE_RELEASE) -> float 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. :param current: float the range so far :param peak: float largest absolute sample in the new frame :param release: float share of the excess over the target kept per frame :return: float .. py:class:: Oscilloscope(parent: Optional[PySide6.QtWidgets.QWidget] = None) Bases: :py:obj:`PySide6.QtWidgets.QWidget` The waveform, with a grid and one frame of persistence. .. py:attribute:: _left :type: Optional[numpy.ndarray] :value: None .. py:attribute:: _right :type: Optional[numpy.ndarray] :value: None .. py:attribute:: _persist_left :type: Optional[numpy.ndarray] :value: None .. py:attribute:: _persist_right :type: Optional[numpy.ndarray] :value: None .. py:attribute:: full_scale :value: 1.0 .. py:method:: set_waveform(left: Optional[numpy.ndarray], right: Optional[numpy.ndarray]) -> None Replace the traces. The previous ones stay for one frame. :param left: Optional[np.ndarray] ``(columns, 2)`` min/max :param right: Optional[np.ndarray] ``(columns, 2)`` min/max :return: None .. py:method:: paintEvent(_event) -> None .. py:method:: _draw_grid(painter: PySide6.QtGui.QPainter, color: PySide6.QtGui.QColor) -> None .. py:method:: _draw_trace(painter: PySide6.QtGui.QPainter, wave: Optional[numpy.ndarray], color: PySide6.QtGui.QColor) -> None