PowerPoint Creative
Log In or Register to participate in PPC!
PowerPoint Creative
Log In or Register to participate in PPC!

Go down
GamesByTim
GamesByTim
Featured Creator
Featured Creator
Posts : 248
Join date : 2017-10-09
https://www.gamesbytim.com/

Play 2 sounds at once with VBA Empty Play 2 sounds at once with VBA

Sun Aug 30, 2020 4:50 pm
With VBA, we can play a sound with the following code, provided that a sound file is in the shape's action settings.

Code:
ActivePresentation.Slides(1).Shapes("ShapeName").ActionSettings(ppMouseClick).SoundEffect.Play

Problem is, it won't play more than 1 sound at a time. If I run this code:

Code:
ActivePresentation.Slides(1).Shapes("Sound1").ActionSettings(ppMouseClick).SoundEffect.Play
ActivePresentation.Slides(1).Shapes("Sound2").ActionSettings(ppMouseClick).SoundEffect.Play

Only the sound in the shape "Sound2" will play.

How can you play 2 sounds at once with VBA?
rusnakcreative
rusnakcreative
Administrator
Administrator
Posts : 632
Join date : 2017-08-16
https://www.rusnakcreative.com

Play 2 sounds at once with VBA Empty Re: Play 2 sounds at once with VBA

Thu Sep 03, 2020 9:43 pm
If you wanted to play 2 embeded wav files, it isn't possible to play 2 at the same time. What you could do is try to play an external mp3 file with one embedded wav file, as those can be layered.
johnr
johnr
Administrator
Administrator
Posts : 939
Join date : 2017-08-17
Location : UK
http://www.powerpointgames.uk

Play 2 sounds at once with VBA Empty Re: Play 2 sounds at once with VBA

Fri Sep 04, 2020 5:15 am
If you can play both sounds together in any way, you could record them on screen-recording software like OBS Studio (free) then convert the file to wav, mp3 or whatever.
rusnakcreative
rusnakcreative
Administrator
Administrator
Posts : 632
Join date : 2017-08-16
https://www.rusnakcreative.com

Play 2 sounds at once with VBA Empty Re: Play 2 sounds at once with VBA

Fri Sep 04, 2020 11:00 pm
Interesting method, John. Here's an easier method to combine wav files: https://www.audacityteam.org/download/

With that said, I think Tim isn't looking to combine 2 wav files into one, but have the ability to play any 2 wav files at the same time or overlap as needed via the code. However, he could have sound1, sound2, and then the modified sound1+2 as the third sound that would be triggered via a conditional if/then statement. I'm not sure what Tim is doing, but hopefully one of these alternatives would be helpful.
ListWits
ListWits
Featured Creator
Featured Creator
Posts : 64
Join date : 2018-08-26
Location : St. Louis
http://dasaintfan1.wixsite.com/listwits

Play 2 sounds at once with VBA Empty Re: Play 2 sounds at once with VBA

Wed Oct 14, 2020 9:42 pm
Tim, theres' a function sndPlay function

Use https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_winother-mso_2010/playing-sound-file-using-vba/85df78b3-7723-4188-9f7a-34dcf4e0de4e this for your starting point.

I think you have to add one reference in your VBA (Scripting?) to get that one to be recognized...
Sponsored content

Play 2 sounds at once with VBA Empty Re: Play 2 sounds at once with VBA

Back to top
Permissions in this forum:
You cannot reply to topics in this forum