Csound Csound-dev Csound-tekno Search About

[Csnd] another pvs question

Date2012-06-27 22:20
Frompeiman khosravi
Subject[Csnd] another pvs question
Hello,

Below is a csd that samples the pvs frame once every N frames (using pvsftw). Now the question is, would it be possible to cross-fade (or interpolate) between the successive sampled frames?

    
Many thanks
Peiman 



<CsoundSynthesizer>

<CsOptions>
-odac -d
</CsOptions>

<CsInstruments>
sr = 44100
ksmps = 10
nchnls = 1
0dbfs  = 1

instr 1
ifftsize    =        4096
ioverlap    =        ifftsize / 4
iwinsize    =        ifftsize * 2
iwinshape    =        1; von-Hann window
iNumBins    =    (ifftsize/2) + 1; bins used + 1

; generate three empty function tables for storing held amplutudes and updated amplitudes
iAmpA    ftgen 0, 0, iNumBins, 2, 0
iAmpB    ftgen 0, 0, iNumBins, 2, 0
iFreqA    ftgen 0, 0, iNumBins, 2, 0
iFreqB    ftgen 0, 0, iNumBins, 2, 0
iclear    ftgen 0, 0, iNumBins, 2, 0

; Initialise distance / interpolation values
;ktime chnget "ktime" ; interpolation time/distance in frames
kRange = 100 ; dummy run with interpolation time set to nominal frames
kInterpol = 0 ; initialise interpolation/multiplier value

;store a sample in a function table (buffer)
    ain1    in ; get audio from external channel 1
    ;ain1     inch 1 ; get sound
    ;ain1     dcblock ain1; add DC blocking filter
    fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ; analyse it
;=======================================

kduration = 20


ksignal init 0
kcount init 1 ;initiate this only once ('init' not '=') or else kcount will be reset to 1 on every k-period

kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th etable    

    if (kflag > 0) then ; only proceed when frame is ready (kflag gives value of 1 when data passes)
   
        kcount = kcount+1 ;for each frame add an increment to kcount
       
        if (kcount>kduration) then ;every 3rd frame...
            tablecopy iAmpB, iAmpA
            tablecopy iFreqB, iFreqA
        kcount = 1 ;reset kcount to 1
        endif

    endif


    pvsftr fsig1, iAmpB, iFreqB
    aout1    pvsynth fsig1


out aout1

endin

</CsInstruments>
<CsScore>
i1 0 30
</CsScore>
</CsoundSynthesizer>


Date2012-06-27 23:36
FromOeyvind Brandtsegg
SubjectRe: [Csnd] another pvs question
Could you perhaps use one of the table morfing opcodes?
ftmorf, tabmorph, or hvs?
Haven't really thought about the details, but it seemed like what you wanted.
Oeyvind

2012/6/27 peiman khosravi :
> Hello,
>
> Below is a csd that samples the pvs frame once every N frames (using
> pvsftw). Now the question is, would it be possible to cross-fade (or
> interpolate) between the successive sampled frames?
>
>
> Many thanks
> Peiman
>
>
>
> 
>
> 
> -odac -d
> 
>
> 
> sr = 44100
> ksmps = 10
> nchnls = 1
> 0dbfs  = 1
>
> instr 1
> ifftsize    =        4096
> ioverlap    =        ifftsize / 4
> iwinsize    =        ifftsize * 2
> iwinshape    =        1; von-Hann window
> iNumBins    =    (ifftsize/2) + 1; bins used + 1
>
> ; generate three empty function tables for storing held amplutudes and
> updated amplitudes
> iAmpA    ftgen 0, 0, iNumBins, 2, 0
> iAmpB    ftgen 0, 0, iNumBins, 2, 0
> iFreqA    ftgen 0, 0, iNumBins, 2, 0
> iFreqB    ftgen 0, 0, iNumBins, 2, 0
> iclear    ftgen 0, 0, iNumBins, 2, 0
>
> ; Initialise distance / interpolation values
> ;ktime chnget "ktime" ; interpolation time/distance in frames
> kRange = 100 ; dummy run with interpolation time set to nominal frames
> kInterpol = 0 ; initialise interpolation/multiplier value
>
> ;store a sample in a function table (buffer)
>     ain1    in ; get audio from external channel 1
>     ;ain1     inch 1 ; get sound
>     ;ain1     dcblock ain1; add DC blocking filter
>     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
> analyse it
> ;=======================================
>
> kduration = 20
>
>
> ksignal init 0
> kcount init 1 ;initiate this only once ('init' not '=') or else kcount will
> be reset to 1 on every k-period
>
> kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th etable
>
>
>     if (kflag > 0) then ; only proceed when frame is ready (kflag gives
> value of 1 when data passes)
>
>         kcount = kcount+1 ;for each frame add an increment to kcount
>
>         if (kcount>kduration) then ;every 3rd frame...
>             tablecopy iAmpB, iAmpA
>             tablecopy iFreqB, iFreqA
>         kcount = 1 ;reset kcount to 1
>         endif
>
>     endif
>
>
>     pvsftr fsig1, iAmpB, iFreqB
>     aout1    pvsynth fsig1
>
>
> out aout1
>
> endin
>
> 
> 
> i1 0 30
> 
> 
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


Date2012-06-28 00:19
Frompeiman khosravi
SubjectRe: [Csnd] another pvs question
Thanks Oeyvind,

I did think about that but I can't figure out how to time the interpolation.

Best,
Peiman

On 27 June 2012 23:36, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Could you perhaps use one of the table morfing opcodes?
ftmorf, tabmorph, or hvs?
Haven't really thought about the details, but it seemed like what you wanted.
Oeyvind

2012/6/27 peiman khosravi <peimankhosravi@gmail.com>:
> Hello,
>
> Below is a csd that samples the pvs frame once every N frames (using
> pvsftw). Now the question is, would it be possible to cross-fade (or
> interpolate) between the successive sampled frames?
>
>
> Many thanks
> Peiman
>
>
>
> <CsoundSynthesizer>
>
> <CsOptions>
> -odac -d
> </CsOptions>
>
> <CsInstruments>
> sr = 44100
> ksmps = 10
> nchnls = 1
> 0dbfs  = 1
>
> instr 1
> ifftsize    =        4096
> ioverlap    =        ifftsize / 4
> iwinsize    =        ifftsize * 2
> iwinshape    =        1; von-Hann window
> iNumBins    =    (ifftsize/2) + 1; bins used + 1
>
> ; generate three empty function tables for storing held amplutudes and
> updated amplitudes
> iAmpA    ftgen 0, 0, iNumBins, 2, 0
> iAmpB    ftgen 0, 0, iNumBins, 2, 0
> iFreqA    ftgen 0, 0, iNumBins, 2, 0
> iFreqB    ftgen 0, 0, iNumBins, 2, 0
> iclear    ftgen 0, 0, iNumBins, 2, 0
>
> ; Initialise distance / interpolation values
> ;ktime chnget "ktime" ; interpolation time/distance in frames
> kRange = 100 ; dummy run with interpolation time set to nominal frames
> kInterpol = 0 ; initialise interpolation/multiplier value
>
> ;store a sample in a function table (buffer)
>     ain1    in ; get audio from external channel 1
>     ;ain1     inch 1 ; get sound
>     ;ain1     dcblock ain1; add DC blocking filter
>     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
> analyse it
> ;=======================================
>
> kduration = 20
>
>
> ksignal init 0
> kcount init 1 ;initiate this only once ('init' not '=') or else kcount will
> be reset to 1 on every k-period
>
> kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th etable
>
>
>     if (kflag > 0) then ; only proceed when frame is ready (kflag gives
> value of 1 when data passes)
>
>         kcount = kcount+1 ;for each frame add an increment to kcount
>
>         if (kcount>kduration) then ;every 3rd frame...
>             tablecopy iAmpB, iAmpA
>             tablecopy iFreqB, iFreqA
>         kcount = 1 ;reset kcount to 1
>         endif
>
>     endif
>
>
>     pvsftr fsig1, iAmpB, iFreqB
>     aout1    pvsynth fsig1
>
>
> out aout1
>
> endin
>
> </CsInstruments>
> <CsScore>
> i1 0 30
> </CsScore>
> </CsoundSynthesizer>
>



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


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"



Date2012-06-28 11:51
FromOeyvind Brandtsegg
SubjectRe: [Csnd] another pvs question
Hm, yeah, interesting,
I think you'll have new frames every ioverlap*(1/sr) seconds,
so the max interpolation time would be kduration*ioverlap*(1/sr), ... I think.
(But the idea would perhaps be not to interpolate smoothly all the
time, but interpolate quickly to the new set, then hold, ... ?)
Now I guess you need another set of tables to hold the two sets of
values you interpolate between,
say, you copy from tableA to tableB every Nth frame,
but I think you also need to copy from tableB to tableC (before the A
to B copy), so you have two sets of values to interpolate between.
Then you might also need a separate table (D) to hold the result of
the interpolation,
and let pvsftr read from tableD.
... plenty of opportunities to bang one's head and shoot one's foot I
guess, and sorry not to be more verbose on code suggestion.

best
Oeyvind

