Table of Contents

Class WeightedChannelMixAudioEffect

Namespace
VisioForge.Core.Types.X.AudioEffects
Assembly
VisioForge.Core.dll

Weighted channel mixing audio effect for dual-mono audio sources like CD+G karaoke files. This effect mixes stereo channels with adjustable weights and outputs the merged mono signal to both speakers. Perfect for karaoke applications where left channel contains music only and right channel contains music + vocals.

public class WeightedChannelMixAudioEffect : BaseAudioEffect, ISharedAudioEffectX, IVideoEditXAudioEffect

Inheritance

Implements

Inherited Members

Remarks

This effect is particularly useful for CD+G karaoke files that use dual-mono multiplexing:

  • Left channel: Instrumental backing track (music only)
  • Right channel: Full mix with lead vocals

The effect allows users to control the vocal level by adjusting the mix ratio between channels. The weighted mix is output to both left and right speakers for consistent mono playback.

GStreamer Pipeline: The effect creates an internal bin containing: deinterleavevolume (left) → audiomixeraudioconvert → stereo output → volume (right) ↗

Runtime Adjustable: Channel weights can be modified during playback without pipeline reconstruction.

Constructors

WeightedChannelMixAudioEffect()

Initializes a new instance of the VisioForge.Core.Types.X.AudioEffects.WeightedChannelMixAudioEffect class with default settings (50% mix of both channels output as stereo).

public WeightedChannelMixAudioEffect()

WeightedChannelMixAudioEffect(float, float, bool)

Initializes a new instance of the VisioForge.Core.Types.X.AudioEffects.WeightedChannelMixAudioEffect class with specified channel weights.

public WeightedChannelMixAudioEffect(float leftWeight, float rightWeight, bool outputStereo = true)

Parameters

leftWeight float

The weight for the left channel (0.0 to 1.0).

rightWeight float

The weight for the right channel (0.0 to 1.0).

outputStereo bool

if set to true output as stereo (default).

Properties

LeftChannelWeight

Gets or sets the weight (volume multiplier) for the left channel in the mix. Range: 0.0 (silent) to 1.0 (full volume). Values above 1.0 may cause clipping. Default: 0.5 (50% of left channel).

public float LeftChannelWeight { get; set; }

Property Value

float

OutputStereo

Gets or sets whether to output the mixed signal as stereo (mono duplicated to both L+R). Default: true (output stereo with identical left and right channels).

public bool OutputStereo { get; set; }

Property Value

bool

Remarks

When set to true, the mixed mono signal is duplicated to both left and right output channels, ensuring consistent audio on both speakers. This is the recommended setting for karaoke applications.

RightChannelWeight

Gets or sets the weight (volume multiplier) for the right channel in the mix. Range: 0.0 (silent) to 1.0 (full volume). Values above 1.0 may cause clipping. Default: 0.5 (50% of right channel).

public float RightChannelWeight { get; set; }

Property Value

float

Methods

GenerateDescription()

Generates the GStreamer pipeline description string for this audio effect. This method is called internally by the audio effects processor to build the GStreamer bin.

public string GenerateDescription()

Returns

string

A string representation of the GStreamer pipeline elements and their configuration.

Remarks

The generated pipeline:

deinterleave name=d ! queue ! volume volume={LeftChannelWeight} ! mix.sink_0
d. ! queue ! volume volume={RightChannelWeight} ! mix.sink_1
audiomixer name=mix ! audioconvert ! audio/x-raw,channels=1 ! audioconvert ! audio/x-raw,channels={1 or 2}

First audioconvert forces mono, second upmixes to stereo (duplicates mono to both L and R).