lupy.processing¶
- class lupy.processing.RunningSum[source]¶
Bases:
objectHelper class to calculate the running sum of a series of values
- lupy.processing.square_and_sum(a: ndarray[tuple[int, int], dtype[float64]]) ndarray[tuple[int], dtype[float64]][source]¶
Compute the per-row sum-of-squares of a 2-D array
Equivalent to
np.square(a).sum(axis=1)but avoids allocating the intermediate(rows, cols)squared array, which can be large when a has many columns.
- class lupy.processing.BaseProcessor(num_channels: NumChannelsT, sample_rate: int = 48000)[source]¶
Bases:
ABC,Generic[NumChannelsT]Abstract base class for audio measurement processors
- num_channels: NumChannelsT¶
Number of audio channels
- class lupy.processing.BlockProcessor(num_channels: NumChannelsT, gate_size: int, sample_rate: int = 48000, momentary_enabled: bool = True, short_term_enabled: bool = True, lra_enabled: bool = True)[source]¶
Bases:
BaseProcessor[NumChannelsT]Process audio samples and store the resulting loudness data
- Parameters:
num_channels (NumChannelsT) – Number of audio channels
gate_size (int) – Length of one gating block in samples
sample_rate (int) – Sample rate of the audio data (default: 48000)
momentary_enabled (bool) – Enable Momentary Loudness processing (default:
True)short_term_enabled (bool) – Enable Short-Term Loudness processing (default:
True)lra_enabled (bool) – Enable Loudness Range processing (default:
True)
Important
If short_term_enabled is
False, lra_enabled must also beFalse. Loudness Range calculation depends on Short-Term Loudness values.- Raises:
ValueError – If short_term_enabled is
Falseand lra_enabled isTrue
- gate_size: int¶
The length of one gating block in samples
- integrated_lkfs: floating¶
The current Integrated Loudness
- lra: float¶
The current Loudness Range
If
lra_enabledisFalse, this will always be0
- property momentary_enabled: bool¶
Whether Momentary Loudness processing is enabled (read-only)
- property short_term_enabled: bool¶
Whether Short-Term Loudness processing is enabled (read-only)
- property lra_enabled: bool¶
Whether Loudness Range processing is enabled (read-only)
- property block_data: MeterArray¶
A structured array of measurement values with dtype
MeterDtype
- property momentary_lkfs: ndarray[tuple[int], dtype[float64]]¶
Momentary Loudness for each 100ms block, averaged over 400ms (not gated)
If
momentary_enabledisFalse, this will be an array of zeros
- property short_term_lkfs: ndarray[tuple[int], dtype[float64]]¶
Short-Term Loudness for each 100ms block, averaged over 3 seconds (not gated)
If
short_term_enabledisFalse, this will be an array of zeros
- property t: ndarray[tuple[int], dtype[float64]]¶
The measurement time for each element in
short_term_lkfsandmomentary_lkfs
- property Zij: ndarray[tuple[int, int], dtype[float64]]¶
Mean-squared values per channel in each 400ms block (not weighted)
- class lupy.processing.TruePeakProcessor(num_channels: NumChannelsT, gate_size: int, sample_rate: int = 48000)[source]¶
Bases:
BaseProcessor[NumChannelsT]Process audio samples to extract their True Peak values
- property tp_array: TruePeakArray[NumChannelsT]¶
A structured array of measurement values with dtype
TruePeakDtype
- property t: ndarray[tuple[int], dtype[float64]]¶
The measurement times for all processed blocks in
tp_array
- property all_tp_values: ndarray[tuple[int, NumChannelsT], dtype[float64]]¶
All True Peak values per channel for each processed block
- property current_peaks: ndarray[tuple[NumChannelsT], dtype[float64]]¶
True Peak values per channel from the last processing period