2012/6/28 peiman khosravi :
> Thanks Oeyvind,
>
> I did think about that but I can't figure out how to time the interpolation.
>
> Best,
> Peiman
>
> On 27 June 2012 23:36, Oeyvind Brandtsegg  wrote:
>>
>> Could you perhaps use one of the table morfing opcodes?
>> ftmorf, tabmorph, or hvs?
>> Haven't really thought about the details, but it seemed like what you
>> wanted.
>> Oeyvind
>>
>> 2012/6/27 peiman khosravi :
>> > Hello,
>> >
>> > Below is a csd that samples the pvs frame once every N frames (using
>> > pvsftw). Now the question is, would it be possible to cross-fade (or
>> > interpolate) between the successive sampled frames?
>> >
>> >
>> > Many thanks
>> > Peiman
>> >
>> >
>> >
>> > 
>> >
>> > 
>> > -odac -d
>> > 
>> >
>> > 
>> > sr = 44100
>> > ksmps = 10
>> > nchnls = 1
>> > 0dbfs  = 1
>> >
>> > instr 1
>> > ifftsize    =        4096
>> > ioverlap    =        ifftsize / 4
>> > iwinsize    =        ifftsize * 2
>> > iwinshape    =        1; von-Hann window
>> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >
>> > ; generate three empty function tables for storing held amplutudes and
>> > updated amplitudes
>> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>> > iclear    ftgen 0, 0, iNumBins, 2, 0
>> >
>> > ; Initialise distance / interpolation values
>> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> > kRange = 100 ; dummy run with interpolation time set to nominal frames
>> > kInterpol = 0 ; initialise interpolation/multiplier value
>> >
>> > ;store a sample in a function table (buffer)
>> >     ain1    in ; get audio from external channel 1
>> >     ;ain1     inch 1 ; get sound
>> >     ;ain1     dcblock ain1; add DC blocking filter
>> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
>> > analyse it
>> > ;=======================================
>> >
>> > kduration = 20
>> >
>> >
>> > ksignal init 0
>> > kcount init 1 ;initiate this only once ('init' not '=') or else kcount
>> > will
>> > be reset to 1 on every k-period
>> >
>> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th
>> > etable
>> >
>> >
>> >     if (kflag > 0) then ; only proceed when frame is ready (kflag gives
>> > value of 1 when data passes)
>> >
>> >         kcount = kcount+1 ;for each frame add an increment to kcount
>> >
>> >         if (kcount>kduration) then ;every 3rd frame...
>> >             tablecopy iAmpB, iAmpA
>> >             tablecopy iFreqB, iFreqA
>> >         kcount = 1 ;reset kcount to 1
>> >         endif
>> >
>> >     endif
>> >
>> >
>> >     pvsftr fsig1, iAmpB, iFreqB
>> >     aout1    pvsynth fsig1
>> >
>> >
>> > out aout1
>> >
>> > endin
>> >
>> > 
>> > 
>> > i1 0 30
>> > 
>> > 
>> >
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://flyndresang.no/
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://soundcloud.com/t-emp
>>
>>
>> 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"
>>
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


Date2012-06-28 12:26
Frompeiman khosravi
SubjectRe: [Csnd] another pvs question
Thanks Oeyvind,

Do you think maybe pvsmorph could be used too?

Sounds like a lot of hassle as you say. Not sure if the final result is going to be worth all this effort :-)  

A colleague and friend of mine is working on a live piece with bass clarinet and started coding this csd, based on some of Wishart's ideas. Maybe it's worth going through Wishart's book and listing all the processes that are not currently implemented in Csound?

Best,
P    

On 28 June 2012 11:51, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Hm, yeah, interesting,
I think you'll have new frames every ioverlap*(1/sr) seconds,
so the max interpolation time would be kduration*ioverlap*(1/sr), ... I think.
(But the idea would perhaps be not to interpolate smoothly all the
time, but interpolate quickly to the new set, then hold, ... ?)
Now I guess you need another set of tables to hold the two sets of
values you interpolate between,
say, you copy from tableA to tableB every Nth frame,
but I think you also need to copy from tableB to tableC (before the A
to B copy), so you have two sets of values to interpolate between.
Then you might also need a separate table (D) to hold the result of
the interpolation,
and let pvsftr read from tableD.
... plenty of opportunities to bang one's head and shoot one's foot I
guess, and sorry not to be more verbose on code suggestion.

best
Oeyvind

2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
> Thanks Oeyvind,
>
> I did think about that but I can't figure out how to time the interpolation.
>
> Best,
> Peiman
>
> On 27 June 2012 23:36, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
>>
>> Could you perhaps use one of the table morfing opcodes?
>> ftmorf, tabmorph, or hvs?
>> Haven't really thought about the details, but it seemed like what you
>> wanted.
>> Oeyvind
>>
>> 2012/6/27 peiman khosravi <peimankhosravi@gmail.com>:
>> > Hello,
>> >
>> > Below is a csd that samples the pvs frame once every N frames (using
>> > pvsftw). Now the question is, would it be possible to cross-fade (or
>> > interpolate) between the successive sampled frames?
>> >
>> >
>> > Many thanks
>> > Peiman
>> >
>> >
>> >
>> > <CsoundSynthesizer>
>> >
>> > <CsOptions>
>> > -odac -d
>> > </CsOptions>
>> >
>> > <CsInstruments>
>> > sr = 44100
>> > ksmps = 10
>> > nchnls = 1
>> > 0dbfs  = 1
>> >
>> > instr 1
>> > ifftsize    =        4096
>> > ioverlap    =        ifftsize / 4
>> > iwinsize    =        ifftsize * 2
>> > iwinshape    =        1; von-Hann window
>> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >
>> > ; generate three empty function tables for storing held amplutudes and
>> > updated amplitudes
>> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>> > iclear    ftgen 0, 0, iNumBins, 2, 0
>> >
>> > ; Initialise distance / interpolation values
>> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> > kRange = 100 ; dummy run with interpolation time set to nominal frames
>> > kInterpol = 0 ; initialise interpolation/multiplier value
>> >
>> > ;store a sample in a function table (buffer)
>> >     ain1    in ; get audio from external channel 1
>> >     ;ain1     inch 1 ; get sound
>> >     ;ain1     dcblock ain1; add DC blocking filter
>> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
>> > analyse it
>> > ;=======================================
>> >
>> > kduration = 20
>> >
>> >
>> > ksignal init 0
>> > kcount init 1 ;initiate this only once ('init' not '=') or else kcount
>> > will
>> > be reset to 1 on every k-period
>> >
>> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th
>> > etable
>> >
>> >
>> >     if (kflag > 0) then ; only proceed when frame is ready (kflag gives
>> > value of 1 when data passes)
>> >
>> >         kcount = kcount+1 ;for each frame add an increment to kcount
>> >
>> >         if (kcount>kduration) then ;every 3rd frame...
>> >             tablecopy iAmpB, iAmpA
>> >             tablecopy iFreqB, iFreqA
>> >         kcount = 1 ;reset kcount to 1
>> >         endif
>> >
>> >     endif
>> >
>> >
>> >     pvsftr fsig1, iAmpB, iFreqB
>> >     aout1    pvsynth fsig1
>> >
>> >
>> > out aout1
>> >
>> > endin
>> >
>> > </CsInstruments>
>> > <CsScore>
>> > i1 0 30
>> > </CsScore>
>> > </CsoundSynthesizer>
>> >
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://flyndresang.no/
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://soundcloud.com/t-emp
>>
>>
>> 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"
>>
>



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


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"



Date2012-06-28 14:01
FromOeyvind Brandtsegg
SubjectRe: [Csnd] another pvs question
Mmm, maybe if you used pvsfreeze as a "sample and hold" alternatingly,
then pvsmorph between these two?
Oeyvind

