Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I play a wav file from a Free Pascal application running on Linux?

I have a multi-platform application written in Free Pascal. This application plays a short sound on some event. On Windows, I can do this by MMSystem and sndPlaySound('sound.wav'). However, I don't know how to do this on Linux without external libraries.

I have a solution to play it with SDL and OpenAL, but I don't want any dependency on these libraries to play one short sound. Does there exist a Linux command line player that exists on most distros by default? The file format doesn't matter; I will convert it.

like image 971
Dibo Avatar asked Aug 07 '12 21:08

Dibo


4 Answers

mplayer is command line and graphical. You can start it on tty and pty.

like image 157
alinsoar Avatar answered Oct 31 '22 21:10

alinsoar


You could try aplay, but that has a dependency on ALSA. Maybe sox?

like image 2
entropy Avatar answered Oct 31 '22 19:10

entropy


The program mplayer - "the movie player" gives you the option to use a graphical user interface or to use the console. So i would imagine it has a solution to your problem.

like image 1
Dylan Avatar answered Oct 31 '22 19:10

Dylan


Are you looking to BEEP, BLEEP and BOOP and BOP ( and low frequency fart) ? Use sox. If youre looking to play a file: use sox or SDL.

You need a for looped array to get a sort-of piano effect, like a song. Its ugly, messy, and cant be tweaked much like the ole PC speaker, but its passable.

Beep is probably want you want, tho. Install the package, put one on your motherboard(YEAH...no hookup? use sox), and enable the pcspkr module. (On ubuntu its blacklisted by default.) If BEEP produces nothing, try sox.

At least youll have something. Yes, you can check for loaded modules and installed packages. I believe Ive done both.

like image 1
snobhobber3 Avatar answered Oct 31 '22 21:10

snobhobber3