devxlogo

Playing Sound Files in FoxPro Apps Quickly

Playing Sound Files in FoxPro Apps Quickly

Question:
I write language instruction programs and have been calling mplayer2 to allow students to hear the pronunciation saved in recorded sound files. But mplayer takes forever to load and play. So do all the other executable programs that I have, such as xrecord.

By contrast, Windows can play .wav files instantly. If I could load and play small .wav files that fast I could greatly improve my language program. (There must be some subfile of Windows that plays its sound files so quickly.)

What other .exe files are there that load and play very quickly under FoxPro? Using verbs in FoxPro is even slower than calling .exe files for some reason.

Answer:
Visual FoxPro lets you set the bell sound (using the SET BELL TO command) to a .wav file. You can then play the bell sound by executing the command:

??CHR(7)

For example, let’s say that you have a .wav file called Stewart.wav. Here is the code that will cause the .wav file to play:

SET BELL ONSET BELL TO "Stewart.wav",0??CHR(7) && Rings the bell/plays the sound

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist