Csound Csound-dev Csound-tekno Search About

Re: Optimizing tips?

Date1999-02-09 19:02
Fromrasmus ekman
SubjectRe: Optimizing tips?
Anders Andersson wrote:
> 
> I wonder if anyone can give me some tips about how to optimize instruments!

Use lower k-rate. 
If you need higher resolution for better sound quality, *still* 
try to use lower k-rate and upsample to a-rate with interp.

I know there are people on the list who will jump to any opportunity 
of setting kr=sr, and if that's what someone needs to be happy, he
could consider fiddling with k-variable optimisation - else the time 
will be better spent just rendering the thing.

> Take this very simple example:
/.../
> Would it be faster to insert a k-rate variable 

There is very little that you can do at k-rate which makes a big 
difference in performance. The time-consuming work for Csound is 
(i) inside maths-intensive a-rate opcodes (filters, FFT-based), and 
(ii) the k-rate instrument/variable/everything management. 
There is often not much you can do about the a-rate stuff, since 
the signal after all has to be generated somewhere, but you can do 
something about (ii). Eg set kr=50 through 200, which should be 
plenty for most cases.

cheers,