News:

LATEST RELEASE:  FPP 8.1 - Download from here - https://github.com/FalconChristmas/fpp/releases/tag/8.1

+-+-

+-User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+-Site Stats

Members
Total Members: 16584
Latest: bt129
New This Month: 22
New This Week: 13
New Today: 2
Stats
Total Posts: 133553
Total Topics: 16622
Most Online Today: 46
Most Online Ever: 7634
(January 21, 2020, 02:14:03 AM)
Users Online
Members: 0
Guests: 27
Total: 27

Kill WHILE LOOP script started from FPP...

Started by casiokid, July 30, 2024, 09:10:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

casiokid

Hi all,
Long story short, the speakers I'm using for our Halloween show either have an annoying noise gate on them or some other "sleep while silent" function so the audio at the start of the FSEQ file is always silent for the first second or two. This is obviously not ideal.

My workaround is to continuously play a 20Hz tone (which the speakers "see" but won't be audible because they can't play audio in that range). Now, all the audio starts perfectly!

I'm wrote a short bash script for this here:

#!/bin/bash
while [ 1 ] ; do
aplay /home/fpp/media/music/20HzTone.wav
done


And I'm starting it with my idle show so it's always on. But, that's not the sexiest solution and I realized that when I go BACK to the idle show after a light show has occurred, it's going to restart that script. I don't want a build up of continuously playing audio cluttering up the background and taking up memory.

So, the question is...does anyone know how to kill a bash process in a WHILE loop through FPP? I've tried:

killall <process_name>
killall -9 <process_name>
killall aplay


I can't seem to find the right syntax to kill this process and if I do

ps aux

I can see the process running, but maybe through an FPP wrapper? I don't know what/why/where the "/opt/fpp/scripts/eventScript" is doing. It seems to be running the script I'm telling it to via some other method? Does this make sense?


fpp 17495 0.0 0.0 1972 392 ? S 18:56 0:00 sh -c sudo /opt/fpp/scripts/eventScript /home/fpp/media/scripts/20Hz_start.sh

root 17496 1.0 0.1 13016 4100 ? S 18:56 0:00 sudo /opt/fpp/scripts/eventScript /home/fpp/media/scripts/20Hz_start.sh

root 17497 1.0 0.0 7764 2720 ? S 18:56 0:00 /bin/bash /home/fpp/media/scripts/20Hz_start.sh

root 17513 0.3 0.0 8136 2476 ? S 18:56 0:00 aplay /home/fpp/media/music/20HzTone.wav

Either way, any ideas on where to go from here? This is my first time using scripts with FPP. It seems really robust and there are a ton of different and cool things you can do with it, but I'm not sure I fully understand how it's running right now.

Thank you for any help!
HinksPix Pro, Raspberry Pi 4, FPP 7.5, xLights

casiokid

Ok, I think I was trying to reinvent the wheel here...I decided to try and use VLC instead and that is WAY easier to control. For anyone interested, here's what I ended up doing...

This script is at the start (Lead In) of each of my playlists so the speakers get "activated":

#!/bin/bash
vlc --loop /home/fpp/media/music/20HzTone.wav


I'm starting VLC and looping the audio file.

Then, when the playlist is over (Lead Out), I'm using this script:

#!/bin/bash
killall vlc


This works for me! Hopefully someone else with similar speaker issues will find this useful!
HinksPix Pro, Raspberry Pi 4, FPP 7.5, xLights

breese


casiokid

They are Pyle outdoor speakers. I've read other people having issues with powered speakers that take a second to start playing audio. I think its a safety or power consumption feature on the amp.
HinksPix Pro, Raspberry Pi 4, FPP 7.5, xLights

robbiet

I've used these same speakers for the past few years and have the same issue. I'll have to give this a try.  Do I just save the audio file with other files or is there another place you have to save it?  I'm not familiar with VLC.


Sent from my iPhone using Tapatalk

casiokid

I just uploaded the file to the Pi and it automatically placed it in the "Audio" folder since it was a .wav file.

I've attached the .wav file if you'd like to use it! That, plus I code I provided and your issue should be solved!

VLC is just a media player that comes bundled with the Pi software. So, when you call VLC, you're just opening a media player with the argument "--loop" and telling it what file to play.

I also put a 1 second pause after the file starts in the Lead In just so I know it's playing and the first song in the playlist will be heard.
HinksPix Pro, Raspberry Pi 4, FPP 7.5, xLights

casiokid

HinksPix Pro, Raspberry Pi 4, FPP 7.5, xLights

robbiet

Thanks for sharing.  I gave it a test and works great!  I also discovered another bonus.  For speakers that have an auto off "feature" where the speaker shuts off after a certain period of inactivity (like most portable bluetooth speakers), this will keep them alive if you just have FPP run the wav file continuously in the background.  I added a command preset to fire the script on fppd start so that this is always running in the background.  Works great!

Poporacer

#8
I think you are making it more difficult than it should be. Why not create a sequence with just the audio and schedule that to play continuously. Then create your Show schedule to play when you want and place this schedule higher on the priority list?
That way, any time your scheduled show is not playing, FPP will play your tone and then turn it off when your show is playing.
That might be an easier solution?
If to err is human, I am more human than most people.

robbiet

Yep. That would work too. It is pretty nice though to have this just run behind the scenes where it doesn't impact any of the other functions in FPP.  It's nice that the status page does not show the forever running loop and there is no impact to the playlists/sequences. This makes it almost like a setting you just turn on.


Sent from my iPhone using Tapatalk

Support FPP

+- Recent Topics

Pixels flickering when playing directly from XLights by JonD
Today at 09:11:21 AM

problems with a matrix setup by cowboyjeeper
Today at 07:37:55 AM

K40 Network port stopped working by Joepat
October 10, 2024, 08:13:00 PM

Composite analog video output on Pi 4 / FPP 8.1 by scsi
October 10, 2024, 06:23:12 PM

PiCap V2 & DMX by breese
October 10, 2024, 04:27:56 AM

co-universes.json does not exist keeps showin up in log by eatumup
October 09, 2024, 10:25:25 PM

Install New FPP by PittFan
October 09, 2024, 08:05:55 PM

Xlights FPP Connect Issues by Poporacer
October 09, 2024, 07:43:34 PM

FPP->HinksPix by MikeKrebs
October 08, 2024, 09:12:13 PM

Video uploads not working. by bciarcia
October 08, 2024, 08:32:23 AM

Powered by EzPortal
Powered by SMFPacks Menu Editor Mod