2012/6/28 peiman khosravi :
> Thanks Oeyvind,
>
> Do you think maybe pvsmorph could be used too?
>
> Sounds like a lot of hassle as you say. Not sure if the final result is
> going to be worth all this effort :-)
>
> A colleague and friend of mine is working on a live piece with bass clarinet
> and started coding this csd, based on some of Wishart's ideas. Maybe it's
> worth going through Wishart's book and listing all the processes that are
> not currently implemented in Csound?
>
> Best,
> P
>
> On 28 June 2012 11:51, Oeyvind Brandtsegg  wrote:
>>
>> Hm, yeah, interesting,
>> I think you'll have new frames every ioverlap*(1/sr) seconds,
>> so the max interpolation time would be kduration*ioverlap*(1/sr), ... I
>> think.
>> (But the idea would perhaps be not to interpolate smoothly all the
>> time, but interpolate quickly to the new set, then hold, ... ?)
>> Now I guess you need another set of tables to hold the two sets of
>> values you interpolate between,
>> say, you copy from tableA to tableB every Nth frame,
>> but I think you also need to copy from tableB to tableC (before the A
>> to B copy), so you have two sets of values to interpolate between.
>> Then you might also need a separate table (D) to hold the result of
>> the interpolation,
>> and let pvsftr read from tableD.
>> ... plenty of opportunities to bang one's head and shoot one's foot I
>> guess, and sorry not to be more verbose on code suggestion.
>>
>> best
>> Oeyvind
>>
>> 2012/6/28 peiman khosravi :
>> > Thanks Oeyvind,
>> >
>> > I did think about that but I can't figure out how to time the
>> > interpolation.
>> >
>> > Best,
>> > Peiman
>> >
>> > On 27 June 2012 23:36, Oeyvind Brandtsegg 
>> > wrote:
>> >>
>> >> Could you perhaps use one of the table morfing opcodes?
>> >> ftmorf, tabmorph, or hvs?
>> >> Haven't really thought about the details, but it seemed like what you
>> >> wanted.
>> >> Oeyvind
>> >>
>> >> 2012/6/27 peiman khosravi :
>> >> > Hello,
>> >> >
>> >> > Below is a csd that samples the pvs frame once every N frames (using
>> >> > pvsftw). Now the question is, would it be possible to cross-fade (or
>> >> > interpolate) between the successive sampled frames?
>> >> >
>> >> >
>> >> > Many thanks
>> >> > Peiman
>> >> >
>> >> >
>> >> >
>> >> > 
>> >> >
>> >> > 
>> >> > -odac -d
>> >> > 
>> >> >
>> >> > 
>> >> > sr = 44100
>> >> > ksmps = 10
>> >> > nchnls = 1
>> >> > 0dbfs  = 1
>> >> >
>> >> > instr 1
>> >> > ifftsize    =        4096
>> >> > ioverlap    =        ifftsize / 4
>> >> > iwinsize    =        ifftsize * 2
>> >> > iwinshape    =        1; von-Hann window
>> >> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >> >
>> >> > ; generate three empty function tables for storing held amplutudes
>> >> > and
>> >> > updated amplitudes
>> >> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> >> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> >> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>> >> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>> >> > iclear    ftgen 0, 0, iNumBins, 2, 0
>> >> >
>> >> > ; Initialise distance / interpolation values
>> >> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> >> > kRange = 100 ; dummy run with interpolation time set to nominal
>> >> > frames
>> >> > kInterpol = 0 ; initialise interpolation/multiplier value
>> >> >
>> >> > ;store a sample in a function table (buffer)
>> >> >     ain1    in ; get audio from external channel 1
>> >> >     ;ain1     inch 1 ; get sound
>> >> >     ;ain1     dcblock ain1; add DC blocking filter
>> >> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize,
>> >> > iwinshape    ;
>> >> > analyse it
>> >> > ;=======================================
>> >> >
>> >> > kduration = 20
>> >> >
>> >> >
>> >> > ksignal init 0
>> >> > kcount init 1 ;initiate this only once ('init' not '=') or else
>> >> > kcount
>> >> > will
>> >> > be reset to 1 on every k-period
>> >> >
>> >> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th
>> >> > etable
>> >> >
>> >> >
>> >> >     if (kflag > 0) then ; only proceed when frame is ready (kflag
>> >> > gives
>> >> > value of 1 when data passes)
>> >> >
>> >> >         kcount = kcount+1 ;for each frame add an increment to kcount
>> >> >
>> >> >         if (kcount>kduration) then ;every 3rd frame...
>> >> >             tablecopy iAmpB, iAmpA
>> >> >             tablecopy iFreqB, iFreqA
>> >> >         kcount = 1 ;reset kcount to 1
>> >> >         endif
>> >> >
>> >> >     endif
>> >> >
>> >> >
>> >> >     pvsftr fsig1, iAmpB, iFreqB
>> >> >     aout1    pvsynth fsig1
>> >> >
>> >> >
>> >> > out aout1
>> >> >
>> >> > endin
>> >> >
>> >> > 
>> >> > 
>> >> > i1 0 30
>> >> > 
>> >> > 
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >> Oeyvind Brandtsegg
>> >> Professor of Music Technology
>> >> NTNU
>> >> 7491 Trondheim
>> >> Norway
>> >> Cell: +47 92 203 205
>> >>
>> >> http://flyndresang.no/
>> >> http://www.partikkelaudio.com/
>> >> http://soundcloud.com/brandtsegg
>> >> http://soundcloud.com/t-emp
>> >>
>> >>
>> >> 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"
>> >>
>> >
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://flyndresang.no/
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://soundcloud.com/t-emp
>>
>>
>> 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"
>>
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


Date2012-06-28 23:45
Frompeiman khosravi
SubjectRe: [Csnd] another pvs question
Oeyvind I just tried using freez and morph and it sort of works but timing is all over the place even with kr==sr. Not sure why but I suspect its to do with frame-rate. I think the only feasible option seems a new opcode really :-(



On 28 June 2012 14:01, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Mmm, maybe if you used pvsfreeze as a "sample and hold" alternatingly,
then pvsmorph between these two?
Oeyvind

2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
> Thanks Oeyvind,
>
> Do you think maybe pvsmorph could be used too?
>
> Sounds like a lot of hassle as you say. Not sure if the final result is
> going to be worth all this effort :-)
>
> A colleague and friend of mine is working on a live piece with bass clarinet
> and started coding this csd, based on some of Wishart's ideas. Maybe it's
> worth going through Wishart's book and listing all the processes that are
> not currently implemented in Csound?
>
> Best,
> P
>
> On 28 June 2012 11:51, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
>>
>> Hm, yeah, interesting,
>> I think you'll have new frames every ioverlap*(1/sr) seconds,
>> so the max interpolation time would be kduration*ioverlap*(1/sr), ... I
>> think.
>> (But the idea would perhaps be not to interpolate smoothly all the
>> time, but interpolate quickly to the new set, then hold, ... ?)
>> Now I guess you need another set of tables to hold the two sets of
>> values you interpolate between,
>> say, you copy from tableA to tableB every Nth frame,
>> but I think you also need to copy from tableB to tableC (before the A
>> to B copy), so you have two sets of values to interpolate between.
>> Then you might also need a separate table (D) to hold the result of
>> the interpolation,
>> and let pvsftr read from tableD.
>> ... plenty of opportunities to bang one's head and shoot one's foot I
>> guess, and sorry not to be more verbose on code suggestion.
>>
>> best
>> Oeyvind
>>
>> 2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
>> > Thanks Oeyvind,
>> >
>> > I did think about that but I can't figure out how to time the
>> > interpolation.
>> >
>> > Best,
>> > Peiman
>> >
>> > On 27 June 2012 23:36, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>
>> > wrote:
>> >>
>> >> Could you perhaps use one of the table morfing opcodes?
>> >> ftmorf, tabmorph, or hvs?
>> >> Haven't really thought about the details, but it seemed like what you
>> >> wanted.
>> >> Oeyvind
>> >>
>> >> 2012/6/27 peiman khosravi <peimankhosravi@gmail.com>:
>> >> > Hello,
>> >> >
>> >> > Below is a csd that samples the pvs frame once every N frames (using
>> >> > pvsftw). Now the question is, would it be possible to cross-fade (or
>> >> > interpolate) between the successive sampled frames?
>> >> >
>> >> >
>> >> > Many thanks
>> >> > Peiman
>> >> >
>> >> >
>> >> >
>> >> > <CsoundSynthesizer>
>> >> >
>> >> > <CsOptions>
>> >> > -odac -d
>> >> > </CsOptions>
>> >> >
>> >> > <CsInstruments>
>> >> > sr = 44100
>> >> > ksmps = 10
>> >> > nchnls = 1
>> >> > 0dbfs  = 1
>> >> >
>> >> > instr 1
>> >> > ifftsize    =        4096
>> >> > ioverlap    =        ifftsize / 4
>> >> > iwinsize    =        ifftsize * 2
>> >> > iwinshape    =        1; von-Hann window
>> >> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >> >
>> >> > ; generate three empty function tables for storing held amplutudes
>> >> > and
>> >> > updated amplitudes
>> >> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> >> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> >> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>> >> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>> >> > iclear    ftgen 0, 0, iNumBins, 2, 0
>> >> >
>> >> > ; Initialise distance / interpolation values
>> >> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> >> > kRange = 100 ; dummy run with interpolation time set to nominal
>> >> > frames
>> >> > kInterpol = 0 ; initialise interpolation/multiplier value
>> >> >
>> >> > ;store a sample in a function table (buffer)
>> >> >     ain1    in ; get audio from external channel 1
>> >> >     ;ain1     inch 1 ; get sound
>> >> >     ;ain1     dcblock ain1; add DC blocking filter
>> >> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize,
>> >> > iwinshape    ;
>> >> > analyse it
>> >> > ;=======================================
>> >> >
>> >> > kduration = 20
>> >> >
>> >> >
>> >> > ksignal init 0
>> >> > kcount init 1 ;initiate this only once ('init' not '=') or else
>> >> > kcount
>> >> > will
>> >> > be reset to 1 on every k-period
>> >> >
>> >> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th
>> >> > etable
>> >> >
>> >> >
>> >> >     if (kflag > 0) then ; only proceed when frame is ready (kflag
>> >> > gives
>> >> > value of 1 when data passes)
>> >> >
>> >> >         kcount = kcount+1 ;for each frame add an increment to kcount
>> >> >
>> >> >         if (kcount>kduration) then ;every 3rd frame...
>> >> >             tablecopy iAmpB, iAmpA
>> >> >             tablecopy iFreqB, iFreqA
>> >> >         kcount = 1 ;reset kcount to 1
>> >> >         endif
>> >> >
>> >> >     endif
>> >> >
>> >> >
>> >> >     pvsftr fsig1, iAmpB, iFreqB
>> >> >     aout1    pvsynth fsig1
>> >> >
>> >> >
>> >> > out aout1
>> >> >
>> >> > endin
>> >> >
>> >> > </CsInstruments>
>> >> > <CsScore>
>> >> > i1 0 30
>> >> > </CsScore>
>> >> > </CsoundSynthesizer>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >> Oeyvind Brandtsegg
>> >> Professor of Music Technology
>> >> NTNU
>> >> 7491 Trondheim
>> >> Norway
>> >> Cell: +47 92 203 205
>> >>
>> >> http://flyndresang.no/
>> >> http://www.partikkelaudio.com/
>> >> http://soundcloud.com/brandtsegg
>> >> http://soundcloud.com/t-emp
>> >>
>> >>
>> >> 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"
>> >>
>> >
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://flyndresang.no/
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://soundcloud.com/t-emp
>>
>>
>> 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"
>>
>



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


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"



