Csound Csound-dev Csound-tekno Search About

[Csnd] pvsftw problems

Date2011-01-16 23:42
Fromjoachim heintz
Subject[Csnd] pvsftw problems
hi -

i have problems using the pvsftw opcode. basically, it seems to return
kflag=1 even if writing to the table has not been completed. below is an
example which tries to isolate the problem. writing the fsig to a
function table is just done in one k-period. kflag returns 1, but there
are obviously no data in the function table.

these are my questions:

1) is the kflag return value wrong or am i doing something wrong?
2) how many k-cycles are needed to write a fsig properly to a table via
pvsftw? (the manual says: if ksmps=overlap, it can be done in one
k-cycle. but in my tests this does not work.)
3) is there a trick to do it in one k-cycle via a k-rate loop? i tried
this, but without success.

thanks -

	joachim






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

giSine		ftgen	0, 0, 2^12, 10, 1
giAmpTab	ftgen	0, 0, 513, -2, 0

  opcode TableDumpSimp_k, 0, ijo
;prints the content of a table in a simple way
ifn, iprec, ippr   xin; function table, float precision while printing
(default = 3), parameters per row (default = 10, maximum = 32)
iprec		=		(iprec == -1 ? 3 : iprec)
ippr		=		(ippr == 0 ? 10 : ippr)
iend		=		ftlen(ifn)
kndx		=		0
Sformat	sprintf	"%%.%df\t", iprec
Sdump		=		""
loop:
kval		tab		kndx, ifn
Snew		sprintfk	Sformat, kval
Sdump		strcatk	Sdump, Snew
kndx		=		kndx + 1
kmod		=		kndx % ippr
	if kmod == 0 then
		puts		Sdump, kndx
Sdump		sprintfk	"%s", ""
	endif
	if kndx < iend kgoto loop
		puts		Sdump, kndx
  endop

instr 1
abuzz		buzz		1, 200, 50, giSine
ktrig		metro		1, .5
 if ktrig == 1 then
fsig		pvsanal	abuzz, 1024, 256, 2048, 1
kflag		pvsftw		fsig, giAmpTab
		printk		0, kflag
		TableDumpSimp_k giAmpTab
 endif
endin



i 1 0 1




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"

Date2011-01-17 10:46
Fromjoachim heintz
Subject[Csnd] Re: pvsftw problems
Attachmentspvsftw.csd  
sorry the text of the csd has been corrupted because of the email. it's
attached now. thanks for any suggestions -
	joachim



Am 17.01.2011 00:42, schrieb joachim heintz:
> hi -
> 
> i have problems using the pvsftw opcode. basically, it seems to return
> kflag=1 even if writing to the table has not been completed. below is an
> example which tries to isolate the problem. writing the fsig to a
> function table is just done in one k-period. kflag returns 1, but there
> are obviously no data in the function table.
> 
> these are my questions:
> 
> 1) is the kflag return value wrong or am i doing something wrong?
> 2) how many k-cycles are needed to write a fsig properly to a table via
> pvsftw? (the manual says: if ksmps=overlap, it can be done in one
> k-cycle. but in my tests this does not work.)
> 3) is there a trick to do it in one k-cycle via a k-rate loop? i tried
> this, but without success.
> 
> thanks -
> 
> 	joachim
> 
> 
> 
> 
> 
> 
> sr = 44100
> ksmps = 128
> nchnls = 1
> 0dbfs = 1
> 
> giSine		ftgen	0, 0, 2^12, 10, 1
> giAmpTab	ftgen	0, 0, 513, -2, 0
> 
>   opcode TableDumpSimp_k, 0, ijo
> ;prints the content of a table in a simple way
> ifn, iprec, ippr   xin; function table, float precision while printing
> (default = 3), parameters per row (default = 10, maximum = 32)
> iprec		=		(iprec == -1 ? 3 : iprec)
> ippr		=		(ippr == 0 ? 10 : ippr)
> iend		=		ftlen(ifn)
> kndx		=		0
> Sformat	sprintf	"%%.%df\t", iprec
> Sdump		=		""
> loop:
> kval		tab		kndx, ifn
> Snew		sprintfk	Sformat, kval
> Sdump		strcatk	Sdump, Snew
> kndx		=		kndx + 1
> kmod		=		kndx % ippr
> 	if kmod == 0 then
> 		puts		Sdump, kndx
> Sdump		sprintfk	"%s", ""
> 	endif
> 	if kndx < iend kgoto loop
> 		puts		Sdump, kndx
>   endop
> 
> instr 1
> abuzz		buzz		1, 200, 50, giSine
> ktrig		metro		1, .5
>  if ktrig == 1 then
> fsig		pvsanal	abuzz, 1024, 256, 2048, 1
> kflag		pvsftw		fsig, giAmpTab
> 		printk		0, kflag
> 		TableDumpSimp_k giAmpTab
>  endif
> endin
> 
> 
> 
> i 1 0 1
> 
> 
> 
> 
> 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"


