[Csnd] delay dependent on ksmps?
Date | 2014-02-18 19:03 |
From | Forrest Cahoon |
Subject | [Csnd] delay dependent on ksmps? |
Hi, all! I have been working with what should be a very simple Karplus-Strong string, and I'm finding that the frequency I'm varies radically with the ksmps value I use.<CsoundSynthesizer> <CsInstruments> sr=48000 ksmps=1 nchnls=2 instr 1 iDur = p3 iAmpl = ampdbfs(p4) iFreq = p5 iCycle = 1/iFreq aSignal = noise(iAmpl, 0) * linseg(1, 2*iCycle, 1, 0, 0) aDelayed = aSignal aFiltered init 0 aDelayed delay aFiltered + aDelayed, iCycle aFiltered tone aDelayed, sr/2 aOut = aFiltered * linseg(0, 2*iCycle, 0, 0, 1) outs aOut, aOut endin </CsInstruments> <CsScore> i1 0 20 -10 240 </CsScore> </CsoundSynthesizer> and here is the frequency I get, measured with Sonic Visualiser, for various values of ksmps:
ksmps observed frequency
It looks like the delay is a integer multiple of k-cycles? I wasn't expecting such radical changes in my output just by changing ksmps. This should at least be documented, if not fixed somehow to give more accurate delay rates. On a related note, I wasn't able to find the source for the delay opcode -- I have been grepping for the opcode name, but "delay" turns up zillions of lines. How do I find it? Forrest |
Date | 2014-02-18 19:16 |
From | Rory Walsh |
Subject | Re: [Csnd] delay dependent on ksmps? |
Csound processes ksmps samples every k-rate cycle. If you wish to have very small delays lines you need to decrease ksmps. For short delay lines just leave ksmps at 1, or better still, wrap the code in a UDO and set the ksmps value locally. On 18 February 2014 19:03, Forrest Cahoon |