[Csnd] loop question
Date | 2012-07-28 03:11 |
From | peiman khosravi |
Subject | [Csnd] loop question |
Hello, Could someone please help me understand what I need to modify in order to have each iteration of the loop on a k-period (so that I have a new value on every k period)? kcount=0 isize = ftlen(itable) loop: kout tab kcount, itable loop_lt kcount, 1, isize, loop printk2 kout (full CSD below) Many Thanks Peiman <CsoundSynthesizer> <CsOptions> -W -d -odevaudio </CsOptions> <CsInstruments> sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 opcode test,k, ki kval, itable xin kcount=0 isize = ftlen(itable) loop: kout tab kcount, itable loop_lt kcount, 1, isize, loop endop instr 1 itable ftgen 0, 0, 16, -7, 0, 16, 1 kline line 0, p3, 15 kout test kline, itable printk2 kout endin </CsInstruments> <CsScore> i1 0 10 </CsScore> </CsoundSynthesizer> |
Date | 2012-07-28 05:00 |
From | Justin Smith |
Subject | Re: [Csnd] loop question |
I am not sure I understand your question, but in case this information is relevant, the whole instrument is a loop that is run through once per k cycle. For example: instr 1 kindex init 0 kindex = kindex+1 endin in the above instrument, kindex is 1 at the end of the first k cycle, 2 at the end of the second, etc. etc. On Fri, Jul 27, 2012 at 7:11 PM, peiman khosravi |
Date | 2012-07-28 06:37 |
From | Steven Yi |
Subject | Re: [Csnd] loop question |
Hi Peiman, It looks like you are missing an xout in you UDO. Steven On Jul 27, 2012 10:11 PM, "peiman khosravi" <peimankhosravi@gmail.com> wrote:
Hello, |
Date | 2012-07-28 09:37 |
From | peiman khosravi |
Subject | Re: [Csnd] loop question |
Thanks Steven, that was missed out as I was changing things around a bit but it wasn't the main problem. Justin, your example is exactly what I needed. Thanks very much. After all these years with Csound I couldn't figure this one out! P On 28 July 2012 06:37, Steven Yi <stevenyi@gmail.com> wrote:
|
Date | 2012-07-28 09:56 |
From | peiman khosravi |
Subject | Re: [Csnd] loop question |
so this works ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This is a simple csound file to test your audio output ; ; from WinXound. In order to work correctly with WinXound ; ; it's very important that you fill all the required ; ; compiler paths fields into the WinXound Settings ; ; window with correct values (WinXound -> Preferences). ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; <CsoundSynthesizer> <CsOptions> -W -d -odevaudio </CsOptions> <CsInstruments> sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 opcode test,k, ki kval, itable xin kcount init -1 isize = ftlen(itable) kcount = kcount+1 if (kcount<isize) then kout tab kcount, itable endif xout kout endop instr 1 ;Simple sine at 440Hz itable ftgen 0, 0, 16, -7, 0, 16, 1 kline line 0, p3, 15 kout test kline, itable printk2 kout endin </CsInstruments> <CsScore> f1 0 4096 10 1 i1 0 10 </CsScore> </CsoundSynthesizer> On 28 July 2012 09:37, peiman khosravi <peimankhosravi@gmail.com> wrote: Thanks Steven, that was missed out as I was changing things around a bit but it wasn't the main problem. |