This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to play sound from commandline?

Tags: None
(comma "," separated)
User avatar
pavel
Registered Member
Posts
134
Karma
1
OS

How to play sound from commandline?

Fri Feb 27, 2009 9:51 am
I use Psi as my jabber client. It uses aplay as a default sound player on Linux. Now it does not work. I think, the reason is Phonon system.

Link to the Psi forum

So, I am to use some small and fast sound player for Psi. Mplayer works good, but slow. The sound delays from the action about 0.5 - 2 seconds - that is uncomfortable.

My idea is to use some command-line player which works through the phonon. And... I am looking for it :-)


pavel, proud to be a member of KDE forums since 2008-Dec.
User avatar
Amine27
Registered Member
Posts
32
Karma
0
OS
see sox


Amine27, proud to be a member of KDE forums since 2008-Oct.

Image
User avatar
pavel
Registered Member
Posts
134
Karma
1
OS
I tried play program fron sox. But it does not work for me now:

Code: Select all
pavel@pavel:~/tmp> play /usr/share/psi/sound/chat1.wav
ALSA lib pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to open slave
play formats: can't open output file `default': cannot open audio device
pavel@pavel:~/tmp>


If you see the link to Psi forum, you would see that my initial problem with aplay was very similar


pavel, proud to be a member of KDE forums since 2008-Dec.
User avatar
SeaJey
Registered Member
Posts
166
Karma
0
OS
Did you try:
Code: Select all
play


There is also terminal commands for PulseAudio, oss4 and maybe gstreamer.

Last edited by SeaJey on Fri Feb 27, 2009 12:48 pm, edited 1 time in total.


kubuntu 10.04 AMD64 - KDE 4.4
AMD - radeonHD - M-Audio revolution 5.1
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
pavel wrote:I use Psi as my jabber client. It uses aplay as a default sound player on Linux. Now it does not work. I think, the reason is Phonon system.


That is almost certainly not related to Phonon.

The sound setup of the distribution seems to have problems allowig more than one application access to the ALSA sound system.
It is probably not using dmix or not routing sound through PulseAudio if it is using that.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
L_V
Banned
Posts
104
Karma
-3
OS
Back to first message.

KDE4 is using a sound player command to preview .ogg ou .wav files in Dolphin for example.

What is this KDE4 sound player command ? (not looking for extra program like play or aplay).

Thanks.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
KDE 4 does not use a command to play audio files. It uses the Phonon framework and does it in process. As said by anda_skoa, it is most certainly related to problems with your ALSA configuration, or use of Pulseaudio.

It appears that DMix has an invalid configuration based on the error message.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
L_V
Banned
Posts
104
Karma
-3
OS
Sorry but I did not say sound is not working.
I am just asking for a command.

artsplay was available in KDE3 (/usr/bin/artsplay in libarts1c2a).

I am looking for the equivalent in KDE4.

Or said differently, what script could execute the phonon process ?
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
L_V wrote:Or said differently, what script could execute the phonon process ?


There is no such things as a Phonon process. Phonon is an API, not a multimedia framework or a sound daemon (aRts was both combined).

You can use any command line tool, e.g. aplay from ALSA, or whatever command line tool GStreamer or Xine have.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Which backend do you have selected in System Settings > Multimedia?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
L_V
Banned
Posts
104
Karma
-3
OS
The backend I use is phonon-backend-xine
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You may wish to try the "xine" executable in this case. Although it may be Xine's user interface, I am unsure since I do not have it installed.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
L_V
Banned
Posts
104
Karma
-3
OS
xine launchs xine-ui.

The kde4 command is at lower level.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
As stated previously, KDE uses the backend, which in turn interfaces with the underlying library for the chosen backend directly.

No playing command exists at this time, until a Qt based command line player, which uses the Phonon framework to play the file specified is written. You may wish to check the Qt examples, kde-apps.org, and kde-look.org where such applications may exist.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Ignacio Serantes
Registered Member
Posts
453
Karma
1
OS
A simple player is kphononplayer but an anoing window appears but, in Qt examples there is a simple example with code of a Phonon Media Player.

If you have programming skills must be easy create a command line phonon player.

You can found the example here:

http://doc.trolltech.com/main-snapshot/ ... layer.html

Other option is locate kphononplayer code and remove the window code and compile your own version.


Ignacio Serantes, proud to be a member of KDE forums since 2008-Nov.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, gfielding, Google [Bot], markhm, rblackwell, sethaaaa, Sogou [Bot], Yahoo [Bot]