SquareWave

fun SquareWave(amplitude: Float = 0.5f, frequency: Float, pulseWidth: Float = 0.0f)

Composable for generating a square wave. Produces a square wave signal with specified amplitude, frequency, and pulse width.

Parameters

amplitude

The amplitude of the square wave. The value should be between 0.0 and 1.0.

frequency

The frequency of the square wave in Hz.

pulseWidth

The pulse width of the square wave. The value should be between -1.0 and 1.0. -1.0 means the output is always -amplitude. 0.0 means a 50% duty cycle. 1.0 means the output is always +amplitude.


fun SquareWave(amplitude: Float = 0.5f, frequency: () -> Float, pulseWidth: () -> Float = { 0f })

Composable for generating a square wave. Produces a square wave signal with specified amplitude, dynamic frequency, and dynamic pulse width.

Parameters

amplitude

The amplitude of the square wave. The value should be between 0.0 and 1.0.

frequency

A lambda returning the current frequency of the square wave in Hz.

pulseWidth

A lambda returning the current pulse width of the square wave. The value should be between -1.0 and 1.0. -1.0 means the output is always -amplitude. 0.0 means a 50% duty cycle. 1.0 means the output is always +amplitude.