Table of Contents

Class AudioVolumeFadeEffect

Namespace
VisioForge.Core.Types.VideoEdit
Assembly
VisioForge.Core.dll

Represents an audio volume fade effect that creates smooth volume transitions over time.

public class AudioVolumeFadeEffect : AudioTrackEffect

Inheritance

Inherited Members

Examples

// Example 1: Classic fade-in at track beginning
var fadeIn = new AudioVolumeFadeEffect(
    minLevel: 0,
    maxLevel: 100,
    fadeInDuration: TimeSpan.FromSeconds(3),
    fadeOutDuration: TimeSpan.Zero  // No fade-out
);

// Example 2: Fade-out at track end
var fadeOut = new AudioVolumeFadeEffect(
    minLevel: 0,
    maxLevel: 100,
    fadeInDuration: TimeSpan.Zero,  // No fade-in
    fadeOutDuration: TimeSpan.FromSeconds(5)
)
{
    StartTime = TimeSpan.FromMinutes(3),  // Start effect at 3 minutes
    StopTime = TimeSpan.FromMinutes(3.5)  // End at 3:30
};

// Example 3: Cross-fade effect (fade-in and fade-out)
var crossFade = new AudioVolumeFadeEffect(
    minLevel: 20,   // Don't fade to complete silence
    maxLevel: 100,
    fadeInDuration: TimeSpan.FromSeconds(2),
    fadeOutDuration: TimeSpan.FromSeconds(2)
)
{
    StartTime = TimeSpan.FromSeconds(10),
    StopTime = TimeSpan.FromSeconds(30)
};

Remarks

The VisioForge.Core.Types.VideoEdit.AudioVolumeFadeEffect class enables creation of professional fade-in and fade-out effects on audio tracks. It provides smooth volume transitions from a minimum to maximum level at the beginning (fade-in) and from maximum to minimum at the end (fade-out) of the effect period.

Key features:

  • Independent control of fade-in and fade-out durations
  • Configurable minimum and maximum volume levels
  • Smooth, linear volume transitions
  • Can create fade-in only, fade-out only, or combined effects

The effect timeline works as follows:

  1. Effect starts at StartTime with MinLevel volume
  2. Volume fades from MinLevel to MaxLevel over FadeInDuration
  3. Volume remains at MaxLevel until (StopTime - FadeOutDuration)
  4. Volume fades from MaxLevel to MinLevel over FadeOutDuration
  5. Effect ends at StopTime

Constructors

AudioVolumeFadeEffect(int, int, TimeSpan, TimeSpan)

Initializes a new instance of the VisioForge.Core.Types.VideoEdit.AudioVolumeFadeEffect class with specified fade parameters.

public AudioVolumeFadeEffect(int minLevel, int maxLevel, TimeSpan fadeInDuration, TimeSpan fadeOutDuration)

Parameters

minLevel int

The minimum volume level as a percentage (0-100). This is the starting volume for fade-in and ending volume for fade-out. Typically 0 for complete fades.

maxLevel int

The maximum volume level as a percentage (0-100). This is the target volume after fade-in and the starting volume for fade-out. Typically 100 for normal volume.

fadeInDuration TimeSpan

The duration of the fade-in transition. Set to Zero to disable fade-in and start immediately at maxLevel.

fadeOutDuration TimeSpan

The duration of the fade-out transition. Set to Zero to disable fade-out and end immediately at minLevel.

Examples

// Standard fade-in/fade-out
var standardFade = new AudioVolumeFadeEffect(
    minLevel: 0,
    maxLevel: 100,
    fadeInDuration: TimeSpan.FromSeconds(2),
    fadeOutDuration: TimeSpan.FromSeconds(3)
);

// Fade between two audible levels
var partialFade = new AudioVolumeFadeEffect(
    minLevel: 30,   // Never below 30%
    maxLevel: 100,
    fadeInDuration: TimeSpan.FromSeconds(1),
    fadeOutDuration: TimeSpan.FromSeconds(1)
);

// Fade-in only (no fade-out)
var fadeInOnly = new AudioVolumeFadeEffect(
    minLevel: 0,
    maxLevel: 100,
    fadeInDuration: TimeSpan.FromSeconds(3),
    fadeOutDuration: TimeSpan.Zero
);

Remarks

By default, the effect applies to the entire track (StartTime and StopTime are null). For fade-out effects, you must set appropriate StartTime and StopTime values after construction to ensure the fade-out occurs at the desired position.

The total effect duration should be at least (fadeInDuration + fadeOutDuration) to avoid overlapping fades. If the durations overlap, the behavior may vary by implementation.

Properties

FadeInDuration

Gets or sets the duration of the fade-in transition.

public TimeSpan FadeInDuration { get; set; }

Property Value

TimeSpan

Examples

// Quick fade-in
effect.FadeInDuration = TimeSpan.FromMilliseconds(500);

// Standard fade-in
effect.FadeInDuration = TimeSpan.FromSeconds(2);

// No fade-in (instant)
effect.FadeInDuration = TimeSpan.Zero;

Remarks

The fade-in begins at the effect's StartTime and transitions the volume from MinLevel to MaxLevel over the specified duration. The transition is typically linear.

Common fade-in durations:

  • 0.5-1 second: Quick, subtle fade for short clips
  • 2-3 seconds: Standard fade for most content
  • 5-10 seconds: Slow, dramatic fade for atmospheric effects

FadeOutDuration

Gets or sets the duration of the fade-out transition.

public TimeSpan FadeOutDuration { get; set; }

Property Value

TimeSpan

Examples

// Standard fade-out
effect.FadeOutDuration = TimeSpan.FromSeconds(3);

// Quick fade-out for abrupt ending
effect.FadeOutDuration = TimeSpan.FromMilliseconds(200);

// No fade-out (instant cut)
effect.FadeOutDuration = TimeSpan.Zero;

Remarks

The fade-out begins at (StopTime - FadeOutDuration) and transitions the volume from MaxLevel to MinLevel. The fade-out must complete by the effect's StopTime.

Important considerations:

  • FadeOutDuration should not exceed the total effect duration
  • If FadeInDuration + FadeOutDuration exceeds effect duration, fades may overlap
  • The transition is typically linear but may vary by implementation

MaxLevel

Gets or sets the maximum volume level during the sustained portion of the effect.

public int MaxLevel { get; set; }

Property Value

int

Remarks

The MaxLevel represents the target volume after fade-in and the starting volume for fade-out. It's maintained during the sustained portion between the fade transitions.

Common values:

  • 100: Original/normal volume
  • 80-90: Slightly reduced for mixing
  • 110-120: Boosted volume (use carefully to avoid distortion)

MinLevel

Gets or sets the minimum volume level during fade transitions.

public int MinLevel { get; set; }

Property Value

int

Remarks

Common values:

  • 0: Complete silence (typical for full fades)
  • 10-20: Subtle background level
  • 30-50: Reduced but audible level

Setting MinLevel above 0 creates a partial fade effect where audio never completely disappears, useful for maintaining some ambient sound or preventing jarring silence.