Old 8th October 2004, 18:24   #1
seattlex19
Junior Member
 
Join Date: Oct 2004
Posts: 18
Detect Silence / Trigger Event

I have a crazy request here and I am just hoping anyone reading can do this. It does not seem like it would be that tough to make happen for someone who knows what they are doing - sadly I don't, I'm not a coder, developer, etc. I just have an idea and need to know how to do it, or whether a plugin that will do it already exists, or if someone would want to create a plugin that does it. Failing all that maybe someone could suggest an "outside" way to get it done (ie: some script or app independent of Winamp that could run alongside to accomplish same goal?)

THE CONCEPT IS THIS:

I need some way to have the sound coming through Winamp be monitored in realtime and have any period of silence longer than X seconds detected, where if such a period is detected, an outside event (in my case launching a batch file) will be triggered. Seems simple. Is it?

Not knowing anything about Winamp's inner workings, it seems to me that, since Winamp obviously has already the ability of realtime sound monitoring (ie: the analyzer/scope/visualization functionality) there should be some way to have an add-on (plugin?) that could detect some defined length of time that no sound is coming out, and trigger the launching of my batch file upon said event.

If that would be harder than it sounds, maybe an external app (some script or exe realtime sound card monitor / silence detector running separately) would be easier?

For the curious, here is my entire goal: to 100% automate the restart of dumped live audio streaming. As it is right now, in about half the cases a live stream gets dumped, Winamp's "repeat" feature will turn around and reconnect the stream automatically. The rest of the time, however, the stream does not actually dump, it just dies but remains connected, in which case Winamp does nothing to reconnect, and I just get silence until I manually push "play" again. I wish to find a way to detect X seconds of silence so that in that event a batch file can be launched to send the hotkeys at Winamp to "play" thus restarting the stream with no user intervention.

Comments? Thoughts? Suggestions? Please!
seattlex19 is offline   Reply With Quote
Old 8th October 2004, 18:32   #2
seattlex19
Junior Member
 
Join Date: Oct 2004
Posts: 18
One more thing, this magical function would need to have the ability to launch my batch upon X seconds of silence detected, even in the event Winamp were literally stopped. Either hard coded to just make that batch launch after event is triggered regardless of Winamp current state, or as an option to do so regardless of state. I want this to be so foolproof that even if Winamp were to stop completely, the process would send the "play" command after X seconds of silence regardless. Ideas?
seattlex19 is offline   Reply With Quote
Old 8th October 2004, 18:49   #3
seattlex19
Junior Member
 
Join Date: Oct 2004
Posts: 18
Ah and if anyone wants to know, the system in question: Winamp v5.05, Windows 2000, Sound card: PCI SBLive CT4760.
seattlex19 is offline   Reply With Quote
Old 1st October 2005, 14:55   #4
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
It's not a crazy request, I'm looking for the same tool.
Anyone ideas or do you have a plugin like this?

Roland.
KissFM is offline   Reply With Quote
Old 4th October 2005, 12:40   #5
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
one way would be a dsp plugin. the only thing i got no idea of is how to detect silence/volume level. if somebody else can do this part i could possibly help with the rest.
dllmain is offline   Reply With Quote
Old 5th October 2005, 15:50   #6
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
I hope someone can make something like this. It is not a big thing. Only when the music is stopped and there is a silence of 5 of 10 seconds, the (DSP-)plugin must send a play-command to winamp... that's all...

I hope someone can make it...

Roland.
KissFM is offline   Reply With Quote
Old 5th October 2005, 17:00   #7
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
if it's just hitting play when stopped for 5 seconds i guess i can do this. i'll keep you up to date.
dllmain is offline   Reply With Quote
Old 5th October 2005, 17:06   #8
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
Ok dllmain, thanks for your help!

The only point is, is that winamp sometimes hang while loading a internetradio stream. Sometimes the buffer stands on 66% and load not to 100%. Winamp only plays with a 100% full buffer.

