Csound Csound-dev Csound-tekno Search About

[Csnd] Reinit pass - help appreciated

Date2020-10-19 19:56
FromJan Jacob Hofmann
Subject[Csnd] Reinit pass - help appreciated
Dear list,

I am currently struggling at some re-init-pass problem which seems 
strange to me. Obviously the re-init-pass does not seem to work like I 
would expect it. I would expect that the second i-time-print-output of 
ifreq would have the value of 440. Instead it has the value of 0. I do 
assume that I made a general mistake in my thinking about the behaviour 
of re-init passes. More than that, I think it used to work before. Can 
someone please show me the point I am missing? The .csd for testing is 
below. I tested it with Csound 6.15, both on Mac and Ubuntu.

Thanks,

Jan Jacob




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



instr 1 ;Reinit-test




; REINIT-PASS
ktriginit1; initialize trigger for reinit-pass
if ktrig== 1then; at first k-cycle ...
reinitcycle; start reinit-pass from label "cycle"
endif
ktrig=0; avoid repeating this every k-cycle


cycle: ; start of (re)init pass

kfreq=440
; printk.02, kfreq                         ; print k-rate value
ifreq=i(kfreq); transform kfreq to i-rate
printifreq                             ; print i-rate value

rireturn; end of (re)init pass

endin









sound         |         movement         | object         |        space
sonic architecture       |        site: http://www.sonicarchitecture.de
spatial electronic composition   |    higher order ambisonic music



sound         |         movement         | object         |        space
sonic architecture       |        site: http://www.sonicarchitecture.de
spatial electronic composition   |    higher order ambisonic music

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

Date2020-10-19 20:24
Fromjoachim heintz
SubjectRe: [Csnd] Reinit pass - help appreciated
hi jan jacob -

i think this is the point: in the first k-cycle, in which you jump to 
the reinit section, the value of kfreq is not yet 440, but indeed 0. 
because the first k-cycle, in which the assignment kfreq=440 is done, 
has not come to this line of code.

if you do it in the second k-cycle, it works:

instr 1 ;Reinit-test
; REINIT-PASS
if timeinstk() == 2 then; at first k-cycle ...
reinit cycle; start reinit-pass from label "cycle"
endif
cycle: ; start of (re)init pass
kfreq=440
; printk.02, kfreq                         ; print k-rate value
ifreq=i(kfreq); transform kfreq to i-rate
print ifreq                             ; print i-rate value
rireturn; end of (re)init pass
endin

best -
	joachim


On 19/10/2020 20:56, Jan Jacob Hofmann wrote:
> Dear list,
> 
> I am currently struggling at some re-init-pass problem which seems 
> strange to me. Obviously the re-init-pass does not seem to work like I 
> would expect it. I would expect that the second i-time-print-output of 
> ifreq would have the value of 440. Instead it has the value of 0. I do 
> assume that I made a general mistake in my thinking about the behaviour 
> of re-init passes. More than that, I think it used to work before. Can 
> someone please show me the point I am missing? The .csd for testing is 
> below. I tested it with Csound 6.15, both on Mac and Ubuntu.
> 
> Thanks,
> 
> Jan Jacob
> 
> 
> 
> 
> sr=44100
> ksmps=1
> nchnls=2
> 0dbfs=1
> 
> 
> 
> instr 1 ;Reinit-test
> 
> 
> 
> 
> ; REINIT-PASS
> ktriginit1; initialize trigger for reinit-pass
> if ktrig== 1then; at first k-cycle ...
> reinitcycle; start reinit-pass from label "cycle"
> endif
> ktrig=0; avoid repeating this every k-cycle
> 
> 
> cycle: ; start of (re)init pass
> 
> kfreq=440
> ; printk.02, kfreq                         ; print k-rate value
> ifreq=i(kfreq); transform kfreq to i-rate
> printifreq                             ; print i-rate value
> 
> rireturn; end of (re)init pass
> 
> endin
> 
> 
> 
> 
> 
> 
> 
> 
> 
> sound         |         movement         | object         |        space
> sonic architecture       |        site: http://www.sonicarchitecture.de
> spatial electronic composition   |    higher order ambisonic music
> 
> 
> 
> sound         |         movement         | object         |        space
> sonic architecture       |        site: http://www.sonicarchitecture.de
> spatial electronic composition   |    higher order ambisonic music
> 
> 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

Date2020-10-19 20:47
FromJan Jacob Hofmann
SubjectRe: [Csnd] Reinit pass - help appreciated
Dear Joachim,

thank you so much - I got the point now.
Putting the line...

kfreq = 440

...before the reinit-pass also helps, as I now found out after I got the 
point of what you just wrote.

Cheers,

Jan Jacob

sound      |      movement       |       object      |      space
sonic architecture     |      site: http://www.sonicarchitecture.de
spatial electronic composition    |    higher order ambisonic music

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