| Clearly I do not have my head wrapped fully around the various “times” in csound! I’m trying . . . but this is hard!!
Thanks,
Robert
> On Jul 8, 2016, at 6:39 AM, Steven Yi wrote:
>
> I tried the CSD here and got a crash. In gdb, the crash looks to be
> due to an infinite recursion during the init pass. Looking at the
> CSD, it makes sense to me, as you are using kindex and assuming
> calculations are going to happen at i-time when making the recursive
> call (i.e., kindex + 1). Those calculations would happen at perf-time,
> not init-time, so kindex should be 0 throughout the init-pass as far
> as I can see. There are other issues with using perf-time opcodes
> like tab but depending upon them during the init-pass.
>
> I've attached a modified CSD that works here.
>
> On Fri, Jul 8, 2016 at 9:13 AM, C. R. Craig wrote:
>> Okay, here’s an example of a recursive opcode segfaulting when written to run at “k-rate.”
>>
>> If you comment out the recursion and provide a value for aN, the example runs successfully.
>>
>> Thanks,
>> Robert
>>
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>> https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>>
>>
>>> On Jul 8, 2016, at 2:13 AM, Victor Lazzarini wrote:
>>>
>>> Can you give us a complete example to look at?
>>> ========================
>>> Dr Victor Lazzarini
>>> Dean of Arts, Celtic Studies and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>>
>>>> On 8 Jul 2016, at 03:51, C. R. Craig wrote:
>>>>
>>>> Not that this *should* work, but . . . csound shouldn’t segfault either. I’ll file a bug on it, if there isn’t already one open.
>>>>
>>>> I also found something interesting, which may be by design: my instrument UDO calls another UDO to actually produce the sound. This second UDO, called PlayPartials, was the UDO that was written using recursion, and which works fine (now that the order of arguments is correct :-) at “i-rate,” and which segfaults when re-written to run at k-rate. The thing is, removing the recursion and writing what would normally work at k-rate using the implicit loop does not work.
>>>>
>>>> opcode PlayPartials2, a, kkki
>>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>>> kdur,kfreq,kPartialTable,iAmplitudes xin
>>>> kindex init 0
>>>> ktablesize init 8
>>>>
>>>> kPartial tablekt kindex,kPartialTable
>>>> kAmp tab kindex,iAmplitudes
>>>> aA poscil kAmp,kfreq*kPartial
>>>> kindex = (kindex+1)%ktablesize
>>>> xout aA <—— this may be the problem? I may have to send the signal aA to an output channel in the opcode
>>>> endop
>>>>
>>>> It runs once per invocation by the calling opcode and returns. And of course now I have the problem of kindex’s state being preserved, where I don’t want it to be :-(
>>>>
>>>> So, my questions are these: should recursion work at k-rate? Should the implicit loop that exists at k-rate also be present in an opcode called by another opcode?
>>>>
>>>> In the meantime, I’m just going to put this code in the calling opcode and sequentially produce the partials. Not flexible, but should work.
>>>>
>>>> Thanks,
>>>> Robert
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>> https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>> https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>> https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |