OnNoise event not correctly working

You have a question or need an advice about how to do something? Ask it here!
Post Reply
rvtienhoven
Posts: 40
Joined: 06 Apr 2013 17:15
OnNoise event not correctly working

Post by rvtienhoven »

Hi,

I use the silence detection only when no user is logged in. For this I set the OnUserLogin and the OnUserLogoff to disable/enable the silence detection on input 2.

So, when there is no user logged in. The silence detection detects silence after 30 seconds an triggers the OnDetectSilence. That works fine.
When the OnDetectSilence is detected, it runs the command EXEC_VAR_SET stilte|1 and send an e-mail to me. After 10 seconds, It run the command EXEC_COMMAND2 ${VAR:stilte}|Equals(1)|EXEC_COMMAND_USER_22.
In OnUser22, I run the following command EXEC_COMMAND2 ${VAR:stilte}|Equals(1)|PROGRAM_STARTSCRIPT |nonstop muziek|${now}|true.
In the OnDetectNoise i run EXEC_VAR_SET stilte|0.
The idea is that when there is 30 seconds silence, I get an e-mail. When after 40 seconds is no sound, User Command 22 is triggered. But, When the sound comes back between the 30 and 40 seconds, Proppfrexx must detect the noise and execute the command EXEC_VAR_SET stilte|0.
There is the exact problem. Proppfrexx don't detect the noise quickly enough. Sometimes, It occures 1 or 2 minutes before Proppfrexx see's noise.

