Spire.Presentation 10.10.1 supports setting fade-in or fade-out duration of audio

Spire.Presentation 10.10.1 supports setting fade-in or fade-out duration of audio

2025-10-21 03:55:59

We’re pleased to announce the release of Spire.Presentation 10.10.1. This update introduces features for setting fade-in and fade-out durations for audio, as well as the ability to crop audio. More details are given below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPPT-2988 Added support for setting the fade-in or fade-out duration of audio.
// New Append Audio
Presentation pres = new Presentation();
FileStream from_stream = File.OpenRead(inputFile);
RectangleF audioRect = new RectangleF(50, 50, 100, 100);
IAudio audio = pres.Slides[0].Shapes.AppendAudioMedia(from_stream, audioRect);
// Set the duration of the starting fade for 13s
audio.FadeInDuration = 13000f;
// Set the duration of the ending fade for 40s
audio.FadeOutDuration = 10000f;
pres.SaveToFile(outputFile, FileFormat.Pptx2013);

// Retrieve existing documents
FileStream from_stream = File.OpenRead(inputFile);
Presentation presentation = new Presentation();
presentation.LoadFromStream(from_stream, FileFormat.Auto);
foreach (IShape shape in presentation.Slides[0].Shapes)
{
    if (shape is IAudio)
    {
        IAudio audio = shape as IAudio;
        // Set the duration of the starting fade for 13s
        audio.FadeInDuration = 13000f;
        // Set the duration of the ending fade for 20s
        audio.FadeOutDuration = 20000f;
    }
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
New feature SPIREPPT-2990 Added support for cropping audio.
// New Append Audio
Presentation pres = new Presentation();
FileStream from_stream = File.OpenRead(inputFile);
RectangleF audioRect = new RectangleF(50, 50, 100, 100);
IAudio audio = pres.Slides[0].Shapes.AppendAudioMedia(from_stream, audioRect);
// Set the start trimming time 8 seconds
audio.TrimFromStart = 8000f;
// Set the end trimming time 13 seconds
audio.TrimFromEnd = 13000f;
pres.SaveToFile(outputFile, FileFormat.Pptx2013);

// Retrieve existing documents			
FileStream from_stream = File.OpenRead(inputFile);
Presentation presentation = new Presentation();
presentation.LoadFromStream(from_stream, FileFormat.Auto);
foreach (IShape shape in presentation.Slides[0].Shapes)
{
    if (shape is IAudio)
    {
        IAudio audio = shape as IAudio;
        // Set the start trimming time 8 seconds
        audio.TrimFromStart = 8000f;
        // Set the end trimming time 13 seconds
        audio.TrimFromEnd = 13000f;
    }
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
Click the link to download Spire.Presentation 10.10.1:
More information of Spire.Presentation new release or hotfix: