[Csnd] about pvs analysis and fsig arrays

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] about pvs analysis and fsig arrays

Francesco Porta
Hello All,
i use an intrument that trigger new notes from live input.
Then it start some pvs instruments. Because every instrument
do pvs analysis i think that maybe should be better to have
a single instrument doing analysis and then other instruments
will use that.

1 - is this correct? Or analysis is not so computational expensive?

Then i tried to use array of fsig (see my csd test) but it is not working.
What am i doing wrong?

Thanks,
ciao,
francesco.

<CsoundSynthesizer>
<CsOptions>
-odac -d -m0
</CsOptions>
<CsInstruments>

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

gaInput init 0

; durata della registrazione della nota
giNoteDur = 3
gkNoteNumber init 0

; array delle tavole e degli fsig
gfsig[] init 100


; intervallo tra i triggers di almeno giNoteDur sec.
opcode Trigger, kk, a

ainput xin
iThresh = 0.1
iWait = kr*giNoteDur
kTimer init kr*giNoteDur + 1
kRms rms ainput, 20
iSampTim = 0.01
kRmsPrev delayk kRms, iSampTim
kChange = kRms - kRmsPrev

if(kTimer>iWait) then
        if kChange > iThresh then
                kTrig = 1
                gkNoteNumber += 1
        else
                kTrig = 0
        endif
        kTimer = kTrig == 1 ? 0 : kTimer
else
        kTimer += 1
        kTrig = 0
endif
xout kTrig, gkNoteNumber
endop

instr 10

gaInput diskin2 "../guitar_C.wav", 1, 0, 1
ktrig, knote Trigger gaInput

; start pvs analysis
schedkwhen ktrig, 0, 0, 40, 0, giNoteDur, knote
;outs gaInput*0.1, gaInput*0.1
endin

instr 40

iTableNum = p4

fsig pvsanal gaInput, 1024, 256, 1024, 1

gfsig[iTableNum] = fsig

; start pvs resynthesis
event_i "i", 41, 0, giNoteDur, iTableNum
endin

instr 41

aout pvsynth gfsig[p4]
outs aout, aout
endin

</CsInstruments>
<CsScore>

i 10 0 360

</CsScore>
</CsoundSynthesizer>



Csound mailing list
[hidden email]
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

simple_fsig_array.csd (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] about pvs analysis and fsig arrays

jpff
Run to completion for me when writing an output file.  I had  to fake your
input file.  What should I expect?  #i ran with -v so i could see the
activity.


On Wed, 10 Oct 2018, Francesco Porta wrote:

> Hello All,
> i use an intrument that trigger new notes from live input.
> Then it start some pvs instruments. Because every instrument
> do pvs analysis i think that maybe should be better to have
> a single instrument doing analysis and then other instruments
> will use that.
>
> 1 - is this correct? Or analysis is not so computational expensive?
>
> Then i tried to use array of fsig (see my csd test) but it is not working.
> What am i doing wrong?
>
> Thanks,
> ciao,
> francesco.
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -d -m0
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> gaInput init 0
>
> ; durata della registrazione della nota
> giNoteDur = 3
> gkNoteNumber init 0
>
> ; array delle tavole e degli fsig
> gfsig[] init 100
>
>
> ; intervallo tra i triggers di almeno giNoteDur sec.
> opcode Trigger, kk, a
>
> ainput xin
> iThresh = 0.1
> iWait = kr*giNoteDur
> kTimer init kr*giNoteDur + 1
> kRms rms ainput, 20
> iSampTim = 0.01
> kRmsPrev delayk kRms, iSampTim
> kChange = kRms - kRmsPrev
>
> if(kTimer>iWait) then
> if kChange > iThresh then
> kTrig = 1
> gkNoteNumber += 1
> else
> kTrig = 0
> endif
> kTimer = kTrig == 1 ? 0 : kTimer
> else
> kTimer += 1
> kTrig = 0
> endif
> xout kTrig, gkNoteNumber
> endop
>
> instr 10
>
> gaInput diskin2 "../guitar_C.wav", 1, 0, 1
> ktrig, knote Trigger gaInput
>
> ; start pvs analysis
> schedkwhen ktrig, 0, 0, 40, 0, giNoteDur, knote
> ;outs gaInput*0.1, gaInput*0.1
> endin
>
> instr 40
>
> iTableNum = p4
>
> fsig pvsanal gaInput, 1024, 256, 1024, 1
>
> gfsig[iTableNum] = fsig
>
> ; start pvs resynthesis
> event_i "i", 41, 0, giNoteDur, iTableNum
> endin
>
> instr 41
>
> aout pvsynth gfsig[p4]
> outs aout, aout
> endin
>
> </CsInstruments>
> <CsScore>
>
> i 10 0 360
>
> </CsScore>
> </CsoundSynthesizer>
>
>
>
> Csound mailing list
> [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] about pvs analysis and fsig arrays

00000008a49663bc-dmarc-request
In reply to this post by Francesco Porta

Ciao

I think you can copy an fsig to an array (pvs2array) and vice versa (pvsfromarray) but you can not create an array of fsigs (gfsig[iTableNum] in your example).


Il 10 ottobre 2018 alle 10.09 Francesco Porta <[hidden email]> ha scritto:

Hello All,
i use an intrument that trigger new notes from live input.
Then it start some pvs instruments. Because every instrument
do pvs analysis i think that maybe should be better to have
a single instrument doing analysis and then other instruments
will use that.

1 - is this correct? Or analysis is not so computational expensive?

Then i tried to use array of fsig (see my csd test) but it is not working.
What am i doing wrong?