Date2012-06-28 23:55
Frompeiman khosravi
SubjectRe: [Csnd] another pvs question
This is what I have.

<CsoundSynthesizer>
<CsOptions>

-odac -d
</CsOptions>
<CsInstruments>

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

instr 1
ifftsize    =        4096
ioverlap    =        ifftsize / 8
iwinsize    =        ifftsize * 2
iwinshape    =        1; von-Hann window
iNumBins    =    (ifftsize/2) + 1; bins used + 1

; generate three empty function tables for storing held amplutudes and updated amplitudes
iAmpA    ftgen 0, 0, iNumBins, 2, 0
iAmpB    ftgen 0, 0, iNumBins, 2, 0
iAmpOut    ftgen 0, 0, iNumBins, 2, 0

; Initialise distance / interpolation values
;ktime chnget "ktime" ; interpolation time/distance in frames

;store a sample in a function table (buffer)
    ain1    diskin2 "/Applications/Max5/examples/sounds/cherokee.aif", 1, 0, 1; get audio from external channel 1
    ;ain1     inch 1 ; get sound
    ;ain1     dcblock ain1; add DC blocking filter
    fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ; analyse it
;=======================================

kfreq linseg 15, 15, 1, p3-10, .5

kphase1    oscil    1, kfreq, 1
kphase2    oscil    1, kfreq, 1, .5

kinterp = (kphase1*.5)+.5

if (kphase1>.9) then
    kfreez1 = 0
else
    kfreez1 = 1
endif

if (kphase2>.9) then
    kfreez2 = 0
else
    kfreez2 = 1
endif

fsig1_freezed pvsfreeze    fsig1, kfreez1, kfreez1
fsig2_freezed pvsfreeze    fsig1, kfreez2, kfreez2

ffinal pvsmorph    fsig1_freezed, fsig2_freezed, kinterp, kinterp

aout pvsynth ffinal

out aout

endin
</CsInstruments>
<CsScore>
f1 0 32768 10 1
i1 0 30
</CsScore>
</CsoundSynthesizer>


On 28 June 2012 23:45, peiman khosravi <peimankhosravi@gmail.com> wrote:
Oeyvind I just tried using freez and morph and it sort of works but timing is all over the place even with kr==sr. Not sure why but I suspect its to do with frame-rate. I think the only feasible option seems a new opcode really :-(



On 28 June 2012 14:01, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Mmm, maybe if you used pvsfreeze as a "sample and hold" alternatingly,
then pvsmorph between these two?
Oeyvind

2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
> Thanks Oeyvind,
>
> Do you think maybe pvsmorph could be used too?
>
> Sounds like a lot of hassle as you say. Not sure if the final result is
> going to be worth all this effort :-)
>
> A colleague and friend of mine is working on a live piece with bass clarinet
> and started coding this csd, based on some of Wishart's ideas. Maybe it's
> worth going through Wishart's book and listing all the processes that are
> not currently implemented in Csound?
>
> Best,
> P
>
> On 28 June 2012 11:51, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
>>
>> Hm, yeah, interesting,
>> I think you'll have new frames every ioverlap*(1/sr) seconds,
>> so the max interpolation time would be kduration*ioverlap*(1/sr), ... I
>> think.
>> (But the idea would perhaps be not to interpolate smoothly all the
>> time, but interpolate quickly to the new set, then hold, ... ?)
>> Now I guess you need another set of tables to hold the two sets of
>> values you interpolate between,
>> say, you copy from tableA to tableB every Nth frame,
>> but I think you also need to copy from tableB to tableC (before the A
>> to B copy), so you have two sets of values to interpolate between.
>> Then you might also need a separate table (D) to hold the result of
>> the interpolation,
>> and let pvsftr read from tableD.
>> ... plenty of opportunities to bang one's head and shoot one's foot I
>> guess, and sorry not to be more verbose on code suggestion.
>>
>> best
>> Oeyvind
>>
>> 2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
>> > Thanks Oeyvind,
>> >
>> > I did think about that but I can't figure out how to time the
>> > interpolation.
>> >
>> > Best,
>> > Peiman
>> >
>> > On 27 June 2012 23:36, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>
>> > wrote:
>> >>
>> >> Could you perhaps use one of the table morfing opcodes?
>> >> ftmorf, tabmorph, or hvs?
>> >> Haven't really thought about the details, but it seemed like what you
>> >> wanted.
>> >> Oeyvind
>> >>
>> >> 2012/6/27 peiman khosravi <peimankhosravi@gmail.com>:
>> >> > Hello,
>> >> >
>> >> > Below is a csd that samples the pvs frame once every N frames (using
>> >> > pvsftw). Now the question is, would it be possible to cross-fade (or
>> >> > interpolate) between the successive sampled frames?
>> >> >
>> >> >
>> >> > Many thanks
>> >> > Peiman
>> >> >
>> >> >
>> >> >
>> >> > <CsoundSynthesizer>
>> >> >
>> >> > <CsOptions>
>> >> > -odac -d
>> >> > </CsOptions>
>> >> >
>> >> > <CsInstruments>
>> >> > sr = 44100
>> >> > ksmps = 10
>> >> > nchnls = 1
>> >> > 0dbfs  = 1
>> >> >
>> >> > instr 1
>> >> > ifftsize    =        4096
>> >> > ioverlap    =        ifftsize / 4
>> >> > iwinsize    =        ifftsize * 2
>> >> > iwinshape    =        1; von-Hann window
>> >> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >> >
>> >> > ; generate three empty function tables for storing held amplutudes
>> >> > and
>> >> > updated amplitudes
>> >> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> >> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> >> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>> >> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>> >> > iclear    ftgen 0, 0, iNumBins, 2, 0
>> >> >
>> >> > ; Initialise distance / interpolation values
>> >> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> >> > kRange = 100 ; dummy run with interpolation time set to nominal
>> >> > frames
>> >> > kInterpol = 0 ; initialise interpolation/multiplier value
>> >> >
>> >> > ;store a sample in a function table (buffer)
>> >> >     ain1    in ; get audio from external channel 1
>> >> >     ;ain1     inch 1 ; get sound
>> >> >     ;ain1     dcblock ain1; add DC blocking filter
>> >> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize,
>> >> > iwinshape    ;
>> >> > analyse it
>> >> > ;=======================================
>> >> >
>> >> > kduration = 20
>> >> >
>> >> >
>> >> > ksignal init 0
>> >> > kcount init 1 ;initiate this only once ('init' not '=') or else
>> >> > kcount
>> >> > will
>> >> > be reset to 1 on every k-period
>> >> >
>> >> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in th
>> >> > etable
>> >> >
>> >> >
>> >> >     if (kflag > 0) then ; only proceed when frame is ready (kflag
>> >> > gives
>> >> > value of 1 when data passes)
>> >> >
>> >> >         kcount = kcount+1 ;for each frame add an increment to kcount
>> >> >
>> >> >         if (kcount>kduration) then ;every 3rd frame...
>> >> >             tablecopy iAmpB, iAmpA
>> >> >             tablecopy iFreqB, iFreqA
>> >> >         kcount = 1 ;reset kcount to 1
>> >> >         endif
>> >> >
>> >> >     endif
>> >> >
>> >> >
>> >> >     pvsftr fsig1, iAmpB, iFreqB
>> >> >     aout1    pvsynth fsig1
>> >> >
>> >> >
>> >> > out aout1
>> >> >
>> >> > endin
>> >> >
>> >> > </CsInstruments>
>> >> > <CsScore>
>> >> > i1 0 30
>> >> > </CsScore>
>> >> > </CsoundSynthesizer>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >> Oeyvind Brandtsegg
>> >> Professor of Music Technology
>> >> NTNU
>> >> 7491 Trondheim
>> >> Norway
>> >> Cell: +47 92 203 205
>> >>
>> >> http://flyndresang.no/
>> >> http://www.partikkelaudio.com/
>> >> http://soundcloud.com/brandtsegg
>> >> http://soundcloud.com/t-emp
>> >>
>> >>
>> >> 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"
>> >>
>> >
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://flyndresang.no/
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://soundcloud.com/t-emp
>>
>>
>> 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"
>>
>



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


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"




Date2012-06-29 00:48
FromOeyvind Brandtsegg
SubjectRe: [Csnd] another pvs question
I think it sounds beautiful, what timing is off? (and where should it
have been?) :-)
Thanks by the way, nice effect, ... transision to dream state... hehe
Oeyvind

