Csound Csound-dev Csound-tekno Search About

Re: A-rate vs K-rate

Date2004-05-26 10:02
FromGabriel Maldonado
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. 
Amplitude should always be converted to a-rate in the latest pass, 
otherwise audible clicks would be unavoidable in fast transitions.
I suggest ksmps=100 for realtime, unless there is a huge amount of 
k-rate ugens (in which case kr=441 is suggested).

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

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


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: