« Return to Thread: Re: [sc-dev] [commit?] Output for DetectSilence

Re: ?spam? Re: [Sc-devel] [commit?] Output for DetectSilence

by Dan Stowell :: Rate this Message:

Reply to Author | View in Thread

No objections here...
Dan

2008/6/27 nescivi <nescivi@...>:

> Hiho,
>
> seeing that I still did not commit this.
> the diff for this change is below (for the source of the plugin; I seem to
> have already committed the class file).
>
> If this looks good, I'll commit this.
>
> sincerely,
> Marije
>
> Index: FilterUGens.cpp
> ===================================================================
> --- FilterUGens.cpp     (revision 7638)
> +++ FilterUGens.cpp     (working copy)
> @@ -4254,6 +4254,7 @@
>  {
>        float thresh = unit->mThresh;
>        int counter = unit->mCounter;
> +       float val;
>
>        // I thought of a better way to do this...
>        /*
> @@ -4271,20 +4272,25 @@
>        }
>        */
>        float *in = IN(0);
> +       float *out = OUT(0);
>        for (int i=0; i<inNumSamples; ++i) {
>                float val = fabs(*in++);
>                if (val > thresh) {
>                        counter = 0;
> -                       break;
> +                       *out++ = 0.f;
>                } else if (counter >= 0) {
>                        if (++counter >= unit->mEndCounter) {
>                                int doneAction = (int)ZIN0(3);
>                                DoneAction(doneAction, unit);
> -                               SETCALC(DetectSilence_done);
> +                               *out++ = 1.f;
> +//                             SETCALC(DetectSilence_done);
> +                       } else {
> +                               *out++ = 0.f;
>                        }
>                }
>        }
>        unit->mCounter = counter;
> +
>  }
>
>  void DetectSilence_done(DetectSilence* unit, int inNumSamples)
>
> -----------------
>
> On Thursday 08 May 2008 06:37:56 nescivi wrote:
>> Hi Dan,
>>
>> On Thursday 08 May 2008 06:10:21 Dan Stowell wrote:
>> > PS forwarding this to sc-devel since the original was to sc-dev !
>>
>> ah, picked the wrong message to get the address from ;)
>> confusing as the commit message still arrive to the old list.
>>
>> > 2008/5/8 Dan Stowell <danstowell@...>:
>> > > Yes, looks like it should extend functionality without changing the
>> > >  original function. Two queries:
>> > >
>> > >  * In your diff you do not write any output value when (val<thresh) yet
>> > >  (counter < unit->mEndCounter), i.e. during a silence that isn't long
>> > >  enough yet. You should probably add an "else *out++ = 0.f;"
>>
>> ok. makes sense.
>>
>> > >  * Should that "break" statement be removed?
>>
>> yes, I think it should.
>>
>> thanks for the critical look at this!
>>
>> sincerely,
>> Marije
>>
>> > >  Dan
>> > >
>> > >  2008/5/8 nescivi <nescivi@...>:
>> > > > Hiho,
>> > > >
>> > >  >  It would be useful to have an output to DetectSilence, so you can
>> > >  > also use it as a trigger for some other UGen.
>> > >  >
>> > >  >  It is quite straightforward and I have a test version running.
>> > >  >
>> > >  >  ok to commit?
>> > >  >
>> > >  >  sincerely,
>> > >  >  Marije
>> > >  >
>> > >  >
>> > >  >  Diff for plugin source (class file is appropriately changed too):
>> > >  >
>> > >  >  Index: Source/plugins/FilterUGens.cpp
>> > >  >  ===================================================================
>> > >  >  --- Source/plugins/FilterUGens.cpp      (revision 7531)
>> > >  >  +++ Source/plugins/FilterUGens.cpp      (working copy)
>> > >  >  @@ -4254,6 +4254,7 @@
>> > >  >   {
>> > >  >         float thresh = unit->mThresh;
>> > >  >         int counter = unit->mCounter;
>> > >  >  +       float val;
>> > >  >
>> > >  >         // I thought of a better way to do this...
>> > >  >         /*
>> > >  >  @@ -4271,20 +4272,24 @@
>> > >  >         }
>> > >  >         */
>> > >  >         float *in = IN(0);
>> > >  >  +       float *out = OUT(0);
>> > >  >         for (int i=0; i<inNumSamples; ++i) {
>> > >  >                 float val = fabs(*in++);
>> > >  >                 if (val > thresh) {
>> > >  >                         counter = 0;
>> > >  >  +                       *out++ = 0.f;
>> > >  >                         break;
>> > >  >                 } else if (counter >= 0) {
>> > >  >                         if (++counter >= unit->mEndCounter) {
>> > >  >                                 int doneAction = (int)ZIN0(3);
>> > >  >                                 DoneAction(doneAction, unit);
>> > >  >  -                               SETCALC(DetectSilence_done);
>> > >  >  +                               *out++ = 1.f;
>> > >  >  +//                             SETCALC(DetectSilence_done);
>> > >  >                         }
>> > >  >                 }
>> > >  >         }
>> > >  >         unit->mCounter = counter;
>> > >  >  +
>> > >  >   }
>>
>> _______________________________________________
>> Sc-devel mailing list
>> Sc-devel@...
>> http://lists.create.ucsb.edu/mailman/listinfo/sc-devel
>
>
>
> _______________________________________________
> sc-dev mailing list
>
>
> info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
> archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
> search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/
>



--
http://www.mcld.co.uk

_______________________________________________
sc-dev mailing list


info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/

 « Return to Thread: Re: [sc-dev] [commit?] Output for DetectSilence

LightInTheBox - Buy quality products at wholesale price