2012/6/29 peiman khosravi :
> This is what I have.
>
>
> 
> 
>
> -odac -d
> 
> 
>
> sr = 44100
> ksmps = 1
> nchnls = 1
> 0dbfs  = 1
>
> instr 1
> ifftsize    =        4096
> ioverlap    =        ifftsize / 8
> iwinsize    =        ifftsize * 2
> iwinshape    =        1; von-Hann window
> iNumBins    =    (ifftsize/2) + 1; bins used + 1
>
> ; generate three empty function tables for storing held amplutudes and
> updated amplitudes
> iAmpA    ftgen 0, 0, iNumBins, 2, 0
> iAmpB    ftgen 0, 0, iNumBins, 2, 0
> iAmpOut    ftgen 0, 0, iNumBins, 2, 0
>
>
> ; Initialise distance / interpolation values
> ;ktime chnget "ktime" ; interpolation time/distance in frames
>
> ;store a sample in a function table (buffer)
>     ain1    diskin2 "/Applications/Max5/examples/sounds/cherokee.aif", 1, 0,
> 1; get audio from external channel 1
>
>     ;ain1     inch 1 ; get sound
>     ;ain1     dcblock ain1; add DC blocking filter
>     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
> analyse it
> ;=======================================
>
> kfreq linseg 15, 15, 1, p3-10, .5
>
> kphase1    oscil    1, kfreq, 1
> kphase2    oscil    1, kfreq, 1, .5
>
> kinterp = (kphase1*.5)+.5
>
> if (kphase1>.9) then
>     kfreez1 = 0
> else
>     kfreez1 = 1
> endif
>
> if (kphase2>.9) then
>     kfreez2 = 0
> else
>     kfreez2 = 1
> endif
>
> fsig1_freezed pvsfreeze    fsig1, kfreez1, kfreez1
> fsig2_freezed pvsfreeze    fsig1, kfreez2, kfreez2
>
> ffinal pvsmorph    fsig1_freezed, fsig2_freezed, kinterp, kinterp
>
> aout pvsynth ffinal
>
> out aout
>
> endin
> 
> 
> f1 0 32768 10 1
>
> i1 0 30
> 
> 
>
>
> On 28 June 2012 23:45, peiman khosravi  wrote:
>>
>> Oeyvind I just tried using freez and morph and it sort of works but timing
>> is all over the place even with kr==sr. Not sure why but I suspect its to do
>> with frame-rate. I think the only feasible option seems a new opcode really
>> :-(
>>
>> P
>>
>> On 28 June 2012 14:01, Oeyvind Brandtsegg 
>> wrote:
>>>
>>> Mmm, maybe if you used pvsfreeze as a "sample and hold" alternatingly,
>>> then pvsmorph between these two?
>>> Oeyvind
>>>
>>> 2012/6/28 peiman khosravi :
>>> > Thanks Oeyvind,
>>> >
>>> > Do you think maybe pvsmorph could be used too?
>>> >
>>> > Sounds like a lot of hassle as you say. Not sure if the final result is
>>> > going to be worth all this effort :-)
>>> >
>>> > A colleague and friend of mine is working on a live piece with bass
>>> > clarinet
>>> > and started coding this csd, based on some of Wishart's ideas. Maybe
>>> > it's
>>> > worth going through Wishart's book and listing all the processes that
>>> > are
>>> > not currently implemented in Csound?
>>> >
>>> > Best,
>>> > P
>>> >
>>> > On 28 June 2012 11:51, Oeyvind Brandtsegg 
>>> > wrote:
>>> >>
>>> >> Hm, yeah, interesting,
>>> >> I think you'll have new frames every ioverlap*(1/sr) seconds,
>>> >> so the max interpolation time would be kduration*ioverlap*(1/sr), ...
>>> >> I
>>> >> think.
>>> >> (But the idea would perhaps be not to interpolate smoothly all the
>>> >> time, but interpolate quickly to the new set, then hold, ... ?)
>>> >> Now I guess you need another set of tables to hold the two sets of
>>> >> values you interpolate between,
>>> >> say, you copy from tableA to tableB every Nth frame,
>>> >> but I think you also need to copy from tableB to tableC (before the A
>>> >> to B copy), so you have two sets of values to interpolate between.
>>> >> Then you might also need a separate table (D) to hold the result of
>>> >> the interpolation,
>>> >> and let pvsftr read from tableD.
>>> >> ... plenty of opportunities to bang one's head and shoot one's foot I
>>> >> guess, and sorry not to be more verbose on code suggestion.
>>> >>
>>> >> best
>>> >> Oeyvind
>>> >>
>>> >> 2012/6/28 peiman khosravi :
>>> >> > Thanks Oeyvind,
>>> >> >
>>> >> > I did think about that but I can't figure out how to time the
>>> >> > interpolation.
>>> >> >
>>> >> > Best,
>>> >> > Peiman
>>> >> >
>>> >> > On 27 June 2012 23:36, Oeyvind Brandtsegg
>>> >> > 
>>> >> > wrote:
>>> >> >>
>>> >> >> Could you perhaps use one of the table morfing opcodes?
>>> >> >> ftmorf, tabmorph, or hvs?
>>> >> >> Haven't really thought about the details, but it seemed like what
>>> >> >> you
>>> >> >> wanted.
>>> >> >> Oeyvind
>>> >> >>
>>> >> >> 2012/6/27 peiman khosravi :
>>> >> >> > Hello,
>>> >> >> >
>>> >> >> > Below is a csd that samples the pvs frame once every N frames
>>> >> >> > (using
>>> >> >> > pvsftw). Now the question is, would it be possible to cross-fade
>>> >> >> > (or
>>> >> >> > interpolate) between the successive sampled frames?
>>> >> >> >
>>> >> >> >
>>> >> >> > Many thanks
>>> >> >> > Peiman
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> > 
>>> >> >> >
>>> >> >> > 
>>> >> >> > -odac -d
>>> >> >> > 
>>> >> >> >
>>> >> >> > 
>>> >> >> > sr = 44100
>>> >> >> > ksmps = 10
>>> >> >> > nchnls = 1
>>> >> >> > 0dbfs  = 1
>>> >> >> >
>>> >> >> > instr 1
>>> >> >> > ifftsize    =        4096
>>> >> >> > ioverlap    =        ifftsize / 4
>>> >> >> > iwinsize    =        ifftsize * 2
>>> >> >> > iwinshape    =        1; von-Hann window
>>> >> >> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>>> >> >> >
>>> >> >> > ; generate three empty function tables for storing held
>>> >> >> > amplutudes
>>> >> >> > and
>>> >> >> > updated amplitudes
>>> >> >> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iclear    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> >
>>> >> >> > ; Initialise distance / interpolation values
>>> >> >> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>>> >> >> > kRange = 100 ; dummy run with interpolation time set to nominal
>>> >> >> > frames
>>> >> >> > kInterpol = 0 ; initialise interpolation/multiplier value
>>> >> >> >
>>> >> >> > ;store a sample in a function table (buffer)
>>> >> >> >     ain1    in ; get audio from external channel 1
>>> >> >> >     ;ain1     inch 1 ; get sound
>>> >> >> >     ;ain1     dcblock ain1; add DC blocking filter
>>> >> >> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize,
>>> >> >> > iwinshape    ;
>>> >> >> > analyse it
>>> >> >> > ;=======================================
>>> >> >> >
>>> >> >> > kduration = 20
>>> >> >> >
>>> >> >> >
>>> >> >> > ksignal init 0
>>> >> >> > kcount init 1 ;initiate this only once ('init' not '=') or else
>>> >> >> > kcount
>>> >> >> > will
>>> >> >> > be reset to 1 on every k-period
>>> >> >> >
>>> >> >> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in
>>> >> >> > th
>>> >> >> > etable
>>> >> >> >
>>> >> >> >
>>> >> >> >     if (kflag > 0) then ; only proceed when frame is ready (kflag
>>> >> >> > gives
>>> >> >> > value of 1 when data passes)
>>> >> >> >
>>> >> >> >         kcount = kcount+1 ;for each frame add an increment to
>>> >> >> > kcount
>>> >> >> >
>>> >> >> >         if (kcount>kduration) then ;every 3rd frame...
>>> >> >> >             tablecopy iAmpB, iAmpA
>>> >> >> >             tablecopy iFreqB, iFreqA
>>> >> >> >         kcount = 1 ;reset kcount to 1
>>> >> >> >         endif
>>> >> >> >
>>> >> >> >     endif
>>> >> >> >
>>> >> >> >
>>> >> >> >     pvsftr fsig1, iAmpB, iFreqB
>>> >> >> >     aout1    pvsynth fsig1
>>> >> >> >
>>> >> >> >
>>> >> >> > out aout1
>>> >> >> >
>>> >> >> > endin
>>> >> >> >
>>> >> >> > 
>>> >> >> > 
>>> >> >> > i1 0 30
>>> >> >> > 
>>> >> >> > 
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >>
>>> >> >> Oeyvind Brandtsegg
>>> >> >> Professor of Music Technology
>>> >> >> NTNU
>>> >> >> 7491 Trondheim
>>> >> >> Norway
>>> >> >> Cell: +47 92 203 205
>>> >> >>
>>> >> >> http://flyndresang.no/
>>> >> >> http://www.partikkelaudio.com/
>>> >> >> http://soundcloud.com/brandtsegg
>>> >> >> http://soundcloud.com/t-emp
>>> >> >>
>>> >> >>
>>> >> >> 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"
>>> >> >>
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>
>>> >> Oeyvind Brandtsegg
>>> >> Professor of Music Technology
>>> >> NTNU
>>> >> 7491 Trondheim
>>> >> Norway
>>> >> Cell: +47 92 203 205
>>> >>
>>> >> http://flyndresang.no/
>>> >> http://www.partikkelaudio.com/
>>> >> http://soundcloud.com/brandtsegg
>>> >> http://soundcloud.com/t-emp
>>> >>
>>> >>
>>> >> 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"
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>>
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>>
>>> http://flyndresang.no/
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://soundcloud.com/t-emp
>>>
>>>
>>> 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"
>>>
>>
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


