| The diagnostic I gave regarding pvsbin is correct, I just looked at the
code. I'll implement a fix tomorrow.
Meanwhile, you can try recursion as in
opcode fbins,k,ikpp
ih,kt,ibin,icnt xin
if icnt >= ibin goto skip
k1 fbins ih,kt,ibin,icnt+1
skip:
fs1 pvsbufread kt, ih
kamp, kfr pvsbin fs1, icnt
kcnt line 0,100000, 1
printf "amp: %f freq: %f, %f\n",kcnt, kamp, kfr, icnt
xout k1
endop
instr 1
k1 = 0
a1 rand 0dbfs/4
fs1 pvsanal a1, 1024,256,1024,1
iha,kt pvsbuffer fs1,0.1
k1 fbins iha,kt,10
endin
----- Original Message -----
From: "Matti Koskinen"
To:
Sent: Monday, May 23, 2011 9:01 PM
Subject: Re: [Csnd] new problem with looping
On May 23, 2011, at 10:23 PM, Victor.Lazzarini@nuim.ie wrote:
> I think I know why this does not do what you want. In general, pv opcodes
> output only
> after a new frame has been produced at the input, so if you loop, you will
> get the same
> result. I can change this behaviour to get a new value if the bin is
> different. I never anticipated
> this use. I will have a look at this tomorrow.
>
> Victor
>
sounds reasonable but this csd produces in the output.sco 100 same values,
but the printk2's print different values when the bin number is integer
; Select audio/midi flags here according to platform
; Audio out Audio in
-odac ;;;RT audio I/O ; For Non-realtime ouput leave only the line below:
; -o fprints.wav -W ;;; for file output any platform
;Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument #1 looping pvsbins
instr 1
ifftsize = 1024
iwtype = 1 /* cleaner with hanning window */
kthrs = 20
a1 soundin "hi.aiff" ;select a soundifle
fsig pvsanal a1, ifftsize, ifftsize/4, ifftsize, iwtype
kbin = 1
kmaxbin = 100
loop:
kamp,kfr pvsbin fsig,kbin
ktr = 0
if (kamp > kthrs) then
ktr = 1
else
ktr = 0
endif
kbin = kbin + 1
schedkwhen ktr, 0,100,2,0,0.5,kamp,kfr
if (kbin < kmaxbin) kgoto loop
kamp2,kfr2 pvsbin fsig,10 ; shouldn't the fsig still be the same?
kamp3,kfr3 pvsbin fsig,11
printk2 kfr2
printk2 kfr3
endin
instr 2
fprints "output.sco","i1 %f %f %f %f\n",p2,p3,p4,p5
endin
i1 0 10
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
csound"
=
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|