If winamp hangs with the stream, I give sometimes a new play-request, winamp connect the stream again and than it plays normally.

But, I'm not always at home and sometimes winamp doesn't load the stream correctly. And now I'm looking for a DPS-plugin ore something, that if there is no sound for 5 of 10 seconds, the plugin send automatically a play-command to winamp.

Or, maybe is there a options to make a DSP, that watch if winamp plays. If not, then mus the DPS send a play-request. This is maybe another option if the soundcard-detection not works...

I hope you can make something, many, many thanks!!!

Roland, Netherlands.
KissFM is offline   Reply With Quote
Old 5th October 2005, 17:28   #9
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
i could make it a dsp and see if ModifySamples() gets called. that should do what you need i guess. so let's see how fast i can get it done...
dllmain is offline   Reply With Quote
Old 5th October 2005, 17:32   #10
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
i could make it shareware and kill every second sample. just kidding.
dllmain is offline   Reply With Quote
Old 5th October 2005, 18:10   #11
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
so let's see if this is what you asked for: dsp_restless_111.zip

source code included.
dllmain is offline   Reply With Quote
Old 5th October 2005, 18:48   #12
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
WOW!!!!!!!!!!!!!!!!

Super DSP-plugin! This is what I mean!

It works great! If there is a silence, winamp gets a play-command!

I tested on my own shoutcast-server. I login with winamp, and then I disconnect the shoutcast-server. The buffering of Winamp stops and I saw that Winamp get's a play-command. The I turned on the shoutcast-server and yes, winamp logged in succesfully, and the music starts again!

Many, many thanks dllmain for making this plugin!
I'm very, very happy now! My radiostation can now run without any (long) silence!

Wow, hi, realy good!

Roland.
KissFM is offline   Reply With Quote
Old 5th October 2005, 19:06   #13
DrO
 
Join Date: Sep 2003
Posts: 27,873
damn, i've just been doing this as well though i've done it in a different way basing it on checking the samples and going from there (with some nice configurable actions) now do i release it or not..

-daz
DrO is offline   Reply With Quote
Old 5th October 2005, 19:13   #14
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
Give it a try! I don't know how dllmain it makes...

On the first place, I'm very happy with the plugin, but maybe is it a nice idea to make the plugin with some options or something?

The forum here is special for development of plugin's, so, if you can make it better, try it! Dllmain was the first who makes a silence-detector, but if you want to make another one, who says that's forbidden? Nobody...

Other question for Dllmain, how works this plugin you made? Is this a volume-level based plugin, or looks the plugin to winamp if it plays or not?

Roland.
KissFM is offline   Reply With Quote
Old 5th October 2005, 19:14   #15
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
Quote:
Originally posted by DrO
now do i release it or not..
mine is nothing but a timer. of course you do!
dllmain is offline   Reply With Quote
Old 5th October 2005, 19:18   #16
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
Quote:
Other question for Dllmain, how works this plugin you made? Is this a volume-level based plugin, or looks the plugin to winamp if it plays or not?
it checks if the last call of ModifySamples() is older than 5 seconds every 2 seconds.
dllmain is offline   Reply With Quote
Old 5th October 2005, 19:28   #17
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
It's a great plugin Sebastian, simple, but exactly what I mean!

Roland.
KissFM is offline   Reply With Quote
Old 5th October 2005, 19:36   #18
DrO
 
Join Date: Sep 2003
Posts: 27,873
Silence Detector v1.0

well i assume this works since it works fine on the files locally i could test which have silences but for all i know only dllmain's method may be suitable for this situation

-daz
DrO is offline   Reply With Quote
Old 5th October 2005, 19:56   #19
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
@dro
the options are nice. how does your plugin do the silence detection exactly? can we have the source?
dllmain is offline   Reply With Quote
Old 5th October 2005, 20:03   #20
DrO
 