Date2012-06-29 00:51
Frompeiman khosravi
SubjectRe: [Csnd] another pvs question

If you increase the frequency then it starts to stutter, which is nice but not the expected result!

Cheers
P

On 29 June 2012 00:48, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
I think it sounds beautiful, what timing is off? (and where should it
have been?) :-)
Thanks by the way, nice effect, ... transision to dream state... hehe
Oeyvind

2012/6/29 peiman khosravi <peimankhosravi@gmail.com>:
> This is what I have.
>
>
> <CsoundSynthesizer>
> <CsOptions>
>
> -odac -d
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 1
> nchnls = 1
> 0dbfs  = 1
>
> instr 1
> ifftsize    =        4096
> ioverlap    =        ifftsize / 8
> iwinsize    =        ifftsize * 2
> iwinshape    =        1; von-Hann window
> iNumBins    =    (ifftsize/2) + 1; bins used + 1
>
> ; generate three empty function tables for storing held amplutudes and
> updated amplitudes
> iAmpA    ftgen 0, 0, iNumBins, 2, 0
> iAmpB    ftgen 0, 0, iNumBins, 2, 0
> iAmpOut    ftgen 0, 0, iNumBins, 2, 0
>
>
> ; Initialise distance / interpolation values
> ;ktime chnget "ktime" ; interpolation time/distance in frames
>
> ;store a sample in a function table (buffer)
>     ain1    diskin2 "/Applications/Max5/examples/sounds/cherokee.aif", 1, 0,
> 1; get audio from external channel 1
>
>     ;ain1     inch 1 ; get sound
>     ;ain1     dcblock ain1; add DC blocking filter
>     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
> analyse it
> ;=======================================
>
> kfreq linseg 15, 15, 1, p3-10, .5
>
> kphase1    oscil    1, kfreq, 1
> kphase2    oscil    1, kfreq, 1, .5
>
> kinterp = (kphase1*.5)+.5
>
> if (kphase1>.9) then
>     kfreez1 = 0
> else
>     kfreez1 = 1
> endif
>
> if (kphase2>.9) then
>     kfreez2 = 0
> else
>     kfreez2 = 1
> endif
>
> fsig1_freezed pvsfreeze    fsig1, kfreez1, kfreez1
> fsig2_freezed pvsfreeze    fsig1, kfreez2, kfreez2
>
> ffinal pvsmorph    fsig1_freezed, fsig2_freezed, kinterp, kinterp
>
> aout pvsynth ffinal
>
> out aout
>
> endin
> </CsInstruments>
> <CsScore>
> f1 0 32768 10 1
>
> i1 0 30
> </CsScore>
> </CsoundSynthesizer>
>
>
> On 28 June 2012 23:45, peiman khosravi <peimankhosravi@gmail.com> wrote:
>>
>> Oeyvind I just tried using freez and morph and it sort of works but timing
>> is all over the place even with kr==sr. Not sure why but I suspect its to do
>> with frame-rate. I think the only feasible option seems a new opcode really
>> :-(
>>
>> P
>>
>> On 28 June 2012 14:01, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>
>> wrote:
>>>
>>> Mmm, maybe if you used pvsfreeze as a "sample and hold" alternatingly,
>>> then pvsmorph between these two?
>>> Oeyvind
>>>
>>> 2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
>>> > Thanks Oeyvind,
>>> >
>>> > Do you think maybe pvsmorph could be used too?
>>> >
>>> > Sounds like a lot of hassle as you say. Not sure if the final result is
>>> > going to be worth all this effort :-)
>>> >
>>> > A colleague and friend of mine is working on a live piece with bass
>>> > clarinet
>>> > and started coding this csd, based on some of Wishart's ideas. Maybe
>>> > it's
>>> > worth going through Wishart's book and listing all the processes that
>>> > are
>>> > not currently implemented in Csound?
>>> >
>>> > Best,
>>> > P
>>> >
>>> > On 28 June 2012 11:51, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>
>>> > wrote:
>>> >>
>>> >> Hm, yeah, interesting,
>>> >> I think you'll have new frames every ioverlap*(1/sr) seconds,
>>> >> so the max interpolation time would be kduration*ioverlap*(1/sr), ...
>>> >> I
>>> >> think.
>>> >> (But the idea would perhaps be not to interpolate smoothly all the
>>> >> time, but interpolate quickly to the new set, then hold, ... ?)
>>> >> Now I guess you need another set of tables to hold the two sets of
>>> >> values you interpolate between,
>>> >> say, you copy from tableA to tableB every Nth frame,
>>> >> but I think you also need to copy from tableB to tableC (before the A
>>> >> to B copy), so you have two sets of values to interpolate between.
>>> >> Then you might also need a separate table (D) to hold the result of
>>> >> the interpolation,
>>> >> and let pvsftr read from tableD.
>>> >> ... plenty of opportunities to bang one's head and shoot one's foot I
>>> >> guess, and sorry not to be more verbose on code suggestion.
>>> >>
>>> >> best
>>> >> Oeyvind
>>> >>
>>> >> 2012/6/28 peiman khosravi <peimankhosravi@gmail.com>:
>>> >> > Thanks Oeyvind,
>>> >> >
>>> >> > I did think about that but I can't figure out how to time the
>>> >> > interpolation.
>>> >> >
>>> >> > Best,
>>> >> > Peiman
>>> >> >
>>> >> > On 27 June 2012 23:36, Oeyvind Brandtsegg
>>> >> > <oyvind.brandtsegg@ntnu.no>
>>> >> > wrote:
>>> >> >>
>>> >> >> Could you perhaps use one of the table morfing opcodes?
>>> >> >> ftmorf, tabmorph, or hvs?
>>> >> >> Haven't really thought about the details, but it seemed like what
>>> >> >> you
>>> >> >> wanted.
>>> >> >> Oeyvind
>>> >> >>
>>> >> >> 2012/6/27 peiman khosravi <peimankhosravi@gmail.com>:
>>> >> >> > Hello,
>>> >> >> >
>>> >> >> > Below is a csd that samples the pvs frame once every N frames
>>> >> >> > (using
>>> >> >> > pvsftw). Now the question is, would it be possible to cross-fade
>>> >> >> > (or
>>> >> >> > interpolate) between the successive sampled frames?
>>> >> >> >
>>> >> >> >
>>> >> >> > Many thanks
>>> >> >> > Peiman
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> > <CsoundSynthesizer>
>>> >> >> >
>>> >> >> > <CsOptions>
>>> >> >> > -odac -d
>>> >> >> > </CsOptions>
>>> >> >> >
>>> >> >> > <CsInstruments>
>>> >> >> > sr = 44100
>>> >> >> > ksmps = 10
>>> >> >> > nchnls = 1
>>> >> >> > 0dbfs  = 1
>>> >> >> >
>>> >> >> > instr 1
>>> >> >> > ifftsize    =        4096
>>> >> >> > ioverlap    =        ifftsize / 4
>>> >> >> > iwinsize    =        ifftsize * 2
>>> >> >> > iwinshape    =        1; von-Hann window
>>> >> >> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>>> >> >> >
>>> >> >> > ; generate three empty function tables for storing held
>>> >> >> > amplutudes
>>> >> >> > and
>>> >> >> > updated amplitudes
>>> >> >> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> > iclear    ftgen 0, 0, iNumBins, 2, 0
>>> >> >> >
>>> >> >> > ; Initialise distance / interpolation values
>>> >> >> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>>> >> >> > kRange = 100 ; dummy run with interpolation time set to nominal
>>> >> >> > frames
>>> >> >> > kInterpol = 0 ; initialise interpolation/multiplier value
>>> >> >> >
>>> >> >> > ;store a sample in a function table (buffer)
>>> >> >> >     ain1    in ; get audio from external channel 1
>>> >> >> >     ;ain1     inch 1 ; get sound
>>> >> >> >     ;ain1     dcblock ain1; add DC blocking filter
>>> >> >> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize,
>>> >> >> > iwinshape    ;
>>> >> >> > analyse it
>>> >> >> > ;=======================================
>>> >> >> >
>>> >> >> > kduration = 20
>>> >> >> >
>>> >> >> >
>>> >> >> > ksignal init 0
>>> >> >> > kcount init 1 ;initiate this only once ('init' not '=') or else
>>> >> >> > kcount
>>> >> >> > will
>>> >> >> > be reset to 1 on every k-period
>>> >> >> >
>>> >> >> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data in
>>> >> >> > th
>>> >> >> > etable
>>> >> >> >
>>> >> >> >
>>> >> >> >     if (kflag > 0) then ; only proceed when frame is ready (kflag
>>> >> >> > gives
>>> >> >> > value of 1 when data passes)
>>> >> >> >
>>> >> >> >         kcount = kcount+1 ;for each frame add an increment to
>>> >> >> > kcount
>>> >> >> >
>>> >> >> >         if (kcount>kduration) then ;every 3rd frame...
>>> >> >> >             tablecopy iAmpB, iAmpA
>>> >> >> >             tablecopy iFreqB, iFreqA
>>> >> >> >         kcount = 1 ;reset kcount to 1
>>> >> >> >         endif
>>> >> >> >
>>> >> >> >     endif
>>> >> >> >
>>> >> >> >
>>> >> >> >     pvsftr fsig1, iAmpB, iFreqB
>>> >> >> >     aout1    pvsynth fsig1
>>> >> >> >
>>> >> >> >
>>> >> >> > out aout1
>>> >> >> >
>>> >> >> > endin
>>> >> >> >
>>> >> >> > </CsInstruments>
>>> >> >> > <CsScore>
>>> >> >> > i1 0 30
>>> >> >> > </CsScore>
>>> >> >> > </CsoundSynthesizer>
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >>
>>> >> >> Oeyvind Brandtsegg
>>> >> >> Professor of Music Technology
>>> >> >> NTNU
>>> >> >> 7491 Trondheim
>>> >> >> Norway
>>> >> >> Cell: +47 92 203 205
>>> >> >>
>>> >> >> http://flyndresang.no/
>>> >> >> http://www.partikkelaudio.com/
>>> >> >> http://soundcloud.com/brandtsegg
>>> >> >> http://soundcloud.com/t-emp
>>> >> >>
>>> >> >>
>>> >> >> 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"
>>> >> >>
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>
>>> >> Oeyvind Brandtsegg
>>> >> Professor of Music Technology
>>> >> NTNU
>>> >> 7491 Trondheim
>>> >> Norway
>>> >> Cell: +47 92 203 205
>>> >>
>>> >> http://flyndresang.no/
>>> >> http://www.partikkelaudio.com/
>>> >> http://soundcloud.com/brandtsegg
>>> >> http://soundcloud.com/t-emp
>>> >>
>>> >>
>>> >> 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"
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>>
>>> Oeyvind Brandtsegg
>>> Professor of Music Technology
>>> NTNU
>>> 7491 Trondheim
>>> Norway
>>> Cell: +47 92 203 205
>>>
>>> http://flyndresang.no/
>>> http://www.partikkelaudio.com/
>>> http://soundcloud.com/brandtsegg
>>> http://soundcloud.com/t-emp
>>>
>>>
>>> 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"
>>>
>>
>