Date2011-01-17 11:08
Frompeiman khosravi
Subject[Csnd] Re: Re: pvsftw problems
Hi joachim,

Try this one (instrument pasted below).

I think what is happening in your instrument is that the fsig is
actually initialized at the start of the note but it contains only
zeros as it is basically empty. Since you are placing pvsanal after
the conditional statement by the time ktrig is one there has not been
enough time to analyse the signal yet so you still get zero (as the
signal is only passed onto pvsanal when ktrig==1). So pvsanal should
be placed before the conditional.



instr 1
abuzz           buzz            1, 200, 50, giSine
fsig            pvsanal abuzz, 1024, 256, 2048, 1


ktrig           metro           1, .5
 if ktrig == 1 then
kflag           pvsftw          fsig, giAmpTab
	if kflag == 1 then
		TableDumpSimp_k giAmpTab
	endif
 endif

printk2          kflag


endin


On 17 January 2011 10:46, joachim heintz  wrote:
> sorry the text of the csd has been corrupted because of the email. it's
> attached now. thanks for any suggestions -
>        joachim
>
>
>
> Am 17.01.2011 00:42, schrieb joachim heintz:
>> hi -
>>
>> i have problems using the pvsftw opcode. basically, it seems to return
>> kflag=1 even if writing to the table has not been completed. below is an
>> example which tries to isolate the problem. writing the fsig to a
>> function table is just done in one k-period. kflag returns 1, but there
>> are obviously no data in the function table.
>>
>> these are my questions:
>>
>> 1) is the kflag return value wrong or am i doing something wrong?
>> 2) how many k-cycles are needed to write a fsig properly to a table via
>> pvsftw? (the manual says: if ksmps=overlap, it can be done in one
>> k-cycle. but in my tests this does not work.)
>> 3) is there a trick to do it in one k-cycle via a k-rate loop? i tried
>> this, but without success.
>>
>> thanks -
>>
>>       joachim
>>
>>
>> 
>> 
>> 
>> 
>> sr = 44100
>> ksmps = 128
>> nchnls = 1
>> 0dbfs = 1
>>
>> giSine                ftgen   0, 0, 2^12, 10, 1
>> giAmpTab      ftgen   0, 0, 513, -2, 0
>>
>>   opcode TableDumpSimp_k, 0, ijo
>> ;prints the content of a table in a simple way
>> ifn, iprec, ippr   xin; function table, float precision while printing
>> (default = 3), parameters per row (default = 10, maximum = 32)
>> iprec         =               (iprec == -1 ? 3 : iprec)
>> ippr          =               (ippr == 0 ? 10 : ippr)
>> iend          =               ftlen(ifn)
>> kndx          =               0
>> Sformat       sprintf "%%.%df\t", iprec
>> Sdump         =               ""
>> loop:
>> kval          tab             kndx, ifn
>> Snew          sprintfk        Sformat, kval
>> Sdump         strcatk Sdump, Snew
>> kndx          =               kndx + 1
>> kmod          =               kndx % ippr
>>       if kmod == 0 then
>>               puts            Sdump, kndx
>> Sdump         sprintfk        "%s", ""
>>       endif
>>       if kndx < iend kgoto loop
>>               puts            Sdump, kndx
>>   endop
>>
>> instr 1
>> abuzz         buzz            1, 200, 50, giSine
>> ktrig         metro           1, .5
>>  if ktrig == 1 then
>> fsig          pvsanal abuzz, 1024, 256, 2048, 1
>> kflag         pvsftw          fsig, giAmpTab
>>               printk          0, kflag
>>               TableDumpSimp_k giAmpTab
>>  endif
>> endin
>>
>> 
>> 
>> i 1 0 1
>> 
>> 
>>
>>
>> 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"
>
>


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"


Date2011-01-17 12:35
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: pvsftw problems
thanks, peiman - this makes sense and is at least a workaround for my
situation. my problem is that i want to analyze the audio input not
continously, but just for some snapshots. so it would be much more
efficient to write an f-signal just for some k-cycles.

