mpg123 to audio jack?

In a previous thread I mentioned that I'm using omxplayer to play audio (streams), but others said they were just using mpg123, which seems more reasonable. However, I'm feeding the audio to my sound system through the audio jack, and I can't get mpg123 to do that. It insists on going through HDMI, which I usually don't want. (I log in via SSH from other machines)

I assume I'm likely being stupid, but I've been playing for a while without luck. Can somebody help?

Thanks,

-- Pete --

Reply to
Pete
Loading thread data ...

Sorry, I just use mpv, which seems to do the right thing pretty much automatically. (And has a reasonably well-documented configuration interface for when it doesn't.)

Reply to
Roger Bell_West

Pete wrote, on 13-06-2019 23:38:

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).

Reply to
A. Dumas

Mine goes via pulseaudio and alsa.

I cant remember how I made sure that alsa went to my Pi DAC and not the HDMI.

--
"First, find out who are the people you can not criticise. They are your  
oppressors." 
      - George Orwell
Reply to
The Natural Philosopher

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.

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.

Thanks.

-- Pete --

Reply to
Pete

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?

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.

Reply to
A. Dumas

I thought of doing something like that (I use scripts for playing streams of course) but, as I say, nothing's really broke...

Something else to investigate.

Thanks,

-- Pete --

Reply to
Pete

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.