Csound Csound-dev Csound-tekno Search About

Re: A-rate vs K-rate

Date2004-05-26 21:03
From"iain duncan"
SubjectRe: A-rate vs K-rate
> Use the a() function to convert a k-rate signal to an a-rate signal
> before passing it to the amplitude control of an audio generator.

Hey Gab, how are the results in audio quality and in cpu cycles different
between interp and a()?

> Amplitude should always be converted to a-rate in the latest pass,
> otherwise audible clicks would be unavoidable in fast transitions.

Sometimes one doesn't hear clicks but will hear high pitched sort of
metallic sounds on the attack. These are also the result of too low a
resolution on an amplitude envelope.

> However remember that the audio output will be always delayed at least
> of of ksmps samples when controlling Csound in realtime via midi.

Thanks, I didn't know that. That's pretty important for situations where
audio in is being used.

> For controlling frequency, this is not needed, in most cases.

Yeah, I agree. The only time I've found it noticeable on frequency is in
situations where a filter envelope is being used with a really fast attack
and decay and a LOT of extra cut off added through the envelope with the
resonance cranked. In that case even though the envelope is supposed to be
controlling filter cutoff in frequency, it winds up contributing greatly to
amplitude as well. So for percussive filter things ( ie making drum sounds
the old fashioned way ; ) too low a krate on filter frequency will be
noticeable.

Hope that helps,
Iain



>
> Stanislav Shevchenko wrote:
> > Hello everybody,
> >
> > I'm experimenting with CSound in real-time, trying to achieve optimal
performance for my instruments. And I can not decide what's the best setting
for the control rate (kr).
> >
> > Low values of kr (about 1/20 of sr) seem to be unacceptable; I can
easily hear the clicks even when amplitude envelope is calculated at k-rate,
and if k-rate is used to control the delay time in chorus/flanger, the
clicks are even more audible.
> >
> > But when kr approaches sr, using the a-rate variables becomes
inefficient, because the k-rate opcodes tend to be simpler (k-rate variables
are simple numbers, while a-rate variables are arrays, so there is a little
overhead in every a-rate opcode). So when sr is equal to kr, the a-rate
opcodes produce exactly the same output as k-rate, but a bit slower.
> >
> > I come to a paradoxical decision: the fastest way is to set kr = sr, use
k-rate opcodes as much as possible, and convert the results to a-rate only
when it is inevitable (to use the "outs" opcode, for example).
> >
> > Of course, there is an obvious alternative: set kr to be very low, and
use a-rate opcodes for the parameters which are usually controlled at k-rate
(amplitude, etc). However, there are opcodes that work ONLY at k-rate (like
"peak"), so there might be some cases when clicks are inevitable.
> >
> > So I'd like to know the opinion of community: what control rate is
thought to be the best for real-time, and for what reasons.
> >
> > Thanks in advance,
> > - Stanislav Shevchenko -
> > _______________________________________________
> > csoundtekno mailing list
> > csoundtekno-N4abDuUB7xo@public.gmane.org
> >
> > Subscribe, unsubscribe, change mailing list options:
> > http://plot.bek.no/mailman/listinfo/csoundtekno
> >
>
>
> --
> Gabriel Maldonado
> http://csounds.com/maldonado
> --
>
> _______________________________________________
> csoundtekno mailing list
> csoundtekno-N4abDuUB7xo@public.gmane.org
>
> Subscribe, unsubscribe, change mailing list options:
> http://plot.bek.no/mailman/listinfo/csoundtekno

_______________________________________________
csoundtekno mailing list
csoundtekno-N4abDuUB7xo@public.gmane.org

Subscribe, unsubscribe, change mailing list options: