Subject: Re: [ecasound] gate (-gc) retriggering?
From: Nathan Stewart (nps_AT_mebtel.net)
Date: Tue Aug 27 2002 - 05:01:23 EEST
On Mon, 2002-08-26 at 19:33, Kai Vehmanen wrote:
> 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:
>
> void THRESHOLD_GATE::analyze(SAMPLE_BUFFER* sbuf)
...
Yes, that would work. If it's generally useful is something you're
probably more qualified to say. I found the behavior of the -enm signal
processing noise gate useful - because I'm looking for pulse noise - I
can set it to threshold,200,0,0,0 and I get a 200ms pulse of data that
corresponds nicely to what I'm trying working on. I don't think the -g*
gates need to get that complicated though.
Now that I think about it - the effect amplitude gates are signal
processing gates, and perhaps it's useful to think of the -g* gates as
DATA processing gates. Perhaps it's too arbitrary of a line, but the
signal processing gates do work on real time data, and it can't
dissapear - it's only modified in place. The truncating gates throw away
data, which is something that your old Drawmer can't do. They can cause
problems with some consumers (ogg vorbis barfed when I fed it the output
of my null_retrigger_gate in real time). I ended up making my gate key
on max_value(), as average_amplitude() didn't like my 10ms pulse source
too well.
void NULL_RETRIGGER_GATE::analyze(SAMPLE_BUFFER* sbuf)
{
avolume = SAMPLE_BUFFER_FUNCTIONS::max_value(*sbuf);
if (avolume > 0) {
open_gate();
ECA_LOG_MSG(ECA_LOGGER::user_objects,
"(audiogate) Threshold gate opened.");
}
else {
close_gate();
ECA_LOG_MSG(ECA_LOGGER::user_objects,
"(audiogate) Threshold gate closed.");
}
}
and to make it work I added:
static sample_t max_value(const SAMPLE_BUFFER& buf) {
sample_t t = SAMPLE_SPECS::impl_min_value;
for(int channel = 0; channel < buf.channel_count_rep; channel++) {
for(SAMPLE_BUFFER::buf_size_t m = 0; m < buf.buffersize_rep; m++) {
if (buf.buffer[channel][m] > t) t = buf.buffer[channel][m];
}
}
return(t);
}
-- To unsubscribe send message 'unsubscribe' in the body of the message to <ecasound-list-request_AT_wakkanet.fi>.
This archive was generated by hypermail 2b28 : Tue Aug 27 2002 - 04:46:54 EEST