DefaultGainProvider.FadeProvider


public interface DefaultGainProvider.FadeProvider


Represents a time unit-agnostic fade shape to be applied over an automation.

Summary

Public methods

abstract float
getGainFactorAt(
    @IntRange(from = 0) long index,
    @IntRange(from = 1) long duration
)

Returns the gain factor within [0f; 1f] to apply to an audio sample for a specific fade shape.

Public methods

getGainFactorAt

abstract float getGainFactorAt(
    @IntRange(from = 0) long index,
    @IntRange(from = 1) long duration
)

Returns the gain factor within [0f; 1f] to apply to an audio sample for a specific fade shape.

Position and duration are unit agnostic and work as a numerator/denominator pair.

You can implement a basic linear fade as follows:

public float getGainFactorAt(long index, long duration) {
  return (float) index / duration;
}
Parameters
@IntRange(from = 0) long index

Position (numerator) between [0; duration].

@IntRange(from = 1) long duration

Duration (denominator).