Join Date: Sep 2003
Posts: 27,873
code:
int modify_samples1(struct winampDSPModule *this_mod,
short int *samples,
int numsamples, int bps, int nch, int srate){
int x = 0, s = numsamples*nch, beep = 0;

for(x = 0; x < s; x ++){if(!samples[x]){beep+=1;}}

if(beep >= s){
if(!timer){timer = SetTimer(this_mod->hwndParent,1997,
wait,restart);}
}
else{if(timer){
KillTimer(this_mod->hwndParent,timer);timer = 0;}
}

return numsamples;
}

edited to not break the frames and that's the core part of the plugin with it setting/removing the timer as required when null samples/valid samples are detected

-daz
DrO is offline   Reply With Quote
Old 5th October 2005, 21:57   #21
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
so you are detecting "digital silence". i thought you were analyzing the volume level.
dllmain is offline   Reply With Quote
Old 7th October 2005, 20:56   #22
crackity
Senior Member
 
Join Date: Jul 2004
Location: The East Side
Posts: 120
Send a message via ICQ to crackity Send a message via AIM to crackity
Quote:
Originally posted by DrO
code:
int modify_samples1(struct winampDSPModule *this_mod,
short int *samples,
int numsamples, int bps, int nch, int srate){
int x = 0, s = numsamples*nch, beep = 0;

for(x = 0; x < s; x ++){if(!samples[x]){beep+=1;}}

if(beep >= s){
if(!timer){timer = SetTimer(this_mod->hwndParent,1997,
wait,restart);}
}
else{if(timer){
KillTimer(this_mod->hwndParent,timer);timer = 0;}
}

return numsamples;
}

edited to not break the frames and that's the core part of the plugin with it setting/removing the timer as required when null samples/valid samples are detected

-daz
I like the idea of this pluggie.... man I cant count how many times I have thought my music stopped when it really is just playing 10 minutes of silence before the hidden track kind of thing. (depending on the options.... going to dl tonight, will have to request the option to skip to the next song, but I have a feelign you already thought of that :P)

err better question, is one plugin better then the other (lol I geuss i like starting conflict)

just out of curiousity, how often does this checking get done? Just curious about resources I guess (probably could stop that loop at the first non-zero bit too :P)

Crackity
QuickTracks: Info & Most Recent
crackity is offline   Reply With Quote
Old 7th October 2005, 21:02   #23
KissFM
Junior Member
 
Join Date: Oct 2005
Location: Tiel - Netherlands
Posts: 7
Maybe is it a idea to make that with some options?

How long must the detector wait before it send a play-request, or/and if you make it on the volume-level, maybe you can config how much dB means silence for the detector.

Some music-files have a silence for a copple of seconds...

Go go go, and make it! I still have one of dllmain, and it works very good. My internet-connection goes offline today and the plugin sends a play-request, again and again. Even so, after 5 minutes my internetlink is online and yes, winamp connects automatically, and the music goes on.

Veeeeeeeeeeeeeeeeeeery good!

Roland.
KissFM is offline   Reply With Quote
Old 23rd February 2006, 02:42   #24
ZenTaoist
Junior Member
 
Join Date: Feb 2006
Posts: 5
jumps to next playlist entry

Thanks guy's for working all this out. I have tried both the Silence_Detector_v1_0 & dsp_restless plugins. The Silence_Detector still hung @ 0% buffering so I tried the dsp_restless and it tends to jump to the next enty in the playlist and still has hangs @ 0% . Is there anyway to improve the performace or are there any other solutions out there?
ZenTaoist is offline   Reply With Quote
Old 23rd February 2006, 02:48   #25
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
well as far as i can remember dsp_restless only emulates hitting "play" not "next track". so i guess this means your playlist entry is just not playable. i know this behavior from trying to play moved mp3 files. does this help?
dllmain is offline   Reply With Quote
Old 23rd February 2006, 03:23   #26
ZenTaoist
Junior Member
 
