Update Audio on Slide


#1

Currently, each slide has a notes section which is the text of the audio on the slide. I need to grab the text convert it to a different language and have that converted into speech. That is part is done. I now have a .wav file with French audio. Is there a way to update the current audio on the slide so that when a user clicks on the audio, they hear French instead of English?


#2

@saulr,

I have observed your requirements and like to share that you can get and set the audio data for any AudioFrame added in slide. I suggest you to please try using following sample code for accessing the AudioFrame and changing audio data.

        IAudioFrame audio = (IAudioFrame)slide.Shapes[0];
        audio.EmbeddedAudio.BinaryData = new byte[];

#3

mudassir:

How is this accomplished in Java. I have the following code:

		IShapeCollection shapes = slide.getShapes();
		for (IShape shape : shapes)
		{
			if (shape instanceof AudioFrame)
			{
				IAudioFrame af = (IAudioFrame)shape;
                    }
            }

Once I have the AudioFrame, I can embed the Audio via:

af.setEmbeddedAudio(IAudio);

How do I create a new Audio object with the new file, stream or byte[]?

SaulR


#4

@saulr,

I suggest you to please try using following sample code.

IShapeCollection shapes = sld.getShapes();
for (IShape shape : shapes)
{
        if (shape instanceof AudioFrame)
        {
                IAudioFrame af = (IAudioFrame)shape;
                File file=new File("temp.mp3");
                IAudio audio= pres.getAudios().addAudio(Files.readAllBytes(file.toPath()));
                af.setEmbeddedAudio(audio);
               // byte[] array = Files.readAllBytes(new File("/path/to/file").toPath());
    }

}

Secondly, in order to load file using stream or as bytes, I suggest you to please visit this link for your reference.


#5

That worked. Thank you for the quick response.

SaulR


#6

@saulr,

It’s good to know things are working on your end. Please share, if I may help you further in this regard.