Re: [ecasound] gate (-gc) retriggering?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [ecasound] gate (-gc) retriggering?
From: Kai Vehmanen (k_AT_eca.cx)
Date: Tue Aug 27 2002 - 02:33:13 EEST


On 26 Aug 2002, Nathan Stewart wrote:

> Apologies on being so dense. I was throughly confused about the function
> of the GATE_BASE::process call truncating the buffer.

On the contrary, it's great to have feedback about the codebase! :) Making
sure that the code is understandable is a very important goal. If the
code logic is easy to grasp, that means it's easy to maintain and that
again results in fewer bugs, less stressed developers and makes it
easier to attract new people to look at the code.

> I saw that the logic of the THRESHOLD_GATE didn't allow it to reopen,
> but I thought that the target_length_in_samples(0) call in ::process was
> chopping the whole stream, not just the buffer we're currently working

Ok, I can imagine that this can cause confusion. But yes, the buffer
lengths are always reset when they are filled from input objects. So on
each round, the chainops will see a new full-length sample buffer object.

> I gave up trying to chop out smaller windows and just throw away whole
> buffers, the way the existing gate code currently works, and voila. My
> NULL_RETRIGGER_GATE works. It really could just be a parameter to
> THRESHOLD_GATE, though my analyze function is much much simpler (I'm
> presupposing that you're already processing with an FX type noise gate,
> so I just clamp if average_amplitude <= 0;)

Hmm, true, adding for instance a 'reopen' parameter to the noise gate is
one option. If we set the default to disabled, this wouldn't break old
effect presets using noise gate. Would the following code be ok:

--cut--
void THRESHOLD_GATE::analyze(SAMPLE_BUFFER* sbuf)
{
  if (rms == true)
    avolume = SAMPLE_BUFFER_FUNCTIONS::RMS_volume(*sbuf) /
              SAMPLE_SPECS::max_amplitude;
  else
    avolume = SAMPLE_BUFFER_FUNCTIONS::average_amplitude(*sbuf) /
              SAMPLE_SPECS::max_amplitude;

  if (is_opened != true) {
    /* gate not open */
    if (is_closed != true || reopen_mode == true) {
      /* if 'reopen_mode' is not enabled, gate won't
       * reopened after it is closed once */

      if (avolume > openlevel) {
        open_gate();
        ECA_LOG_MSG(ECA_LOGGER::user_objects, "(audiogate) Threshold gate opened.");
        is_opened = true;
      }
    }
  }
  else {
    /* gate open */
    if (avolume < closelevel) {
      close_gate();
      ECA_LOG_MSG(ECA_LOGGER::user_objects, "(audiogate) Threshold gate closed.");
      is_closed = true;
      is_opened = false;
    }
  }
}
--cut--

-- 
 http://www.eca.cx
 Audio software for Linux!

-- To unsubscribe send message 'unsubscribe' in the body of the message to <ecasound-list-request_AT_wakkanet.fi>.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Aug 27 2002 - 02:20:18 EEST