TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: PETE
from: A. DUMAS
date: 2019-06-15 10:06:00
subject: Re: mpg123 to audio jack?

Pete wrote, on 14-06-2019 23:21:
> A. Dumas  wrote:
>> The player program doesn't determine where the output goes, the system
>> does that. In a terminal window:
>>
>> amixer cset numid=3 1
>>
>> where the second parameter is: 0=auto (default), 1=jack, 2=hdmi
>> Doesn't need sudo and persists across reboots. I think it can also be
>> set via raspi-config (which does need sudo, although maybe not for this
>> setting, I never tried).
>
> Ahh.  I have vague memories now of going through that when I was
> trying to get omxplayer to output to the jack.  It *didn't* work
> there, because it turns out that with omxplayer you have to use
> the "--adev local" option to redirect the output.  I guess it
> doesn't use alsa.

Yes, I wasn't precise: omxplayer is special, it speaks to hardware
directly. I'm not sure how it determines a default output path if you
don't specify it on the command line. Maybe simply hdmi always?

> As sometimes I do want audio out via hdmi -- playing a video for instance --
> it's probably more convenient to stick with omxplayer, as there's really
> nothing wrong with the job it does.

You can use the amixer command to set it to jack once (and for all), for
mpg123 with alsa, and use "--adev hdmi" for video's? Short option "-o
hdmi" works too. Or if output to jack is the exception, make a bash file:

#!/usr/bin/env bash
# set alsa output to jack
amixer cset numid=3 1
# play the file
mpg123 $*
# set alsa output to hdmi
amixer cset numid=3 2

Save it as e.g. myplayer, make it executable: "chmod 755 myplayer" and
move it to /usr/local/bin/ (requires sudo). Then call it as you would
mpg123 but with the new name. The commandline parameters get passed on.

I prefer mpd+mpc, by the way, because it plays streams, playlists and
libraries. But mpg123 is more convenient for single files occasionally,
I suppose.

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.