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.
Problem is, it won't play more than 1 sound at a time. If I run this code:
Only the sound in the shape "Sound2" will play.
How can you play 2 sounds at once with VBA?
- 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?
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.
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.
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.
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.
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...
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...
Permissions in this forum:
You cannot reply to topics in this forum