Skip to content

TextStudioSignal

ClassTextStudioTextStudio
public static class TextStudioSignal

Normalized signal math shared by component and UI Toolkit integrations.

public static float Normalize(float value, float minimum = 0, float maximum = 1)

Maps a finite source range into [0,1]. Reversed ranges invert the signal.

Parameters

Name Type
value System.Single
minimum System.Single
maximum System.Single

Returns

System.Single

public static float AudioRms(ReadOnlySpan<float> samples, float gain = 1)

Allocation-free RMS of a caller-owned sample window; nonfinite samples contribute silence.

Parameters

Name Type
samples System.ReadOnlySpan{System.Single}
gain System.Single

Returns

System.Single

public static float BeatPhase(double timeSeconds, float beatsPerMinute, double originSeconds = 0, float beatsPerCycle = 1)

Clock-based beat phase in [0,1), with no accumulated delta-time drift.

Parameters

Name Type
timeSeconds System.Double
beatsPerMinute System.Single
originSeconds System.Double
beatsPerCycle System.Single

Returns

System.Single

public static float Smooth(float current, float target, float deltaTime, float attackSeconds, float releaseSeconds)

Frame-rate-independent attack/release smoothing. Seconds are exponential time constants.

Parameters

Name Type
current System.Single
target System.Single
deltaTime System.Single
attackSeconds System.Single
releaseSeconds System.Single

Returns

System.Single