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 (
Date: Wed Aug 21 2002 - 11:29:46 EEST

On 20 Aug 2002, Nathan Stewart wrote:

> I'm a bit puzzled here. The gate code is indeed very simple. But what I
> don't get is how samples move from input to output in the gate. I see

Good question. Unlike LADSPA, ecasound chainops always process data
inplace. In other words the process() callback should directly edit sample
data of the given SAMPLE_BUFFER object (this is assigned in the init()
member function).

> GATE_BASE::process(void)
> {
> analyze(target);
> if (is_open() == false) {
> target->length_in_samples(0);
> }
> }

So the gate will first analyze the sample data, and if and only if the
gate is closed process() will truncate the processed buffer (target).
If you want to do more complicated processing, just derive from GATE_BASE
and override the above process() implementation. Otherwise you just need
to reimplement analyze().

> So then how does data actually flow through a chain operator? I don't
> see it. I had the gate "working" as well as it could under ladspa - and
> I see that I need to override output_samples(). (Should GATE_BASE be
> doing that - or does it get taken care of through setting
> length_in_samples() to zero?)

Another good question. output_samples() was originally intended for
chainops (like pitchshifter) that change the buffer size by a constant
factor. The engine could use this to analyze the chainop network and
preallocate enough memory to avoid any allocs during realtime operation.

Gates also change the buffer size, but this depends on the analyzed
audio data. Hmm, I guess I should rename output_samples() to
max_output_samples(). In any case gate ops can ignore this method for now.

PS Here's a clip from audiofx_amplitude.cpp that shows how
   process() and init() are used in chainops:

void EFFECT_AMPLIFY::init(SAMPLE_BUFFER* sbuf) { i.init(sbuf); }

void EFFECT_AMPLIFY::process(void) {
  while(!i.end()) {
    *i.current() = *i.current() * kerroin;;

PPS 'i' is an iterator object, while 'kerroin' is
    'multiplier' in Finnish... ;)

 Audio software for Linux!

-- To unsubscribe send message 'unsubscribe' in the body of the message to <>.

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

This archive was generated by hypermail 2b28 : Wed Aug 21 2002 - 11:38:00 EEST