--

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


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"



Date2012-06-29 11:58
FromTito Latini
SubjectRe: [Csnd] another pvs question
AttachmentsNone  

Date2012-06-29 11:58
FromOeyvind Brandtsegg
SubjectRe: [Csnd] another pvs question
Ah, now I hear it, I first tested with material that did not have so
prominent transients.

It seems the max interpolaton frequency is related to the fft
parameters, as one could expect.
With an overlap of 512 samples as you use here, you should get new fft
frames at a rate of approximately 86 Hz (at sr=44100),
now with emprirical testing, it seems that the "stutter breakup
threshold" appears at an interpolation rate of 10 to 11 Hz,
suggesting that the fft freezing and interpolation procedure needs at
least 8 fft frames for a complete cycle (freeze A, interpolate, freeze
B, interpolate),
as it  breaks up intermittently at 11 Hz but seems ok at 10 Hz. Every
8th frame with the above setting gives a frequency of 10.7 Hz.
Changing the fft overlap affects the "stutter breakup threshold", eg
setting it to 256, would move this point to 21.5 Hz.
... I'm no expert in these matters so all of the above is mostly
"educated guess", pvs authors please chime in.

best
Oeyvind

2012/6/29 peiman khosravi :
>
> If you increase the frequency then it starts to stutter, which is nice but
> not the expected result!
>
> Cheers
> P
>
> On 29 June 2012 00:48, Oeyvind Brandtsegg  wrote:
>>
>> I think it sounds beautiful, what timing is off? (and where should it
>> have been?) :-)
>> Thanks by the way, nice effect, ... transision to dream state... hehe
>> Oeyvind
>>
>> 2012/6/29 peiman khosravi :
>> > This is what I have.
>> >
>> >
>> > 
>> > 
>> >
>> > -odac -d
>> > 
>> > 
>> >
>> > sr = 44100
>> > ksmps = 1
>> > nchnls = 1
>> > 0dbfs  = 1
>> >
>> > instr 1
>> > ifftsize    =        4096
>> > ioverlap    =        ifftsize / 8
>> > iwinsize    =        ifftsize * 2
>> > iwinshape    =        1; von-Hann window
>> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >
>> > ; generate three empty function tables for storing held amplutudes and
>> > updated amplitudes
>> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> > iAmpOut    ftgen 0, 0, iNumBins, 2, 0
>> >
>> >
>> > ; Initialise distance / interpolation values
>> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> >
>> > ;store a sample in a function table (buffer)
>> >     ain1    diskin2 "/Applications/Max5/examples/sounds/cherokee.aif",
>> > 1, 0,
>> > 1; get audio from external channel 1
>> >
>> >     ;ain1     inch 1 ; get sound
>> >     ;ain1     dcblock ain1; add DC blocking filter
>> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape    ;
>> > analyse it
>> > ;=======================================
>> >
>> > kfreq linseg 15, 15, 1, p3-10, .5
>> >
>> > kphase1    oscil    1, kfreq, 1
>> > kphase2    oscil    1, kfreq, 1, .5
>> >
>> > kinterp = (kphase1*.5)+.5
>> >
>> > if (kphase1>.9) then
>> >     kfreez1 = 0
>> > else
>> >     kfreez1 = 1
>> > endif
>> >
>> > if (kphase2>.9) then
>> >     kfreez2 = 0
>> > else
>> >     kfreez2 = 1
>> > endif
>> >
>> > fsig1_freezed pvsfreeze    fsig1, kfreez1, kfreez1
>> > fsig2_freezed pvsfreeze    fsig1, kfreez2, kfreez2
>> >
>> > ffinal pvsmorph    fsig1_freezed, fsig2_freezed, kinterp, kinterp
>> >
>> > aout pvsynth ffinal
>> >
>> > out aout
>> >
>> > endin
>> > 
>> > 
>> > f1 0 32768 10 1
>> >
>> > i1 0 30
>> > 
>> > 
>> >
>> >
>> > On 28 June 2012 23:45, peiman khosravi  wrote:
>> >>
>> >> Oeyvind I just tried using freez and morph and it sort of works but
>> >> timing
>> >> is all over the place even with kr==sr. Not sure why but I suspect its
>> >> to do
>> >> with frame-rate. I think the only feasible option seems a new opcode
>> >> really
>> >> :-(
>> >>
>> >> P
>> >>
>> >> On 28 June 2012 14:01, Oeyvind Brandtsegg 
>> >> wrote:
>> >>>
>> >>> Mmm, maybe if you used pvsfreeze as a "sample and hold" alternatingly,
>> >>> then pvsmorph between these two?
>> >>> Oeyvind
>> >>>
>> >>> 2012/6/28 peiman khosravi :
>> >>> > Thanks Oeyvind,
>> >>> >
>> >>> > Do you think maybe pvsmorph could be used too?
>> >>> >
>> >>> > Sounds like a lot of hassle as you say. Not sure if the final result
>> >>> > is
>> >>> > going to be worth all this effort :-)
>> >>> >
>> >>> > A colleague and friend of mine is working on a live piece with bass
>> >>> > clarinet
>> >>> > and started coding this csd, based on some of Wishart's ideas. Maybe
>> >>> > it's
>> >>> > worth going through Wishart's book and listing all the processes
>> >>> > that
>> >>> > are
>> >>> > not currently implemented in Csound?
>> >>> >
>> >>> > Best,
>> >>> > P
>> >>> >
>> >>> > On 28 June 2012 11:51, Oeyvind Brandtsegg
>> >>> > 
>> >>> > wrote:
>> >>> >>
>> >>> >> Hm, yeah, interesting,
>> >>> >> I think you'll have new frames every ioverlap*(1/sr) seconds,
>> >>> >> so the max interpolation time would be kduration*ioverlap*(1/sr),
>> >>> >> ...
>> >>> >> I
>> >>> >> think.
>> >>> >> (But the idea would perhaps be not to interpolate smoothly all the
>> >>> >> time, but interpolate quickly to the new set, then hold, ... ?)
>> >>> >> Now I guess you need another set of tables to hold the two sets of
>> >>> >> values you interpolate between,
>> >>> >> say, you copy from tableA to tableB every Nth frame,
>> >>> >> but I think you also need to copy from tableB to tableC (before the
>> >>> >> A
>> >>> >> to B copy), so you have two sets of values to interpolate between.
>> >>> >> Then you might also need a separate table (D) to hold the result of
>> >>> >> the interpolation,
>> >>> >> and let pvsftr read from tableD.
>> >>> >> ... plenty of opportunities to bang one's head and shoot one's foot
>> >>> >> I
>> >>> >> guess, and sorry not to be more verbose on code suggestion.
>> >>> >>
>> >>> >> best
>> >>> >> Oeyvind
>> >>> >>
>> >>> >> 2012/6/28 peiman khosravi :
>> >>> >> > Thanks Oeyvind,
>> >>> >> >
>> >>> >> > I did think about that but I can't figure out how to time the
>> >>> >> > interpolation.
>> >>> >> >
>> >>> >> > Best,
>> >>> >> > Peiman
>> >>> >> >
>> >>> >> > On 27 June 2012 23:36, Oeyvind Brandtsegg
>> >>> >> > 
>> >>> >> > wrote:
>> >>> >> >>
>> >>> >> >> Could you perhaps use one of the table morfing opcodes?
>> >>> >> >> ftmorf, tabmorph, or hvs?
>> >>> >> >> Haven't really thought about the details, but it seemed like
>> >>> >> >> what
>> >>> >> >> you
>> >>> >> >> wanted.
>> >>> >> >> Oeyvind
>> >>> >> >>
>> >>> >> >> 2012/6/27 peiman khosravi :
>> >>> >> >> > Hello,
>> >>> >> >> >
>> >>> >> >> > Below is a csd that samples the pvs frame once every N frames
>> >>> >> >> > (using
>> >>> >> >> > pvsftw). Now the question is, would it be possible to
>> >>> >> >> > cross-fade
>> >>> >> >> > (or
>> >>> >> >> > interpolate) between the successive sampled frames?
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> > Many thanks
>> >>> >> >> > Peiman
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> > 
>> >>> >> >> >
>> >>> >> >> > 
>> >>> >> >> > -odac -d
>> >>> >> >> > 
>> >>> >> >> >
>> >>> >> >> > 
>> >>> >> >> > sr = 44100
>> >>> >> >> > ksmps = 10
>> >>> >> >> > nchnls = 1
>> >>> >> >> > 0dbfs  = 1
>> >>> >> >> >
>> >>> >> >> > instr 1
>> >>> >> >> > ifftsize    =        4096
>> >>> >> >> > ioverlap    =        ifftsize / 4
>> >>> >> >> > iwinsize    =        ifftsize * 2
>> >>> >> >> > iwinshape    =        1; von-Hann window
>> >>> >> >> > iNumBins    =    (ifftsize/2) + 1; bins used + 1
>> >>> >> >> >
>> >>> >> >> > ; generate three empty function tables for storing held
>> >>> >> >> > amplutudes
>> >>> >> >> > and
>> >>> >> >> > updated amplitudes
>> >>> >> >> > iAmpA    ftgen 0, 0, iNumBins, 2, 0
>> >>> >> >> > iAmpB    ftgen 0, 0, iNumBins, 2, 0
>> >>> >> >> > iFreqA    ftgen 0, 0, iNumBins, 2, 0
>> >>> >> >> > iFreqB    ftgen 0, 0, iNumBins, 2, 0
>> >>> >> >> > iclear    ftgen 0, 0, iNumBins, 2, 0
>> >>> >> >> >
>> >>> >> >> > ; Initialise distance / interpolation values
>> >>> >> >> > ;ktime chnget "ktime" ; interpolation time/distance in frames
>> >>> >> >> > kRange = 100 ; dummy run with interpolation time set to
>> >>> >> >> > nominal
>> >>> >> >> > frames
>> >>> >> >> > kInterpol = 0 ; initialise interpolation/multiplier value
>> >>> >> >> >
>> >>> >> >> > ;store a sample in a function table (buffer)
>> >>> >> >> >     ain1    in ; get audio from external channel 1
>> >>> >> >> >     ;ain1     inch 1 ; get sound
>> >>> >> >> >     ;ain1     dcblock ain1; add DC blocking filter
>> >>> >> >> >     fsig1     pvsanal ain1, ifftsize, ioverlap, iwinsize,
>> >>> >> >> > iwinshape    ;
>> >>> >> >> > analyse it
>> >>> >> >> > ;=======================================
>> >>> >> >> >
>> >>> >> >> > kduration = 20
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> > ksignal init 0
>> >>> >> >> > kcount init 1 ;initiate this only once ('init' not '=') or
>> >>> >> >> > else
>> >>> >> >> > kcount
>> >>> >> >> > will
>> >>> >> >> > be reset to 1 on every k-period
>> >>> >> >> >
>> >>> >> >> > kflag    pvsftw fsig1, iAmpA, iFreqA; store each frame's data
>> >>> >> >> > in
>> >>> >> >> > th
>> >>> >> >> > etable
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> >     if (kflag > 0) then ; only proceed when frame is ready
>> >>> >> >> > (kflag
>> >>> >> >> > gives
>> >>> >> >> > value of 1 when data passes)
>> >>> >> >> >
>> >>> >> >> >         kcount = kcount+1 ;for each frame add an increment to
>> >>> >> >> > kcount
>> >>> >> >> >
>> >>> >> >> >         if (kcount>kduration) then ;every 3rd frame...
>> >>> >> >> >             tablecopy iAmpB, iAmpA
>> >>> >> >> >             tablecopy iFreqB, iFreqA
>> >>> >> >> >         kcount = 1 ;reset kcount to 1
>> >>> >> >> >         endif
>> >>> >> >> >
>> >>> >> >> >     endif
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> >     pvsftr fsig1, iAmpB, iFreqB
>> >>> >> >> >     aout1    pvsynth fsig1
>> >>> >> >> >
>> >>> >> >> >
>> >>> >> >> > out aout1
>> >>> >> >> >
>> >>> >> >> > endin
>> >>> >> >> >
>> >>> >> >> > 
>> >>> >> >> > 
>> >>> >> >> > i1 0 30
>> >>> >> >> > 
>> >>> >> >> > 
>> >>> >> >> >
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> --
>> >>> >> >>
>> >>> >> >> Oeyvind Brandtsegg
>> >>> >> >> Professor of Music Technology
>> >>> >> >> NTNU
>> >>> >> >> 7491 Trondheim
>> >>> >> >> Norway
>> >>> >> >> Cell: +47 92 203 205
>> >>> >> >>
>> >>> >> >> http://flyndresang.no/
>> >>> >> >> http://www.partikkelaudio.com/
>> >>> >> >> http://soundcloud.com/brandtsegg
>> >>> >> >> http://soundcloud.com/t-emp
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> 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"
>> >>> >> >>
>> >>> >> >
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> --
>> >>> >>
>> >>> >> Oeyvind Brandtsegg
>> >>> >> Professor of Music Technology
>> >>> >> NTNU
>> >>> >> 7491 Trondheim
>> >>> >> Norway
>> >>> >> Cell: +47 92 203 205
>> >>> >>
>> >>> >> http://flyndresang.no/
>> >>> >> http://www.partikkelaudio.com/
>> >>> >> http://soundcloud.com/brandtsegg
>> >>> >> http://soundcloud.com/t-emp
>> >>> >>
>> >>> >>
>> >>> >> 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"
>> >>> >>
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>>
>> >>> Oeyvind Brandtsegg
>> >>> Professor of Music Technology
>> >>> NTNU
>> >>> 7491 Trondheim
>> >>> Norway
>> >>> Cell: +47 92 203 205
>> >>>
>> >>> http://flyndresang.no/
>> >>> http://www.partikkelaudio.com/
>> >>> http://soundcloud.com/brandtsegg
>> >>> http://soundcloud.com/t-emp
>> >>>
>> >>>
>> >>> 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"
>> >>>
>> >>
>> >
>>
>>
>>
>> --
>>
>> Oeyvind Brandtsegg
>> Professor of Music Technology
>> NTNU
>> 7491 Trondheim
>> Norway
>> Cell: +47 92 203 205
>>
>> http://flyndresang.no/
>> http://www.partikkelaudio.com/
>> http://soundcloud.com/brandtsegg
>> http://soundcloud.com/t-emp
>>
>>
>> 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"
>>
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp


