5

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.

Dibo
  • 1,159
  • 17
  • 34

4 Answers4

3

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

peterh
  • 11,875
  • 18
  • 85
  • 108
alinsoar
  • 15,386
  • 4
  • 57
  • 74
  • Is that in-built to many Linux systems, though? I know it's almost ubiquitous, but all of my Linux systems did require a separate install for it. – Ricardo Altamirano Aug 07 '12 at 21:54
  • Mplayer must be installed on linux and what I know it doesn't even on ubuntu. Has linux some player in kernel (any format)? – Dibo Aug 07 '12 at 22:00
  • no. in linux kernel there is only the sound driver, and this one depends on your sound card. In ubuntu you can install it with `apt-get install mplayer`, or with `./configure && make && make install` , if you download the sources from the official site (in Hungary). – alinsoar Aug 07 '12 at 22:04
2

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

entropy
  • 3,134
  • 20
  • 20
1

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.

Dylan
  • 189
  • 12
1

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.