Quantcast

about DetectSilence time parameter

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

about DetectSilence time parameter

altern2
hi

Shouldn't DetectSilence skip the silences between pulses when they are
close enough if the "time" parameter is long enough?

I am posting ++++ when signal is detected and . when is silence. I would
expect that given a long enough "time" value if the pulses are quite
frequent it should not detect any silence at all. But I have tried all
kinds of values and this never happens. This is the code I am using

OSCdef(\silenceOSCdef).clear;
OSCdef(\silenceOSCdef).free;


SynthDef(\sildetect, {| amp=0.45, time=0.15, checkrate=20, freq=3.5|
        var detected, signal;
        signal = Impulse.ar(freq);

        detected = DetectSilence.ar( signal, amp, time );
        SendReply.kr(Impulse.kr(checkrate), '/sil', detected); // report

        Out.ar(0, signal);
}).add;


d = Synth(\sildetect);


OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
        if (msg[3]==0,
                {"++++++++++++++".postln}, // signal
                {".".postln} // silence
        );
}, 'sil', s.addr);


thanks

enrike

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

Dan Zink
You should increase your time parameter. The reciprocal of your frequency of 3.5 is about 0.3, so if your time parameter is 0.15, about half the time you'll detect silence.

On May 13, 2017 11:42, <[hidden email]> wrote:
hi

Shouldn't DetectSilence skip the silences between pulses when they are close enough if the "time" parameter is long enough?

I am posting ++++ when signal is detected and . when is silence. I would expect that given a long enough "time" value if the pulses are quite frequent it should not detect any silence at all. But I have tried all kinds of values and this never happens. This is the code I am using

OSCdef(\silenceOSCdef).clear;
OSCdef(\silenceOSCdef).free;


SynthDef(\sildetect, {| amp=0.45, time=0.15, checkrate=20, freq=3.5|
        var detected, signal;
        signal = Impulse.ar(freq);

        detected = DetectSilence.ar( signal, amp, time );
        SendReply.kr(Impulse.kr(checkrate), '/sil', detected); // report

        Out.ar(0, signal);
}).add;


d = Synth(\sildetect);


OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
        if (msg[3]==0,
                {"++++++++++++++".postln}, // signal
                {".".postln} // silence
        );
}, 'sil', s.addr);


thanks

enrike

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

altern2
ahhhh.... I see, it looks like the parameter cannot be set realtime. I
was trying all the time to set it with d.set(\time, 0.5). So I must kill
the synth and create it again with the new value...

lr., 2017.eko mairen 13a 17:55(e)an, [hidden email] igorleak
idatzi zuen:

> You should increase your time parameter. The reciprocal of your
> frequency of 3.5 is about 0.3, so if your time parameter is 0.15, about
> half the time you'll detect silence.
>
> On May 13, 2017 11:42, <[hidden email] <mailto:[hidden email]>> wrote:
>
>     hi
>
>     Shouldn't DetectSilence skip the silences between pulses when they
>     are close enough if the "time" parameter is long enough?
>
>     I am posting ++++ when signal is detected and . when is silence. I
>     would expect that given a long enough "time" value if the pulses are
>     quite frequent it should not detect any silence at all. But I have
>     tried all kinds of values and this never happens. This is the code I
>     am using
>
>     OSCdef(\silenceOSCdef).clear;
>     OSCdef(\silenceOSCdef).free;
>
>
>     SynthDef(\sildetect, {| amp=0.45, time=0.15, checkrate=20, freq=3.5|
>             var detected, signal;
>             signal = Impulse.ar(freq);
>
>             detected = DetectSilence.ar( signal, amp, time );
>             SendReply.kr(Impulse.kr(checkrate), '/sil', detected); // report
>
>             Out.ar(0, signal);
>     }).add;
>
>
>     d = Synth(\sildetect);
>
>
>     OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
>             if (msg[3]==0,
>                     {"++++++++++++++".postln}, // signal
>                     {".".postln} // silence
>             );
>     }, 'sil', s.addr);
>
>
>     thanks
>
>     enrike
>
>     _______________________________________________
>     sc-users mailing list
>
>     info (subscription, etc.):
>     http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
>     <http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx>
>     archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
>     <http://www.listarc.bham.ac.uk/marchives/sc-users/>
>     search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
>     <http://www.listarc.bham.ac.uk/lists/sc-users/search/>
>
>


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