Date2012-06-29 12:12
Frompeiman khosravi
SubjectRe: [Csnd] another pvs question
Hi Tito,

Bloody hell, this is amazing!! I haven't got a clue how it's working though. Will need to study it and then figure out how to make igap_expand into a k-rate variable.

Thanks!
Peiman

On 29 June 2012 11:58, Tito Latini <tito.01beta@gmail.com> wrote:
>From the `pvsanal' source code, the `anal_tick' function calls
`generate_frame' every "overlap" samples, so fsig changes every
"overlap" samples. Here is an idea starting from your example

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

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

#define NOT(x) # ($x == 0 ? 1 : 0) #

#define INC_KSMPS(x) # $x = $x + ksmps #

instr 1

ifftsize  = 4096
ioverlap  = ifftsize / 8
iwinsize  = ifftsize * 2
iwinshape = 1 ; von-Hann window

ain1  diskin2 "/Applications/Max5/examples/sounds/cherokee.aif", 1, 0, 1
fsig1 pvsanal ain1, ifftsize, ioverlap, iwinsize, iwinshape

;;; igap is the gap between 2 freezed pvs streams.
;;; `igap_expand = 0' means igap = ioverlap.
;;;
;;; ksmps is correct if it exists a positive integer N where
;;;   ksmps*(2^N) = ioverlap, where N is an integer >=0

igap_expand = 5
igap        = ioverlap * (1 << igap_expand)
itwo_gap    = 2*igap

kcount        init 0
kcount_gap    init 0
kndx          init 0
kfreez1       init 1
kfreez2       init 0
kfreez_switch init 1

interp_ftab ftgen 0, 0, itwo_gap, 7, 0, igap, 1, igap, 0

if kcount == ioverlap then
   if kcount_gap == igap then
       kfreez_switch = $NOT(kfreez_switch)
       kfreez1 = kfreez_switch
       kfreez2 = $NOT(kfreez1)
       kcount_gap = 0
   else
       kfreez1 = 1
       kfreez2 = 1
   endif
   kcount = 0
endif

if kndx == itwo_gap then
   kndx = 0
endif

kinterp table kndx, interp_ftab

$INC_KSMPS(kcount)
$INC_KSMPS(kcount_gap)
$INC_KSMPS(kndx)

fsig1_freezed pvsfreeze fsig1, kfreez1, kfreez1
fsig2_freezed pvsfreeze fsig1, kfreez2, kfreez2

ffinal pvsmorph fsig1_freezed, fsig2_freezed, kinterp, kinterp
aout   pvsynth ffinal

out aout

endin
</CsInstruments>
<CsScore>
i1 0 30
</CsScore>
</CsoundSynthesizer>

tito


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"