But, when I test it when i logged in (and enable the silence detection on input 2 manually, Proppfrexx detects the noise quicker, around a few seconds.

Did I somethin wrong or is this a bug?

Remi
User avatar
radio42
Site Admin
Posts: 9139
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: OnNoise event not correctly working

Post by radio42 »

Control Commands are executed in the order they appear.
How do you 'wait' another 10 seconds as you described above?
Are you using the SLEEP control-command?
Note, that even in this case, the SLEEP would be executed and would block any other commands. This is because a SLEEP really blocks and waits before any other command processing continues.

How do you measure, that the OnDetectNoise is processed 1 or 2 minutes late?
I seem to not be able to reproduce that here.
And what 'signal' do you receive on INPUT 2?

I just made the following test (MIC1 in my case was an external microphone, so being quite would trigger the silence detection and speaking raises noise...)... maybe you can do the same test:

OnUserLogin:
MIXER_INPUT_SILENCEDETECTION_OFF MIC1
SHOW_ALERT_WINDOW Silence Detection is OFF

OnUserLogoff:
MIXER_INPUT_SILENCEDETECTION_ON MIC1
SHOW_ALERT_WINDOW Silence Detection is ON

OnDetectSilence:
SHOW_ALERT_WINDOW SILENCE !!!!

OnDetectNoise:
SHOW_ALERT_WINDOW SILENCE !!!!

I had UAC enabled and was loggin in:
Test1:
- I was quiet...
- Silence was detected exactly after 30 sec. (Popup windows was shown)
- I speak into the Mic
- Noise was detected immediately (Popup windows was shown)

I logged off (clicked on the lock symbol and the login dialog was shown)
Test2:
- I was quiet...
- Silence was detected again exactly after 30 sec. (Popup windows was shown)
- I speak into the Mic
- Noise was again detected immediately (Popup windows was shown)

So no difference between Test 1 or 2.
Can you do the same and see, if that is also the same for you?
rvtienhoven
Posts: 40
Joined: 06 Apr 2013 17:15
Re: OnNoise event not correctly working

Post by rvtienhoven »

Hi Bernd,
I did your test, and it works here exactly the same as you describe. So, my conclussion is that it is my row of commands that is the issue.
I have removed all unnessesary stuff and change the e-mail send to alerts so it is easier to test...

In 'OnDetectSilence' i have:
SHOW_ALERT_WINDOW SILENCE !!!!
EXEC_VAR_SET stilte|1
SLEEP 2000
SLEEP 2000
EXEC_SEND_EMAIL *****@*****.nl|****@****.nl|Soundcard recreated at ${now} |${now}
SLEEP 2000
SLEEP 2000
EXEC_SEND_VELLEMAN 0|4|true
SLEEP 2000
SLEEP 2000
EXEC_COMMAND2 ${VAR:stilte}|Equals(1)|SHOW_ALERT_WINDOW Nonstop music started !!!!
EXEC_COMMAND2 ${VAR:stilte}|Equals(0)|SHOW_ALERT_WINDOW Noise again. No nonstop music started !!!!


In 'OnDetectNoise'
SHOW_ALERT_WINDOW NOISE !!!!
EXEC_VAR_SET stilte|0


When I use this, the alert with 'NOISE !!!!' is not shown directly when the sound comes back. When I log in and logg off (when there is sound on the input), after the log of, the alert 'NOISE !!!!' is shown. So I assume that there is something not correct in my 'OnDetectSilence' event?
Last edited by rvtienhoven on 03 Feb 2017 22:45, edited 1 time in total.
rvtienhoven
Posts: 40
Joined: 06 Apr 2013 17:15
Re: OnNoise event not correctly working

Post by rvtienhoven »

Hi Bernd.
Until now, I use the silence detection for only recreate the mixer channels. Once a month, the soundcard causes silence, so that is why I use this. After the silence detectiopn detects silence, it occurs around 2 seconds before the sound cames back.

I want that, If the sound cames back after the recreate and reset, there happends nothing else. But if the sound does not came back, I want to start an script and send an e-mail.
I had added the SLEEP commands, so proppfrexx looks after 12 seconds If there is noise (and do nothing) or there is silence (and start an script).
These 12 seconds are to be sure that the soundcardchannels are recreated...
Or is there another way to do this
User avatar
radio42
Site Admin
Posts: 9139
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: OnNoise event not correctly working

Post by radio42 »

No, as said it should never actually happen, that you need to (re)create you mixer channels, that's why this very strange situation can not automatically be handled. Have you already contacted your soundcard vendor about the problem?! Sounds like you need a new driver or even a new soundcard?

But I still do not exactly what is happening, as here all works fine. Maybe your soundcard really 'hangs' and thus the recreation of a valid status simply takes that long.
However, as said, the SLEEP(s) would block the OnNoiseDetection.
AND...
...one more note: The reset and recreate of the mixers do reset the Sielence Detection. Meaning they default to their initial config value.
E.g. you might need to (re)enable the silence detection after the mixer has been recreated, via:

Code: Select all

MIXER_INPUT_SILENCEDETECTION_ON Input2
What you might try is to create a small (Power)Shell script and start this one from within the OnSilenceDetection.
This shell script might then sleep by itself and even use the "pfremcmd.exe" command-line tool to trigger PF commands from within this shell script. This might work must better, as it decouples the command processing from your SLEEP(s).

But I'd better try to find the root cause of your soundcard issue!

So I guess I can close this thread and I am afraid, that the behavior is by design resp. due to your soundcard problem and not because of a ProppFrexx bug?!
User avatar
radio42
Site Admin
Posts: 9139
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: OnNoise event not correctly working

Post by radio42 »

Do you mind explaining why you need want to recreate and reset all mixer channels? This is normally never needed, except you have a buggy soundcard/driver?!

I even assume, that the reset might cause your delays?! What if you remove them?

However, even note, that the 'OnDetectSilence' blocks ALL other events/commands (as explained above) for at least around 12 seconds!
This means, if the sound comes back within these 12 seconds ... the OnDetectNoise event could only be processed after all these commands in the OnDetectSilence sequence have been fully processed. Is that what you want resp. experience?
rvtienhoven
Posts: 40
Joined: 06 Apr 2013 17:15
Re: OnNoise event not correctly working

Post by rvtienhoven »

Hi Bernd,

Yes, i dit not know that the SLEEP command blocks all other commands in Proppfrexx. So, that is the declaration of the core issue.
I use now no SLEEP commands anymore but archuments based on macro's and that works for me. Thank you very much for your quick reply's and thinking!

Post Reply