Command line Music playback via 3.5mm

Hey guys,

i want to play alertsounds via command line over the stereo output without interference with the kodi playback over HDMI

if tryed mplayer as well as mpg123 but they missing some configurations file so they dont make any sound at all.

does anyone got a guide, a solution or could help me out please?

Thanks in advance

edit:I use a pi2

I don’t think you can do that - you cannot use both outputs independently (may not even be able to use both together, but there seems to be a setting to do it)

Well it whould be OK if i could play a sound over HDMI if it dont stop the Kofi playback at all, but I would preffer if its possible to play separated over the 3,5mm jack.

or maybe USB soundcard ?

You’ve hit my ignorance - no idea whether that is possible

well nobody around who could help us over here?

No reason why it shouldn’t be possible. Set kodi to output to HDMI.
You may need to load the alsa module:

sudo modprobe snd-bcm2835

before mplayer works.

If it should be simple, try alsaplayer. Should be in the repo. Load the module before.
With alsaplayer you should also be able to set the hw device to output to.

Well first of all a big thanks to everyone,
i did as Popcornmix told me and right now it seems to try to playback somethink but it doesnt work.

    osmc@osmc:~$ sudo mplayer codec.mp3
MPlayer2 2.0-728-g2c378c7-4+b1 (C) 2000-2012 MPlayer Team
Cannot open file '/root/.mplayer/input.conf': No such file or directory
Failed to open /root/.mplayer/input.conf.
Cannot open file '/etc/mplayer/input.conf': No such file or directory
Failed to open /etc/mplayer/input.conf.
Failed to read LIRC config file ~/.lircrc.

Playing codec.mp3.
Detected file format: MP2/3 (MPEG audio layer 2/3) (libavformat)
[lavf] stream 0: audio (mp3), -aid 0
[lavf] stream 1: video (mjpeg), -vid 0, C:\Users\M\Videos\tmp_cover157.jpg
Clip info:
 track: 1
 title: Codec Sound
Load subtitles in .
Selected audio codec: MPEG 1.0/2.0/2.5 layers I, II, III [mpg123]
AUDIO: 48000 Hz, 2 ch, s16le, 320.0 kbit/20.83% (ratio: 40000->192000)
AO: [pulse] Init failed: Connection refused
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
[AO_ALSA] Unable to find simple control 'Master',0.
Video: no video
Starting playback...
A:   3.7 (03.7) of 3.8 (03.7)  3.7%

Exiting... (End of file)

Well it seems like i need to config somethink, btw i also tryed to play other mp3 the file shouldnt be the problem.
Thank you guys i advance

Seems like pulse won’t play nice. Did you try alsaplayer?

Edit: Here could be some useful information:

Well i tryed some solutions from the link but it doesnt helped me out of this mess:

i make a .asoundrc file ( i got none before #2)

i set the default output to headphones (#1)

i looked for

aplay -l

and got the same lines but

osmc@osmc:~$ aplay -Dhw0,0 codec.mp3

gave me

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM hw0,0

What does it do, when you just aplay codec.mp3 ?

osmc@osmc:~$ sudo aplay codec.mp3
Playing raw data 'codec.mp3' : Unsigned 8 bit, Rate 8000 Hz, Mono

But it takes a long time to finish the longer as the alert sound should be

Well, it plays raw data as it doesn’t know the mp3 format. Try a wav file.

i did :frowning:

osmc@osmc:~$ sudo aplay codec.wav
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:722: audio open error: No such file or directory

sry for all this noob questions, but i never was into that kind of configure stuff before.

That is strange as it works for me without a problem:

osmc@osmc:~$ aplay test.wav
Wiedergabe: WAVE 'test.wav' : Unsigned 8 bit, Rate: 44100 Hz, mono

can you show me ur configured files please?

Nothing is manually configured. Works as is.

you just got a fresh osmc build and than u can use aplay ? o.O ?

Not really as I did a lot of other experiments.
I can only say that it works here.

could you check and post



aplay -l