Search code examples
audioprologswi-prolog

How to play a sound using Prolog?


If I have an audio file, how can I play it using Prolog? I cannot find any code in the documentation that relates to audio playing.


Solution

  • You will have to use some interface to the system for that (i.e. get out of the Prolog world and tell the surrounding system to do something).

    If you are comfortable coding in C and have an audio-playing API somewhere, the Foreign Language Interface.

    More reasonably, you can use the shell/1 (or the Win32 equivalent) predicate to issue a shell command to a command interpreter: Operating System Interaction