Join Date: Feb 2006
Posts: 5
thanks for the quick response...
even with just one playlist entry I still get the buffering with both plugins and I have tried diifernt entries. This is a new phenomonon in the last couple of weeks. I startrd a new thread here ( http://forums.winamp.com/showthread....hreadid=238803 ) on this with more detail of what I am experiencing. Thanks for the input dllmain, I'll keep looking for a solution...
ZenTaoist is offline   Reply With Quote
Old 18th March 2006, 20:08   #27
skyraven
Junior Member
 
Join Date: Mar 2006
Posts: 4
Is it possible for the plugin to not be dsp based ?

I have on the same computer winamp that gets an internet stream from a radio station and then re-encodes it and broadcasts it to the shoutcast server running in the background.

This is why I can't use both DSP plugins (the shoutcast one and the silence detection).
skyraven is offline   Reply With Quote
Old 18th March 2006, 20:12   #28
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
Quote:
Originally posted by skyraven This is why I can't use both DSP plugins (the shoutcast one and the silence detection). [/B]
A DSP stacker plugin should help here. There are several plugins allowing to use more than one DSP plugin at the same time.
dllmain is offline   Reply With Quote
Old 18th March 2006, 20:48   #29
skyraven
Junior Member
 
Join Date: Mar 2006
Posts: 4
Thanks for the answer.

Sorry if this has been asked before.
skyraven is offline   Reply With Quote
Old 18th March 2006, 21:00   #30
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
Quote:
Originally posted by skyraven
Thanks for the answer.

Sorry if this has been asked before.
You're welcome. I'm glad I could help.
dllmain is offline   Reply With Quote
Old 8th August 2007, 00:46   #31
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
New version:
  • Added: Delay config via Winamp.ini
  • Added: NSIS installer
>> dsp_restless_1_1_2_setup.exe
>> dsp_restless_1_1_2_source.zip
&#160;
dllmain is offline   Reply With Quote
Old 30th October 2007, 17:12   #32
dllmain
Senior Member
 
dllmain's Avatar
 
Join Date: Sep 2005
Location: Berlin, Germany
Posts: 207
New version:
  • Added: Delay config now possible in “<minutes>:<seconds>” as well
  • Added: Pause interval (in which play is not hit)
>> dsp_restless_1_2_0_setup.exe
>> dsp_restless_1_2_0_source.zip
&#160;
dllmain is offline   Reply With Quote
Old 31st October 2007, 17:41   #33
kyle.quamme
Junior Member
 
Join Date: Oct 2007
Posts: 1
make plugin execute batch script

would it be possible to make the plugin execute a batch script?

I would like to make the plugin e-mail me every time there was silence of 30 seconds or more. I would use it to monitor my school's internet radio stream, since I am the one that has to make sure it stays up 24/7 and want to avoid buying hardware.
kyle.quamme is offline   Reply With Quote
Old 27th January 2008, 22:39   #34
Flyte
Junior Member
 
Join Date: Jan 2007
Posts: 1
Hi, I'm looking for something similar to this as well.

I'm after something I can run on my stream server which will listen to the shoutcast stream, then if it detects X seconds of silence, it will trigger an event - or run a bash script etc. In my case, I want to run a script to ban the IP of the source, and kick it off the server.

I've been looking at the Java Sound API, thinking of writing something my self, but I don't know Java very well (yet!), and I can't see how I'd use it.

Can anyone help please?
Flyte is offline   Reply With Quote
Old 6th May 2019, 10:04   #35
soundzmad
Junior Member
 
Join Date: May 2019
Posts: 1
Restless not working reliably

Good day everybody.

So i looked for a solution to keep a shoutcast stream going that i feed into an FM exciter/Transmitter. I use Stereo Tool as a plugin for processing audio.

The restless plugin does not seem to work reliably in my case. My ISP reset there network every morning at 3AM. among other interruptions it did manage to keep y feed alive for about 3 days without me hitting the play button again. But mosty it's as if its not there at all.

Is there any suggestions?
soundzmad is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump