OP25 How to produce audio with op25 as a service?

Status
Not open for further replies.

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
I'm running op25 on a raspi 4 from a terminal and works great, with audio going to the 3.5 mm output.
When I setup op25 as a service on boot, I don't get any audio output. How can I configure this correctly?

this is my op25.sh --
./home/pi/op25/op25/gr-op25_repeater/apps/rx.py --args 'rtl' -N 'LNA:49' -s 2000000 -o 2500 -U -T trunk.tsv -l http:0.0.0.0:8080 -2 --crypt-behavior 2
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,711
Reaction score
1,112
Location
Talbot Co, MD
Most of the time RPi4 sound issues relate to permissions and PulseAudio. You might try experimenting with the option "-O default" or "-O pulse" to see if one works better than the other. Are you using the example systemctl template (op25-rx) provided with op25?
 

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
Most of the time RPi4 sound issues relate to permissions and PulseAudio. You might try experimenting with the option "-O default" or "-O pulse" to see if one works better than the other. Are you using the example systemctl template (op25-rx) provided with op25?
I've made so many changes to the arguments that I can't remember if I started with the template or from one of the online tutorials. everything works great when launching it manually.
I will try the default and pulse options.
 

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
After more testing...
I don't get any audio out when launching op25 as a service, even without a reboot.
running this command - systemctl start op25-rx starts op25, but no audio. I tried using both -O default and -O pulse, still no audio.
using those arguments when launching op25 manually, works fine with either argument.
 

sjacket99

FuzzThePiGuy
Feed Provider
Joined
Dec 21, 2016
Messages
79
Reaction score
42
Location
Pa
After more testing...
I don't get any audio out when launching op25 as a service, even without a reboot.
running this command - systemctl start op25-rx starts op25, but no audio. I tried using both -O default and -O pulse, still no audio.
using those arguments when launching op25 manually, works fine with either argument.

Here's a link to my website that might help you out. It shows how to setup a USB sound card. But the onboard audio device numbers will be different. Website Link.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,206
Reaction score
462
Location
NE Wisconsin
I operate several Raspberry Pi's and other SBC's with op25 to include the Pi-4B. You shouldn't have any issues getting audio from the Pi's 3.5 MM headphone jack with just specifying the -U option on your rx.py command line keeping in mind that I am making reference to Raspbian OS (Buster) Lite version and that either of the GUI versions may involve pulseaudio that may require more a more specific configuration.

However, there are a couple of caveats that you need to be aware of and understand. The audio output from the headphone jack is low level and will not directly drive a speaker directly and you'll need an amplified speaker. Another important aspect is to understand that the Pi's use a four-pole headphone jack and that you must use the correct plug or adapter to convert to four-pole if our speaker has a standard 3.5 MM TRS plug.

Then you must be aware the headphone output level is set to a very low setting by default and that you'll need to run alsamixer to increase the level control to a satisfactory level. See the screen capture below as reference.

alsamixer.png

Finally, you'll want to make this level adjustment setting as your default, else the headphone level will revert back to the original low level upon the next restart of the operating system. This is accomplished by issuing the sudo alsactl store command. You can also test the Pi's sound device using speaker test. IE speaker-test -t sine -f 1004 -c 2 This command will produce a 1004 Hz test tone that alternates between the left and right channels.

Bill
 
Last edited:

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
I operate several Raspberry Pi's and other SBC's with op25 to include the Pi-4B. You shouldn't have any issues getting audio from the Pi's 3.5 MM headphone jack with just specifying the -U option on your rx.py command line keeping in mind that I am making reference to Raspbian OS (Buster) Lite version and that either of the GUI versions may involve pulseaudio that may require more a more specific configuration.

However, there are a couple of caveats that you need to be aware of and understand. The audio output from the headphone jack is low level and will not directly drive a speaker directly and you'll need an amplified speaker. Another important aspect is to understand that the Pi's use a four-pole headphone jack and that you must use the correct plug or adapter to convert to four-pole if our speaker has a standard 3.5 MM TRS plug.

Then you must be aware the headphone output level is set to a very low setting by default and that you'll need to run alsamixer to increase the level control to a satisfactory level. See the screen capture below as reference.

View attachment 99874