altern2
In reply to this post by Dan Zink
  btw. I think it would be a very good idea to state in the
documentation that this class does not allow for the parameters to be
updated once the class is instantiated.

I realised that most of the weirdness I was experiencing in a project I
worked in last year was coming from this issue

enrike

lr., 2017.eko mairen 13a 17:55(e)an, [hidden email] igorleak
idatzi zuen:

> You should increase your time parameter. The reciprocal of your
> frequency of 3.5 is about 0.3, so if your time parameter is 0.15, about
> half the time you'll detect silence.
>
> On May 13, 2017 11:42, <[hidden email] <mailto:[hidden email]>> wrote:
>
>     hi
>
>     Shouldn't DetectSilence skip the silences between pulses when they
>     are close enough if the "time" parameter is long enough?
>
>     I am posting ++++ when signal is detected and . when is silence. I
>     would expect that given a long enough "time" value if the pulses are
>     quite frequent it should not detect any silence at all. But I have
>     tried all kinds of values and this never happens. This is the code I
>     am using
>
>     OSCdef(\silenceOSCdef).clear;
>     OSCdef(\silenceOSCdef).free;
>
>
>     SynthDef(\sildetect, {| amp=0.45, time=0.15, checkrate=20, freq=3.5|
>             var detected, signal;
>             signal = Impulse.ar(freq);
>
>             detected = DetectSilence.ar( signal, amp, time );
>             SendReply.kr(Impulse.kr(checkrate), '/sil', detected); // report
>
>             Out.ar(0, signal);
>     }).add;
>
>
>     d = Synth(\sildetect);
>
>
>     OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
>             if (msg[3]==0,
>                     {"++++++++++++++".postln}, // signal
>                     {".".postln} // silence
>             );
>     }, 'sil', s.addr);
>
>
>     thanks
>
>     enrike
>
>     _______________________________________________
>     sc-users mailing list
>
>     info (subscription, etc.):
>     http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
>     <http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx>
>     archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
>     <http://www.listarc.bham.ac.uk/marchives/sc-users/>
>     search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
>     <http://www.listarc.bham.ac.uk/lists/sc-users/search/>
>
>


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

Fredrik Olofsson
no, you're wrong.  DetectSilence's time parameter can be modulated.

but polling DetectSilence like in your example is a bit fragile and means that you risk missing events.  certain combinations of checkrate, signal frequency and that time parameter will not work.

i believe it is much more robust to use DetectSilence itself as a trigger and let it report back when its state changed.  so without polling...

OSCdef(\silenceOSCdef).clear;
OSCdef(\silenceOSCdef).free;

SynthDef(\sildetect, {| amp=0.45, time=0.15, freq=3.5|
        var detected, signal;
        signal = Impulse.ar(freq);
        detected = DetectSilence.ar( signal, amp, time );
        SendReply.ar(Changed.ar(detected), '/sil', detected); // report
        Out.ar(0, signal);
}).add;

d = Synth(\sildetect);

OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
        if (msg[3]==0,
                {"++++++++++++++".postln}, // signal
                {".".postln} // silence
        );
}, 'sil', s.addr);

so now it's only a question of time vs input signal frequency.

d.set(\time, 0.01);
d.set(\time, 1/3.5*0.99);  //still detected
d.set(\time, 1/3.5*1.1);  //time too long to detect - need to lower input signal frequency

_f