can anyone say
1) how many k-cycles are needed to create an fsig via pvsanal and
pvstanal (fftsize/ksmps?)
2) how many k-cycles are needed to write this fsig to a table via pvsftw?

thanks -

	joachim


Am 17.01.2011 12:08, schrieb peiman khosravi:
> Hi joachim,
> 
> Try this one (instrument pasted below).
> 
> I think what is happening in your instrument is that the fsig is
> actually initialized at the start of the note but it contains only
> zeros as it is basically empty. Since you are placing pvsanal after
> the conditional statement by the time ktrig is one there has not been
> enough time to analyse the signal yet so you still get zero (as the
> signal is only passed onto pvsanal when ktrig==1). So pvsanal should
> be placed before the conditional.
> 
> 
> 
> instr 1
> abuzz           buzz            1, 200, 50, giSine
> fsig            pvsanal abuzz, 1024, 256, 2048, 1
> 
> 
> ktrig           metro           1, .5
>  if ktrig == 1 then
> kflag           pvsftw          fsig, giAmpTab
> 	if kflag == 1 then
> 		TableDumpSimp_k giAmpTab
> 	endif
>  endif
> 
> printk2          kflag
> 
> 
> endin
> 
> 
> On 17 January 2011 10:46, joachim heintz  wrote:
>> sorry the text of the csd has been corrupted because of the email. it's
>> attached now. thanks for any suggestions -
>>        joachim
>>
>>
>>
>> Am 17.01.2011 00:42, schrieb joachim heintz:
>>> hi -
>>>
>>> i have problems using the pvsftw opcode. basically, it seems to return
>>> kflag=1 even if writing to the table has not been completed. below is an
>>> example which tries to isolate the problem. writing the fsig to a
>>> function table is just done in one k-period. kflag returns 1, but there
>>> are obviously no data in the function table.
>>>
>>> these are my questions:
>>>
>>> 1) is the kflag return value wrong or am i doing something wrong?
>>> 2) how many k-cycles are needed to write a fsig properly to a table via
>>> pvsftw? (the manual says: if ksmps=overlap, it can be done in one
>>> k-cycle. but in my tests this does not work.)
>>> 3) is there a trick to do it in one k-cycle via a k-rate loop? i tried
>>> this, but without success.
>>>
>>> thanks -
>>>
>>>       joachim
>>>
>>>
>>> 
>>> 
>>> 
>>> 
>>> sr = 44100
>>> ksmps = 128
>>> nchnls = 1
>>> 0dbfs = 1
>>>
>>> giSine                ftgen   0, 0, 2^12, 10, 1
>>> giAmpTab      ftgen   0, 0, 513, -2, 0
>>>
>>>   opcode TableDumpSimp_k, 0, ijo
>>> ;prints the content of a table in a simple way
>>> ifn, iprec, ippr   xin; function table, float precision while printing
>>> (default = 3), parameters per row (default = 10, maximum = 32)
>>> iprec         =               (iprec == -1 ? 3 : iprec)
>>> ippr          =               (ippr == 0 ? 10 : ippr)
>>> iend          =               ftlen(ifn)
>>> kndx          =               0
>>> Sformat       sprintf "%%.%df\t", iprec
>>> Sdump         =               ""
>>> loop:
>>> kval          tab             kndx, ifn
>>> Snew          sprintfk        Sformat, kval
>>> Sdump         strcatk Sdump, Snew
>>> kndx          =               kndx + 1
>>> kmod          =               kndx % ippr
>>>       if kmod == 0 then
>>>               puts            Sdump, kndx
>>> Sdump         sprintfk        "%s", ""
>>>       endif
>>>       if kndx < iend kgoto loop
>>>               puts            Sdump, kndx
>>>   endop
>>>
>>> instr 1
>>> abuzz         buzz            1, 200, 50, giSine
>>> ktrig         metro           1, .5
>>>  if ktrig == 1 then
>>> fsig          pvsanal abuzz, 1024, 256, 2048, 1
>>> kflag         pvsftw          fsig, giAmpTab
>>>               printk          0, kflag
>>>               TableDumpSimp_k giAmpTab
>>>  endif
>>> endin
>>>
>>> 
>>> 
>>> i 1 0 1
>>> 
>>> 
>>>
>>>
>>> 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"
>>
>>
> 
> 
> 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"