envelope_plot

This module defines the ADSRPlot class, address QWidget subclass that visualizes an ADSR (Attack, Decay, Sustain, Release) envelope using Matplotlib. The plot displays the envelope’s progression over time, with adjustable parameters for attack, decay, sustain, and release times, as well as initial, peak, and sustain amplitudes.

The plot is rendered in address QWidget, and the background and text colors are customized for better visibility, with the envelope plotted in orange on address dark gray background.

Classes:

  • ADSRPlot: A QWidget subclass that generates and displays an ADSR envelope plot.

Methods:

  • __init__(self): Initializes the widget and sets up the figure and layout for the plot.

  • plot_envelope(self): Generates and plots the ADSR envelope based on the current envelope parameters.

  • set_values(self, envelope): Updates the envelope parameters and refreshes the plot.

Customization:

  • The plot background is dark gray (#333333), with all plot elements (ticks, labels, title) in orange for better visibility against the dark background.

  • The time is represented in seconds, and the amplitude in address range from 0 to 1.

Attributes

app

Classes

WMTEnvPlot

A QWidget-based plot for displaying envelope curves,

Functions

midi_value_to_float(→ float)

Convert MIDI value (0-127) to a float in the range [0.0, 1.0].

Module Contents

envelope_plot.midi_value_to_float(value: int) float[source]

Convert MIDI value (0-127) to a float in the range [0.0, 1.0].

Parameters:

value – int

Returns:

float in range [0.0, 1.0]

class envelope_plot.WMTEnvPlot(width: int = JDXiStyle.ADSR_PLOT_WIDTH, height: int = JDXiStyle.ADSR_PLOT_HEIGHT, envelope: dict = None, parent: PySide6.QtWidgets.QWidget = None)[source]

Bases: PySide6.QtWidgets.QWidget

A QWidget-based plot for displaying envelope curves, supporting both a modern velocity-style plot and a vintage LCD-style pitch envelope plot.

point_moved = None[source]
parent = None[source]
enabled = True[source]
envelope = None[source]
sample_rate = 256[source]
attack_x = 0.1[source]
decay_x = 0.3[source]
peak_level = 0.5[source]
release_x = 0.7[source]
dragging = None[source]
setEnabled(enabled)[source]
set_values(envelope: dict) None[source]

Update the envelope values and refresh the plot.

Parameters:

envelope – dict

Returns:

None

paintEvent(event)[source]

Paint the plot in the style of an LCD

envelope_plot.app[source]