> 15 maj 2017 kl. 10:24 skrev [hidden email]:
>
> btw. I think it would be a very good idea to state in the documentation that this class does not allow for the parameters to be updated once the class is instantiated.
>
> I realised that most of the weirdness I was experiencing in a project I worked in last year was coming from this issue
>
> enrike
>
> lr., 2017.eko mairen 13a 17:55(e)an, [hidden email] igorleak idatzi zuen:
>> You should increase your time parameter. The reciprocal of your
>> frequency of 3.5 is about 0.3, so if your time parameter is 0.15, about
>> half the time you'll detect silence.
>>
>> On May 13, 2017 11:42, <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>    hi
>>
>>    Shouldn't DetectSilence skip the silences between pulses when they
>>    are close enough if the "time" parameter is long enough?
>>
>>    I am posting ++++ when signal is detected and . when is silence. I
>>    would expect that given a long enough "time" value if the pulses are
>>    quite frequent it should not detect any silence at all. But I have
>>    tried all kinds of values and this never happens. This is the code I
>>    am using
>>
>>    OSCdef(\silenceOSCdef).clear;
>>    OSCdef(\silenceOSCdef).free;
>>
>>
>>    SynthDef(\sildetect, {| amp=0.45, time=0.15, checkrate=20, freq=3.5|
>>            var detected, signal;
>>            signal = Impulse.ar(freq);
>>
>>            detected = DetectSilence.ar( signal, amp, time );
>>            SendReply.kr(Impulse.kr(checkrate), '/sil', detected); // report
>>
>>            Out.ar(0, signal);
>>    }).add;
>>
>>
>>    d = Synth(\sildetect);
>>
>>
>>    OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
>>            if (msg[3]==0,
>>                    {"++++++++++++++".postln}, // signal
>>                    {".".postln} // silence
>>            );
>>    }, 'sil', s.addr);
>>
>>
>>    thanks
>>
>>    enrike

  #|
     fredrikolofsson.com     musicalfieldsforever.com
  |#


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

altern2
but couple of years ago I faced a similar problem with another parameter
in this class and the answer was

"you can't modulate DetectSilence's parameters. In the source code,
unit->mThresh is set in the constructor, but never updated in the _next
function. "

http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/DetectSilence-amplitude-argument-td7615498.html#a7615509

I had totally forgotten about it (stupid of me not to write a good
comment in the code next to the workaround I wrote) then last saturday
when I read the first replay to my question I suddenly remember about it.

I havent had time to implement properly your code suggestion but a quick
test I did on monday didnt seem to work. but it was a quick test. I will
try better when I have time.

thanks!

enrike


al., 2017.eko mairen 15a 12:59(e)an, [hidden email] igorleak
idatzi zuen:

