Skip to content

SLIDESNET-44847: The new AudioFrame properties added to "Audio Frame" article. #764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The **Audio Options** pane in Microsoft PowerPoint:

![example1_image](audio_frame_0.png)

PowerPoint Audio options that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/net/aspose.slides/audioframe) properties:
PowerPoint **Audio options** that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/net/aspose.slides/audioframe) properties:

- Audio Options **Start** drop-down menu matches the [AudioFrame.PlayMode](https://reference.aspose.com/slides/net/aspose.slides/audioframe/properties/playmode) property
- Audio Options **Volume** matches the [AudioFrame.Volume](https://reference.aspose.com/slides/net/aspose.slides/audioframe/properties/volume) property
Expand All @@ -88,6 +88,15 @@ PowerPoint Audio options that correspond to Aspose.Slides [AudioFrame](https://r
- Audio Options **Hide During Show** matches the [AudioFrame.HideAtShowing](https://reference.aspose.com/slides/net/aspose.slides/audioframe/properties/hideatshowing) property
- Audio Options **Rewind after Playing** matches the [AudioFrame.RewindAudio ](https://reference.aspose.com/slides/net/aspose.slides/audioframe/properties/rewindaudio) property

PowerPoint **Editing** options that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/net/aspose.slides/audioframe) properties:

- Audio Options **Fade In** matches the [AudioFrame.FadeInDuration](https://reference.aspose.com/slides/net/aspose.slides/audioframe/fadeinduration/) property
- Audio Options **Fade Out** matches the [AudioFrame.FadeOutDuration](https://reference.aspose.com/slides/net/aspose.slides/audioframe/fadeoutduration/) property
- Audio Options **Trim Audio Start Time** matches the [AudioFrame.TrimFromStart](https://reference.aspose.com/slides/net/aspose.slides/audioframe/trimfromstart/) property
- Audio Options **Trim Audio End Time** value is equal to the audio duration minus the [AudioFrame.TrimFromEnd](https://reference.aspose.com/slides/net/aspose.slides/audioframe/trimfromend/) property value

PowerPoint **Volume controller** on the Audio control panel matches the [AudioFrame.VolumeValue](https://reference.aspose.com/slides/net/aspose.slides/audioframe/volumevalue/) property. It allows you to change the audio volume in percent.

This is how you change the Audio Play options:

1. [Сreate](#create-audio-frame) or get the Audio Frame.
Expand Down Expand Up @@ -125,6 +134,43 @@ using (Presentation pres = new Presentation("AudioFrameEmbed_out.pptx"))
}
```

This C# code shows you how to add the new audio frame with the embedded audio, trim it, and set the fade duration:

```c#
using (Presentation pres = new Presentation())
{
IAudio audio = pres.Audios.AddAudio(File.ReadAllBytes("sampleaudio.mp3"));
IAudioFrame audioFrame = pres.Slides[0].Shapes.AddAudioFrameEmbedded(50, 50, 100, 100, audio);

// Sets the start trimming duration to 1.5 seconds
audioFrame.TrimFromStart = 1500f;
// Sets the end trimming duration 2 seconds
audioFrame.TrimFromEnd = 2000f;

// Sets the duration of the starting fade for 200ms
audioFrame.FadeInDuration = 200f;
// Sets the duration of the ending fade for 500ms
audioFrame.FadeOutDuration = 500f;

pres.Save("AudioFrameTrimFade_out.pptx", SaveFormat.Pptx);
}
```

The following code sample demonstrates how to get the audio frame with the embedded audio and change its volume to 85%:

```c#
using (Presentation pres = new Presentation("AudioFrameEmbed_out.pptx"))
{
// Gets the AudioFrame shape
AudioFrame audioFrame = (AudioFrame)pres.Slides[0].Shapes[0];

// Sets the audio volume to 85%
audioFrame.VolumeValue = 85f;

pres.Save("AudioFrameValue_out.pptx", SaveFormat.Pptx);
}
```

## **Extract Audio**
Aspose.Slides for .NET allows you to extract the sound used in slide show transitions. For example, you can extract the sound used in a specific slide.

Expand Down