Finally, you'll want to make this level adjustment setting as your default, else the headphone level will revert back to the original low level upon the next restart of the operating system. This is accomplished by issuing the sudo alsactl store command. You can also test the Pi's sound device using speaker test. IE speaker-test -t sine -f 1004 -c 2 This command will produce a 1004 Hz test tone that alternates between the left and right channels.

Bill
thank you for the details. my audio is working exactly how I want it when I start op25 manually. the audio goes away when I start op25 as a service. that's the only change I'm making. it's on top of raspi default OS build that I got from raspberry pi website. i'm just lost why runnig it as a service has different behavior.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,206
Reaction score
462
Location
NE Wisconsin
thank you for the details. my audio is working exactly how I want it when I start op25 manually. the audio goes away when I start op25 as a service. that's the only change I'm making. it's on top of raspi default OS build that I got from raspberry pi website. i'm just lost why runnig it as a service has different behavior.
What exact version of the Raspbian OS image do you have loaded?
 

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
Does your service run before or after the pulse audio daemon?
I don’t know enough about Linux to figure that out. But I don’t get audio either if I start op25 as a service manually in a terminal. So I’m not sure it’s that issue.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,206
Reaction score
462
Location
NE Wisconsin
Not that it should make any difference but it appears your version is a bit dated. Mine are all 5.10.11-v7l+ that I want to recall include
various updates/changes to pulseaudio that can be problematic. On the off chance that pulseaudio is the issue then I would suggest that
you non rely on the pulseaudi deamon but rather to add an entry into crontab to start it at boot time.
any
Try running crontab -e then add @reboot pulseaudio --start at the bottom of the file then reboot with your op25 service enabled to see if this helps. The above has resolved permission issues that I have experienced so maybe give this a try and be sure that you don't have anything plugged into the Pi's HDMI ports as may well cause you audio to be diverted to the connected monitor instead of the headphone jack. You can also force the headphone jack in raspi-config as well.

crontab.png
 

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
Not that it should make any difference but it appears your version is a bit dated. Mine are all 5.10.11-v7l+ that I want to recall include
various updates/changes to pulseaudio that can be problematic. On the off chance that pulseaudio is the issue then I would suggest that
you non rely on the pulseaudi deamon but rather to add an entry into crontab to start it at boot time.
any
Try running crontab -e then add @reboot pulseaudio --start at the bottom of the file then reboot with your op25 service enabled to see if this helps. The above has resolved permission issues that I have experienced so maybe give this a try and be sure that you don't have anything plugged into the Pi's HDMI ports as may well cause you audio to be diverted to the connected monitor instead of the headphone jack. You can also force the headphone jack in raspi-config as well.

View attachment 99887
will try this in a few.
I do have HDMI input plugged in, but I can remote in to avoid HDMI surprises. I did use alsamixer and choose the 3.5mm output and saved the alsamixer state.
 

dimab

Member
Joined
Dec 19, 2002
Messages
533
Reaction score
111
Location
CT
Not that it should make any difference but it appears your version is a bit dated. Mine are all 5.10.11-v7l+ that I want to recall include
various updates/changes to pulseaudio that can be problematic. On the off chance that pulseaudio is the issue then I would suggest that
you non rely on the pulseaudi deamon but rather to add an entry into crontab to start it at boot time.
any
Try running crontab -e then add @reboot pulseaudio --start at the bottom of the file then reboot with your op25 service enabled to see if this helps. The above has resolved permission issues that I have experienced so maybe give this a try and be sure that you don't have anything plugged into the Pi's HDMI ports as may well cause you audio to be diverted to the connected monitor instead of the headphone jack. You can also force the headphone jack in raspi-config as well.

View attachment 99887
@reboot pulseaudio --start SOLVED IT! Thank you! I even kept my HDMI plugged in this entire time.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,206
Reaction score
462
Location
NE Wisconsin
@reboot pulseaudio --start SOLVED IT! Thank you! I even kept my HDMI plugged in this entire time.

Fantastic! I normally use the Raspbian Lite OS versions for all of my instances of op25 in that they are headless and have not need for the GUI interface and associated applications. However, I did recall that the GUI versions had pulseaudio installed by default and that I too did have problems with the audio subsystem when starting applications as a service. Now sit back and enjoy opp25!

Bill
 
Status
Not open for further replies.
Top