DEV Community

Cover image for VBScript - Text to Speech/Play Sound
Dan Wheeler
Dan Wheeler

Posted on

6

VBScript - Text to Speech/Play Sound

Create a .vbs file with the following code, and it will play a sound and also say something out loud of your choosing... neat huh?

Set oV = CreateObject("SAPI.SpVoice")
Set oFS = CreateObject("SAPI.SpFileStream")
oFS.Open "C:\Windows\Media\tada.wav"
oV.SpeakStream oFS
oFS.Close
oV.Speak "Hello World!"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

πŸ‘₯ Ideal for solo developers, teams, and cross-company projects

Learn more