Skip to main content

How to make an audio volume envelope effect?

Product: Video Edit SDK .Net. Engine: VideoEditCore (Windows only).

Sample code

1. Create an audio source for a specified file

var audioFile = new AudioSource(file, segments, null);

2. Create audio volume envelope effect, 70% value used. Can be 0 - 100%

streams.Add(new FFMPEGStream
{
Filename = "c:\\samples\\!video.avi",
ID = "v"
});

Add audio stream from mp3 file. ID set to "a" to add the audio stream. Must be "a" for audio files.

var envelope = new AudioVolumeEnvelopeEffect(70);

Add audio stream from another AVI file. ID set to "a" to add audio stream from video file.

streams.Add(new FFMPEGStream
{
Filename = "c:\\samples\\!video2.avi",
ID = "a"
});

3. Add audio source with effect applied to timeline

VideoEdit1.Input_AddAudioFile(audioFile, TimeSpan.FromMilliseconds(0), 0, new []{ envelope });

Required redists

How to install required redists or deploy them to the user's PC?


Visit our GitHub page to get more code samples.