Thanks,
ciao,
francesco.

<CsoundSynthesizer>
<CsOptions>
-odac -d -m0
</CsOptions>
<CsInstruments>

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

gaInput init 0

; durata della registrazione della nota
giNoteDur = 3
gkNoteNumber init 0

; array delle tavole e degli fsig
gfsig[] init 100


; intervallo tra i triggers di almeno giNoteDur sec.
opcode Trigger, kk, a

ainput xin
iThresh = 0.1
iWait = kr*giNoteDur
kTimer init kr*giNoteDur + 1
kRms rms ainput, 20
iSampTim = 0.01
kRmsPrev delayk kRms, iSampTim
kChange = kRms - kRmsPrev

if(kTimer>iWait) then
if kChange > iThresh then
kTrig = 1
gkNoteNumber += 1
else
kTrig = 0
endif
kTimer = kTrig == 1 ? 0 : kTimer
else
kTimer += 1
kTrig = 0
endif
xout kTrig, gkNoteNumber
endop

instr 10

gaInput diskin2 "../guitar_C.wav", 1, 0, 1
ktrig, knote Trigger gaInput

; start pvs analysis
schedkwhen ktrig, 0, 0, 40, 0, giNoteDur, knote
;outs gaInput*0.1, gaInput*0.1
endin

instr 40

iTableNum = p4

fsig pvsanal gaInput, 1024, 256, 1024, 1

gfsig[iTableNum] = fsig

; start pvs resynthesis
event_i "i", 41, 0, giNoteDur, iTableNum
endin

instr 41

aout pvsynth gfsig[p4]
outs aout, aout
endin

</CsInstruments>
<CsScore>

i 10 0 360

</CsScore>
</CsoundSynthesizer>

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] about pvs analysis and fsig arrays

jpff
I think the line
       gfsig[iTableNum] = fsig
is being evaluated at i-time wn you want it at k-time.  Try changnf that
line to
       kk init iTableNum
       gfsig[kk] = fsig

Trace is hard to read but I dsee in unstr 40
op (=.f) allocated at 0x21dcaf0
opadr = 0x7f366b6baaf0
op (##array_set.i) allocated at 0x21dcb30
op (event_i) allocated at 0x21e09e8
insert(): tp->act_instance = 0x21dc560

so the array is set at init time (ter ##array_set.i) when you want
##array_set.k


On Wed, 10 Oct 2018, [hidden email] wrote:

>
> Ciao
>
> I think you can copy an fsig to an array (pvs2array) and vice versa
> (pvsfromarray) but you can not create an array of fsigs (gfsig[iTableNum] in
> your example).
>
>
>       Il 10 ottobre 2018 alle 10.09 Francesco Porta
>       <[hidden email]> ha scritto:
>
>       Hello All,
>       i use an intrument that trigger new notes from live input.
>       Then it start some pvs instruments. Because every instrument
>       do pvs analysis i think that maybe should be better to have
>       a single instrument doing analysis and then other instruments
>       will use that.
>
>       1 - is this correct? Or analysis is not so computational
>       expensive?
>
>       Then i tried to use array of fsig (see my csd test) but it is not
>       working.
>       What am i doing wrong?
>
>       Thanks,
>       ciao,
>       francesco.
>
>       <CsoundSynthesizer>
>       <CsOptions>
>       -odac -d -m0
>       </CsOptions>
>       <CsInstruments>
>
>       sr = 44100
>       ksmps = 32
>       nchnls = 2
>       0dbfs = 1
>
>       gaInput init 0
>
>       ; durata della registrazione della nota
>       giNoteDur = 3
>       gkNoteNumber init 0
>
>       ; array delle tavole e degli fsig
>       gfsig[] init 100
>
>
>       ; intervallo tra i triggers di almeno giNoteDur sec.
>       opcode Trigger, kk, a
>
>       ainput xin
>       iThresh = 0.1
>       iWait = kr*giNoteDur
>       kTimer init kr*giNoteDur + 1
>       kRms rms ainput, 20
>       iSampTim = 0.01
>       kRmsPrev delayk kRms, iSampTim
>       kChange = kRms - kRmsPrev
>
>       if(kTimer>iWait) then
>       if kChange > iThresh then
>       kTrig = 1
>       gkNoteNumber += 1
>       else
>       kTrig = 0
>       endif
>       kTimer = kTrig == 1 ? 0 : kTimer
>       else
>       kTimer += 1
>       kTrig = 0
>       endif
>       xout kTrig, gkNoteNumber
>       endop
>
>       instr 10
>
>       gaInput diskin2 "../guitar_C.wav", 1, 0, 1
>       ktrig, knote Trigger gaInput
>
>       ; start pvs analysis
>       schedkwhen ktrig, 0, 0, 40, 0, giNoteDur, knote
>       ;outs gaInput*0.1, gaInput*0.1
>       endin
>
>       instr 40
>
>       iTableNum = p4
>
>       fsig pvsanal gaInput, 1024, 256, 1024, 1
>
>       gfsig[iTableNum] = fsig
>
>       ; start pvs resynthesis
>       event_i "i", 41, 0, giNoteDur, iTableNum
>       endin
>
>       instr 41
>
>       aout pvsynth gfsig[p4]
>       outs aout, aout
>       endin
>
>       </CsInstruments>
>       <CsScore>
>
>       i 10 0 360
>
>       </CsScore>
>       </CsoundSynthesizer>
>
>       Csound mailing list
>       [hidden email]
>       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 [hidden email]
> 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
[hidden email]
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