Csound Csound-dev Csound-tekno Search About

[Csnd-dev] UDO compilation seclects i- instead of k-rate

Date2018-08-16 10:09
Fromjoachim heintz
Subject[Csnd-dev] UDO compilation seclects i- instead of k-rate
hi -

if i have something like
	kVal OPCODE iVal1, iVal2
the k-version of OPCODE is chosen.

but if i define UDO both at i and k, then in
	kVal UDO iVal1, iVal2
the i-version of UDO is chosen.

i think this is not correct, and should be in the same way as it works 
for OPCODE.

below is an example which should explain everything.

thanks for having a look -

	joachim









sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

   opcode RndInt, i, ii
iMin, iMax xin
iRnd random iMin, iMax+.999999
xout int(iRnd)
   endop

   opcode RndInt, k, kk
kMin, kMax xin
kRnd random kMin, kMax+.999999
xout int(kRnd)
   endop

instr 1

  kBla init 10
  printk2 kBla
  ;the following line does not affect the
  ;init of kBla as it is only valid at perf time
  kBla random 1, 2
  turnoff

endin
schedule 1, 0, 1

instr 2 ;wrong in my opinion

  kBla init 10
  printk2 kBla
  ;the following line resets the initialization
  ;of kBla as the i-time version of the UDO RndInt
  ;is selected (rather than the k-version)
  kBla RndInt 1, 2
  turnoff

endin
schedule 2, 0, 1

instr 3

  kBla init 10
  printk2 kBla
  ;forcing to select the k-rate version of the
  ;UDO works again
  kBla = RndInt:k(1, 2)
  turnoff

endin
schedule 3, 0, 1








output:
  i1    10.00000
  i2     0.00000

Date2018-08-16 12:49
FromDave Seidel
SubjectRe: [Csnd-dev] UDO compilation seclects i- instead of k-rate
This touches on an issue that's been confounding me lately. In the Csound manual, in the "opcode" entry, it's stated:

These opcodes actually run only at i-time. Performance time copying is done by the user opcode call. This means that skipping xin or xout with kgoto has no effect, while skipping with igoto affects both init and performance time operation.

However, in the FLOSS manual chapter on UDOs, in the second paragraph, it is stated: "They run at i-time or at k-time."

Which one is correct? Is the manual out of date?

The issue for me has been that I have a rather complex script (Implication Organ). The initial version uses MIDI controls (as in knobs & sliders), but I've been rewriting it to use OSC for those functions. In the process of rewriting, I had to shift a lot of things from running at i-time to running at k-time. When I did this, my UDOs stopped working as expected. It took a while before I realized that what was happening was that the UDO were only firing at i-time -- even for opcodes where all inputs and outputs were defined as k-variables. Is it possible that there's a bug? Unless the manual is correct and they only run at i-time.

This seems related to what Joachim is asking above.

I am working with the latest code in the develop branch.

Thanks,
Dave

Date2018-08-16 13:51
Fromjoachim heintz
SubjectRe: [Csnd-dev] UDO compilation seclects i- instead of k-rate
hi dave -

if you look at instr 3 of my example, i think it is clear that a UDO can 
work only at k-rate (as any k-rate build-in opcode).

the point is that a k-rate output variable should force the UDO to 
choose the k-rate version (if there is one in the definition), and this 
is not the case, as far as i see.

best -

	joachim



On 16/08/18 13:49, Dave Seidel wrote:
> This touches on an issue that's been confounding me lately. In the
> Csound manual, in the "opcode" entry, it's stated:
>
>     These opcodes actually run only at i-time. Performance time copying
>     is done by the user opcode call. This means that skipping /xin/ or
>     /xout/ with /kgoto/ has no effect, while skipping with /igoto/
>     affects both init and performance time operation.
>
>
> However, in the FLOSS manual chapter on UDOs, in the second paragraph,
> it is stated: "They run at i-time or at k-time."
>
> Which one is correct? Is the manual out of date?
>
> The issue for me has been that I have a rather complex script
> (Implication Organ). The initial version uses MIDI controls (as in knobs
> & sliders), but I've been rewriting it to use OSC for those functions.
> In the process of rewriting, I had to shift a lot of things from running
> at i-time to running at k-time. When I did this, my UDOs stopped working
> as expected. It took a while before I realized that what was happening
> was that the UDO were only firing at i-time -- even for opcodes where
> all inputs and outputs were defined as k-variables. Is it possible that
> there's a bug? Unless the manual is correct and they only run at i-time.
>
> This seems related to what Joachim is asking above.
>
> I am working with the latest code in the develop branch.
>
> Thanks,

Date2018-08-16 14:00
FromDave Seidel
SubjectRe: [Csnd-dev] UDO compilation seclects i- instead of k-rate
Joachim, thanks for the reminder of the ":k()" override -- I seem to always forget that these exist.

On Thu, Aug 16, 2018 at 8:51 AM joachim heintz <jh@joachimheintz.de> wrote:
hi dave -

if you look at instr 3 of my example, i think it is clear that a UDO can
work only at k-rate (as any k-rate build-in opcode).

the point is that a k-rate output variable should force the UDO to
choose the k-rate version (if there is one in the definition), and this
is not the case, as far as i see.

best -

        joachim



On 16/08/18 13:49, Dave Seidel wrote:
> This touches on an issue that's been confounding me lately. In the
> Csound manual, in the "opcode" entry, it's stated:
>
>     These opcodes actually run only at i-time. Performance time copying
>     is done by the user opcode call. This means that skipping /xin/ or
>     /xout/ with /kgoto/ has no effect, while skipping with /igoto/
>     affects both init and performance time operation.
>
>
> However, in the FLOSS manual chapter on UDOs, in the second paragraph,
> it is stated: "They run at i-time or at k-time."
>
> Which one is correct? Is the manual out of date?
>
> The issue for me has been that I have a rather complex script
> (Implication Organ). The initial version uses MIDI controls (as in knobs
> & sliders), but I've been rewriting it to use OSC for those functions.
> In the process of rewriting, I had to shift a lot of things from running
> at i-time to running at k-time. When I did this, my UDOs stopped working
> as expected. It took a while before I realized that what was happening
> was that the UDO were only firing at i-time -- even for opcodes where
> all inputs and outputs were defined as k-variables. Is it possible that
> there's a bug? Unless the manual is correct and they only run at i-time.
>
> This seems related to what Joachim is asking above.
>
> I am working with the latest code in the develop branch.
>
> Thanks,
> Dave


--