OP25 using Icecast2 and Local Audio

Status
Not open for further replies.

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Thanks in advance for reading this and any help you might be able to share.

Has anyone been able to get OP25 / liquidsoap / Icecast2 running as a service to work while still letting the Raspberry Pi deliver audio?

I have OP25 working wonderfully, I am just trying to have the audio play locally. I have tried just about every possible combination but it is not working. It does appear to be a permissions issue with the

I do have the following added to the crontab

@reboot pulseaudio --start


ry log


streaming server url="http://192.168.86.43:8000/op25.m3u"
using ALSA sound system
audio device: default
Listening on 127.0.0.1:23456
Traceback (most recent call last):
File "./rx.py", line 1078, in <module>
rx = rx_main()
File "./rx.py", line 984, in __init_
self.tb = p25_rx_block(self.options)
File "./rx.py", line 274, in __init__
self.audio = audio_thread("127.0.0.1", self.options.wireshark_port, self.options.audio_output, False, self.options.audio_gain)
File "/home/pi/op25/op25/gr-op25_repeater/apps/sockaudio.py", line 545, in __init__
self.sock_audio = socket_audio(udp_host, udp_port, pcm_device, two_channels, audio_gain, dest_stdout, **kwds)
File "/home/pi/op25/op25/gr-op25_repeater/apps/sockaudio.py", line 409, in __init__
self.setup_sockets(udp_host, udp_port)
File "/home/pi/op25/op25/gr-op25_repeater/apps/sockaudio.py", line 509, in setup_sockets
self.sock_a.bind((udp_host, udp_port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
Using Python /usr/bin/python2
gr-osmosdr 0.1.4 (0.1.4) gnuradio 3.7.13.4
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy airspyhf soapy redpitaya freesrp
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner

op25 Start Line

./rx.py --nocrypt --args "rtl" --gains 'lna:47' -S 960000 -M meta.json -l http:192.168.86.43:8080 -q 0 -v 5 -2 -V -U -T trunk.tsv -w 2>>stderr.log
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
921
Location
NE Wisconsin
The issue is that you're attempting to use sockaudio (-U) with rx.py simultaneously while using it within your liquidsoap (.liq) script.
Remove the -U from your rx.py command line and reconfigure op25.liq to enable the local speaker audio per the example below.

It should not be necessary to start pulseaudio from the crontab so long as you're using the Pi's internal audio device that provides
low level out via the headphone jack. Remember run alsamixer to raise the default headphone gain to a level that's sufficient to drive
an amplified speaker.

op25.liq

# LOCAL AUDIO OUTPUT
# Uncomment the appropriate line below to enable local sound
#
# Default audio subsystem
#out (input)
#
# PulseAudio
#output.pulseaudio(input)
#
# ALSA
output.alsa(input)



Bill
 

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Thanks very much.

I know I had tried this a few times with no luck. But I have it working now.

I added an external Bluetooth transmitter so I can now get the audio from the closet the Pi is in.

Again, Thanks.

Dave
 

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Ok so now that it is working, how do I fix the output going to the HDMI and not the headphones?

I am trying to run headless.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
921
Location
NE Wisconsin
Ok so now that it is working, how do I fix the output going to the HDMI and not the headphones?

I am trying to run headless.

Perhaps I don't understand your question. If running headless, (absence of HDMI device connected) then the Raspberry Pi should treat the headphone jack as the default ALSA sound device. Are you asking how to direct audio to the HDMI port (not headless) instead of to the
headphone port?
 
Last edited:

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Sorry I wasn't clear.

When I run the sound test on the Pi it plays on the headphones. But when running op25-liq the sound only goes to the HDMI.

I am trying to not have any sound come out the HDMI.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
921
Location
NE Wisconsin
Disconnecting the HDMI cable from your Pi should result in the headphone jack becoming the default sound device. If that doesn't work
then open a terminal and submit aplay -l and note the Playback hardware device list that should look like the example below. It would also
be helpful to know what the specific RPi image is that's loaded on your Pi.

**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
 

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Thanks for your help.

When I disconnect the HDMI and reboot. The Pi still thinks the HDMI is there.

**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 3/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3


I am using this OS

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"


Running tvservice -n to see the status of HDMI I get

[E] No device present
 
Last edited:

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
921
Location
NE Wisconsin
I would remove the crontab entry to manually start pulseaudio as this support is not required to make use of the Pi's internal
headphone audio device. Run sudo raspi-config > System Options > Audio then set the output device to the headphones.

I would be curious to know when accessing this menu option if the HDMI device is populated as a choice while the HDMI cable is
detached from your Raspberry Pi.

BTW, be sure to ssh into your Pi to perform these operations while leaving the HDMI cable disconnected.
 

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Running the raspi-config the only option is headphones.

I had already removed the corntab entries. Both crontabs are blank. I have also made sure all updates are completed through apt.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
921
Location
NE Wisconsin
I am going to assume that you're running one of the two Desktop versions of Raspbian Buster that can complicate simple headless operation in
that there are a number of possible configurations (files) that need to be checked to set the headphone jack as the Default ALSA sound device.

I want to recall with the Desktop that there is a GUI that permits the user to select Analog (headphone) or HDMI as the desired audio output
sink. You might check to see how this option has been set. Additionally, check to see if your installation contains the file .asoundrc that
would be located in your user (pi) home folder and to view its contents if found to exist.

Are you running op25 and liquidsoap as a service? Does it make any difference in the sound device between running these applications
as a service verse's logging in and executing them manually?

I don't know if you're using your Pi to run other applications or if your focus is concentrated on running op25 and liquidsoap in a headless
configuration. It it's the latter, then I would suggest offloading of your op25 and liquidsoap configuration files and then to reflash the
Micro-SD with a fresh image of Raspbian Bullseye Lite then rebuild op25.

I run a number of instances of op25 on nearly a dozen Pi's at various location in a headless configuration using the Lite versions of the
Raspbian OS and never have had any problems with the sound system not to mention freeing up processor and memory resources by
eliminating all of the baggage of the Desktop environment.
 

davcross

Member
Premium Subscriber
Joined
Jun 9, 2016
Messages
12
Location
West Chester, Pa
Well,

I think I got this working correctly.

run aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 3/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3


I had to add a file

sudo nano /etc/asound.conf putting the following into the file.


defaults.pcm.card 1
defaults.ctl.card 1


The number at the end relates to the card number from the above aplay

I can now start growing my hair back.

Thanks for your help.
 
Status
Not open for further replies.
Top