> no, you're wrong.  DetectSilence's time parameter can be modulated.
>
> but polling DetectSilence like in your example is a bit fragile and means that you risk missing events.  certain combinations of checkrate, signal frequency and that time parameter will not work.
>
> i believe it is much more robust to use DetectSilence itself as a trigger and let it report back when its state changed.  so without polling...
>
> OSCdef(\silenceOSCdef).clear;
> OSCdef(\silenceOSCdef).free;
>
> SynthDef(\sildetect, {| amp=0.45, time=0.15, freq=3.5|
> var detected, signal;
> signal = Impulse.ar(freq);
> detected = DetectSilence.ar( signal, amp, time );
> SendReply.ar(Changed.ar(detected), '/sil', detected); // report
> Out.ar(0, signal);
> }).add;
>
> d = Synth(\sildetect);
>
> OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
> if (msg[3]==0,
> {"++++++++++++++".postln}, // signal
> {".".postln} // silence
> );
> }, 'sil', s.addr);
>
> so now it's only a question of time vs input signal frequency.
>
> d.set(\time, 0.01);
> d.set(\time, 1/3.5*0.99);  //still detected
> d.set(\time, 1/3.5*1.1);  //time too long to detect - need to lower input signal frequency
>
> _f
>
>> 15 maj 2017 kl. 10:24 skrev [hidden email]:
>>
>> btw. I think it would be a very good idea to state in the documentation that this class does not allow for the parameters to be updated once the class is instantiated.
>>
>> I realised that most of the weirdness I was experiencing in a project I worked in last year was coming from this issue
>>
>> enrike
>>
>> lr., 2017.eko mairen 13a 17:55(e)an, [hidden email] igorleak idatzi zuen:
>>> You should increase your time parameter. The reciprocal of your
>>> frequency of 3.5 is about 0.3, so if your time parameter is 0.15, about
>>> half the time you'll detect silence.
>>>
>>> On May 13, 2017 11:42, <[hidden email] <mailto:[hidden email]>> wrote:
>>>
>>>    hi
>>>
>>>    Shouldn't DetectSilence skip the silences between pulses when they
>>>    are close enough if the "time" parameter is long enough?
>>>
>>>    I am posting ++++ when signal is detected and . when is silence. I
>>>    would expect that given a long enough "time" value if the pulses are
>>>    quite frequent it should not detect any silence at all. But I have
>>>    tried all kinds of values and this never happens. This is the code I
>>>    am using
>>>
>>>    OSCdef(\silenceOSCdef).clear;
>>>    OSCdef(\silenceOSCdef).free;
>>>
>>>
>>>    SynthDef(\sildetect, {| amp=0.45, time=0.15, checkrate=20, freq=3.5|
>>>            var detected, signal;
>>>            signal = Impulse.ar(freq);
>>>
>>>            detected = DetectSilence.ar( signal, amp, time );
>>>            SendReply.kr(Impulse.kr(checkrate), '/sil', detected); // report
>>>
>>>            Out.ar(0, signal);
>>>    }).add;
>>>
>>>
>>>    d = Synth(\sildetect);
>>>
>>>
>>>    OSCdef(\silenceOSCdef, {|msg, time, addr, recvPort|
>>>            if (msg[3]==0,
>>>                    {"++++++++++++++".postln}, // signal
>>>                    {".".postln} // silence
>>>            );
>>>    }, 'sil', s.addr);
>>>
>>>
>>>    thanks
>>>
>>>    enrike
>
>   #|
>      fredrikolofsson.com     musicalfieldsforever.com
>   |#
>
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
>


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

Russell J
altern2 wrote
"you can't modulate DetectSilence's parameters. In the source code, unit->mThresh is set in the constructor, but never updated in the _next function. "
This is no longer true as of version 3.7; it looks like the change was a response to your mailing list post (it was added to the source code a few days later).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

altern2

>> "you can't modulate DetectSilence's parameters. In the source code,
>> unit->mThresh is set in the constructor, but never updated in the _next
>> function. "
>
> This is no longer true as of version 3.7; it looks like the change was a
> response to your mailing list post (it was added to the source code a few
> days later).

ah! great, I am still running 3.6.6... time to upgrade I guess.

thanks


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

lfsaw
> On 18. May 2017, at 22:46, [hidden email] wrote:
>
>
>>> "you can't modulate DetectSilence's parameters. In the source code,
>>> unit->mThresh is set in the constructor, but never updated in the _next
>>> function. "
>>
>> This is no longer true as of version 3.7; it looks like the change was a
>> response to your mailing list post (it was added to the source code a few
>> days later).
>
> ah! great, I am still running 3.6.6... time to upgrade I guess.
>

(
and which provides yet another reason to always include at least the SC version (if not the OS) you are running into a "this is not working" email :)
)


:)
        Till


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: about DetectSilence time parameter

altern2

>>>> "you can't modulate DetectSilence's parameters. In the source code,
>>>> unit->mThresh is set in the constructor, but never updated in the _next
>>>> function. "
>>>
>>> This is no longer true as of version 3.7; it looks like the change was a
>>> response to your mailing list post (it was added to the source code a few
>>> days later).
>>
>> ah! great, I am still running 3.6.6... time to upgrade I guess.
>>
>
> (
> and which provides yet another reason to always include at least the SC version (if not the OS) you are running into a "this is not working" email :)
> )

I know I know...


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Loading...