Csound Csound-dev Csound-tekno Search About

[Csnd] fable rotation UDO design

Date2013-01-18 21:53
FromStéphane_Boussuge
Subject[Csnd] fable rotation UDO design
Hi,

I'm trying to design some Ftable rotation UDO (with different modulo approach (for pitch class etc..)) based on some from Joachim heinz, but it is my first attempt to design UDO and it not work properly but can't figure why...

Need some help please  ,thanks 
stf
my code:



-n -d -m 0



;;;realisation d'un UDO de rotation de Ftable.

giTab ftgen 0, 0, -12, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12



;;With Modulo length of ftable
opcode TbRotModLen, 0, ii
;rotate the elements of ift (modulo length of ft)
ift, inb xin ;;entrée ft et nb de rotations (shift)
itablen = ftlen (ift)
icopy ftgentmp 0, 0, -itablen, -2, 0
tableicopy icopy, ift
ileng = itablen
loop:
index = 0
ival tab_i index,icopy
tabw_i ival, (index + inb) % itablen ,ift
index = index + 1
ileng = ileng -1
if (ileng > 0) igoto loop
endop
;;With choice of Modulo
opcode TbRotMod, 0, iii
;rotate the elements of ift (modulo imod)
ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
itablen = ftlen (ift)
icopy ftgentmp 0, 0, -itablen, -2, 0
tableicopy icopy, ift
ileng = itablen
loop:
index = 0
ival tab_i index,icopy
tabw_i ival, (index + inb) % imod ,ift
index = index + 1
ileng = ileng -1
if (ileng > 0) igoto loop
endop
;;Without Modulo
opcode TbRot, 0, ii
;rotate the elements of ift
ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
itablen = ftlen (ift)
icopy ftgentmp 0, 0, -itablen, -2, 0
tableicopy icopy, ift
ileng = itablen
loop:
index = 0
ival tab_i index,icopy
tabw_i ival, index + inb ,ift
index = index + 1
ileng = ileng -1
if (ileng > 0) igoto loop
endop



;;;utilitaire pour imprimer (print) la ftable resultante
opcode TbDmp, 0, iojjo
ifn, istart, iend, iprec, ippr xin
ippr = (ippr == 0 ? 10 : ippr)
iend = (iend == -1 ? ftlen(ifn) : iend)
iprec = (iprec == -1 ? 3 : iprec)
indx = istart
Sformat sprintf "%%.%df, ", iprec
Sdump sprintf "%s", "["
loop:
ival tab_i indx, ifn
Snew sprintf Sformat, ival
Sdump strcat Sdump, Snew
imod = (indx+1-istart) % ippr
if imod == 0 && indx != iend-1 then
puts Sdump, 1
Sdump = ""
endif
loop_lt indx, 1, iend, loop
ilen strlen Sdump
Slast strsub Sdump, 0, ilen-2
printf_i "%s]\n", 1, Slast
endop
instr 1
ishift = 4
print:
TbRotModLen giTab,ishift
TbDmp giTab, 0, -1, 0, 12
endin

instr 2
ishift = 4
print:
TbRotMod giTab,ishift,6
TbDmp giTab, 0, -1, 0, 12
endin

instr 3
ishift = 3
print:
TbRot giTab,ishift
TbDmp giTab, 0, -1, 0, 12
endin



i1 0 1
i2 0 1
i3 0 1
e




Date2013-01-18 22:42
Fromjoachim heintz
SubjectRe: [Csnd] fable rotation UDO design
hi stef -

i think one problem is that you have written index = 0 inside the loop. 
it has to be outside instead.

when doing this, you have to take care of not reading beyond the table 
boundaries. it tried this quickly, and it seems to work more or less 
(needs some refinements certainly):

opcode TbRot, 0, ii
;rotate the elements of ift
ift, inb xin ;;entrée ft et nb de rotations (shift)
itablen = ftlen (ift)
icopy ftgentmp 0, 0, -itablen, -2, 0
tableicopy icopy, ift
ileng = itablen
index = 0
loop:
ival tab_i index,icopy
tabw_i ival, (index + inb) % itablen ,ift
index = index + 1
ileng = ileng -1
print ival, index+inb
if (ileng > 0) igoto loop
endop

best -
	joachim


Am 18.01.2013 22:53, schrieb Stéphane_Boussuge:
> Hi,
>
> I'm trying to design some Ftable rotation UDO (with different modulo approach (for pitch class etc..)) based on some from Joachim heinz, but it is my first attempt to design UDO and it not work properly but can't figure why...
>
> Need some help please  ,thanks
> stf
> my code:
>
> 
> 
> -n -d -m 0
> 
> 
>
> ;;;realisation d'un UDO de rotation de Ftable.
>
> giTab ftgen 0, 0, -12, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
>
>
>
> ;;With Modulo length of ftable
> opcode TbRotModLen, 0, ii
> ;rotate the elements of ift (modulo length of ft)
> ift, inb xin ;;entrée ft et nb de rotations (shift)
> itablen = ftlen (ift)
> icopy ftgentmp 0, 0, -itablen, -2, 0
> tableicopy icopy, ift
> ileng = itablen
> loop:
> index = 0
> ival tab_i index,icopy
> tabw_i ival, (index + inb) % itablen ,ift
> index = index + 1
> ileng = ileng -1
> if (ileng > 0) igoto loop
> endop
> ;;With choice of Modulo
> opcode TbRotMod, 0, iii
> ;rotate the elements of ift (modulo imod)
> ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
> itablen = ftlen (ift)
> icopy ftgentmp 0, 0, -itablen, -2, 0
> tableicopy icopy, ift
> ileng = itablen
> loop:
> index = 0
> ival tab_i index,icopy
> tabw_i ival, (index + inb) % imod ,ift
> index = index + 1
> ileng = ileng -1
> if (ileng > 0) igoto loop
> endop
> ;;Without Modulo
> opcode TbRot, 0, ii
> ;rotate the elements of ift
> ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
> itablen = ftlen (ift)
> icopy ftgentmp 0, 0, -itablen, -2, 0
> tableicopy icopy, ift
> ileng = itablen
> loop:
> index = 0
> ival tab_i index,icopy
> tabw_i ival, index + inb ,ift
> index = index + 1
> ileng = ileng -1
> if (ileng > 0) igoto loop
> endop
>
>
>
> ;;;utilitaire pour imprimer (print) la ftable resultante
> opcode TbDmp, 0, iojjo
> ifn, istart, iend, iprec, ippr xin
> ippr = (ippr == 0 ? 10 : ippr)
> iend = (iend == -1 ? ftlen(ifn) : iend)
> iprec = (iprec == -1 ? 3 : iprec)
> indx = istart
> Sformat sprintf "%%.%df, ", iprec
> Sdump sprintf "%s", "["
> loop:
> ival tab_i indx, ifn
> Snew sprintf Sformat, ival
> Sdump strcat Sdump, Snew
> imod = (indx+1-istart) % ippr
> if imod == 0 && indx != iend-1 then
> puts Sdump, 1
> Sdump = ""
> endif
> loop_lt indx, 1, iend, loop
> ilen strlen Sdump
> Slast strsub Sdump, 0, ilen-2
> printf_i "%s]\n", 1, Slast
> endop
> instr 1
> ishift = 4
> print:
> TbRotModLen giTab,ishift
> TbDmp giTab, 0, -1, 0, 12
> endin
>
> instr 2
> ishift = 4
> print:
> TbRotMod giTab,ishift,6
> TbDmp giTab, 0, -1, 0, 12
> endin
>
> instr 3
> ishift = 3
> print:
> TbRot giTab,ishift
> TbDmp giTab, 0, -1, 0, 12
> endin
>
> 
> 
> i1 0 1
> i2 0 1
> i3 0 1
> e
>
> 
> 
>
> 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"
>
>

Date2013-01-18 23:23
FromStéphane_Boussuge
SubjectRe: [Csnd] fable rotation UDO design
a big thanks you for your help Joachim !!!

merci beaucoup !


stf

Le 18 janv. 2013 à 23:42, joachim heintz  a écrit :

> hi stef -
> 
> i think one problem is that you have written index = 0 inside the loop. it has to be outside instead.
> 
> when doing this, you have to take care of not reading beyond the table boundaries. it tried this quickly, and it seems to work more or less (needs some refinements certainly):
> 
> opcode TbRot, 0, ii
> ;rotate the elements of ift
> ift, inb xin ;;entrée ft et nb de rotations (shift)
> itablen = ftlen (ift)
> icopy ftgentmp 0, 0, -itablen, -2, 0
> tableicopy icopy, ift
> ileng = itablen
> index = 0
> loop:
> ival tab_i index,icopy
> tabw_i ival, (index + inb) % itablen ,ift
> index = index + 1
> ileng = ileng -1
> print ival, index+inb
> if (ileng > 0) igoto loop
> endop
> 
> best -
> 	joachim
> 
> 
> Am 18.01.2013 22:53, schrieb Stéphane_Boussuge:
>> Hi,
>> 
>> I'm trying to design some Ftable rotation UDO (with different modulo approach (for pitch class etc..)) based on some from Joachim heinz, but it is my first attempt to design UDO and it not work properly but can't figure why...
>> 
>> Need some help please  ,thanks
>> stf
>> my code:
>> 
>> 
>> 
>> -n -d -m 0
>> 
>> 
>> 
>> ;;;realisation d'un UDO de rotation de Ftable.
>> 
>> giTab ftgen 0, 0, -12, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
>> 
>> 
>> 
>> ;;With Modulo length of ftable
>> opcode TbRotModLen, 0, ii
>> ;rotate the elements of ift (modulo length of ft)
>> ift, inb xin ;;entrée ft et nb de rotations (shift)
>> itablen = ftlen (ift)
>> icopy ftgentmp 0, 0, -itablen, -2, 0
>> tableicopy icopy, ift
>> ileng = itablen
>> loop:
>> index = 0
>> ival tab_i index,icopy
>> tabw_i ival, (index + inb) % itablen ,ift
>> index = index + 1
>> ileng = ileng -1
>> if (ileng > 0) igoto loop
>> endop
>> ;;With choice of Modulo
>> opcode TbRotMod, 0, iii
>> ;rotate the elements of ift (modulo imod)
>> ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
>> itablen = ftlen (ift)
>> icopy ftgentmp 0, 0, -itablen, -2, 0
>> tableicopy icopy, ift
>> ileng = itablen
>> loop:
>> index = 0
>> ival tab_i index,icopy
>> tabw_i ival, (index + inb) % imod ,ift
>> index = index + 1
>> ileng = ileng -1
>> if (ileng > 0) igoto loop
>> endop
>> ;;Without Modulo
>> opcode TbRot, 0, ii
>> ;rotate the elements of ift
>> ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
>> itablen = ftlen (ift)
>> icopy ftgentmp 0, 0, -itablen, -2, 0
>> tableicopy icopy, ift
>> ileng = itablen
>> loop:
>> index = 0
>> ival tab_i index,icopy
>> tabw_i ival, index + inb ,ift
>> index = index + 1
>> ileng = ileng -1
>> if (ileng > 0) igoto loop
>> endop
>> 
>> 
>> 
>> ;;;utilitaire pour imprimer (print) la ftable resultante
>> opcode TbDmp, 0, iojjo
>> ifn, istart, iend, iprec, ippr xin
>> ippr = (ippr == 0 ? 10 : ippr)
>> iend = (iend == -1 ? ftlen(ifn) : iend)
>> iprec = (iprec == -1 ? 3 : iprec)
>> indx = istart
>> Sformat sprintf "%%.%df, ", iprec
>> Sdump sprintf "%s", "["
>> loop:
>> ival tab_i indx, ifn
>> Snew sprintf Sformat, ival
>> Sdump strcat Sdump, Snew
>> imod = (indx+1-istart) % ippr
>> if imod == 0 && indx != iend-1 then
>> puts Sdump, 1
>> Sdump = ""
>> endif
>> loop_lt indx, 1, iend, loop
>> ilen strlen Sdump
>> Slast strsub Sdump, 0, ilen-2
>> printf_i "%s]\n", 1, Slast
>> endop
>> instr 1
>> ishift = 4
>> print:
>> TbRotModLen giTab,ishift
>> TbDmp giTab, 0, -1, 0, 12
>> endin
>> 
>> instr 2
>> ishift = 4
>> print:
>> TbRotMod giTab,ishift,6
>> TbDmp giTab, 0, -1, 0, 12
>> endin
>> 
>> instr 3
>> ishift = 3
>> print:
>> TbRot giTab,ishift
>> TbDmp giTab, 0, -1, 0, 12
>> endin
>> 
>> 
>> 
>> i1 0 1
>> i2 0 1
>> i3 0 1
>> e
>> 
>> 
>> 
>> 
>> 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"
> 



Date2013-01-19 10:23
Fromjoachim heintz
SubjectRe: [Csnd] fable rotation UDO design
de rien, c'est mon plaisir.
salut -
	j

Am 19.01.2013 00:23, schrieb Stéphane_Boussuge:
> a big thanks you for your help Joachim !!!
>
> merci beaucoup !
>
>
> stf
>
> Le 18 janv. 2013 à 23:42, joachim heintz  a écrit :
>
>> hi stef -
>>
>> i think one problem is that you have written index = 0 inside the loop. it has to be outside instead.
>>
>> when doing this, you have to take care of not reading beyond the table boundaries. it tried this quickly, and it seems to work more or less (needs some refinements certainly):
>>
>> opcode TbRot, 0, ii
>> ;rotate the elements of ift
>> ift, inb xin ;;entrée ft et nb de rotations (shift)
>> itablen = ftlen (ift)
>> icopy ftgentmp 0, 0, -itablen, -2, 0
>> tableicopy icopy, ift
>> ileng = itablen
>> index = 0
>> loop:
>> ival tab_i index,icopy
>> tabw_i ival, (index + inb) % itablen ,ift
>> index = index + 1
>> ileng = ileng -1
>> print ival, index+inb
>> if (ileng > 0) igoto loop
>> endop
>>
>> best -
>> 	joachim
>>
>>
>> Am 18.01.2013 22:53, schrieb Stéphane_Boussuge:
>>> Hi,
>>>
>>> I'm trying to design some Ftable rotation UDO (with different modulo approach (for pitch class etc..)) based on some from Joachim heinz, but it is my first attempt to design UDO and it not work properly but can't figure why...
>>>
>>> Need some help please  ,thanks
>>> stf
>>> my code:
>>>
>>> 
>>> 
>>> -n -d -m 0
>>> 
>>> 
>>>
>>> ;;;realisation d'un UDO de rotation de Ftable.
>>>
>>> giTab ftgen 0, 0, -12, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
>>>
>>>
>>>
>>> ;;With Modulo length of ftable
>>> opcode TbRotModLen, 0, ii
>>> ;rotate the elements of ift (modulo length of ft)
>>> ift, inb xin ;;entrée ft et nb de rotations (shift)
>>> itablen = ftlen (ift)
>>> icopy ftgentmp 0, 0, -itablen, -2, 0
>>> tableicopy icopy, ift
>>> ileng = itablen
>>> loop:
>>> index = 0
>>> ival tab_i index,icopy
>>> tabw_i ival, (index + inb) % itablen ,ift
>>> index = index + 1
>>> ileng = ileng -1
>>> if (ileng > 0) igoto loop
>>> endop
>>> ;;With choice of Modulo
>>> opcode TbRotMod, 0, iii
>>> ;rotate the elements of ift (modulo imod)
>>> ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
>>> itablen = ftlen (ift)
>>> icopy ftgentmp 0, 0, -itablen, -2, 0
>>> tableicopy icopy, ift
>>> ileng = itablen
>>> loop:
>>> index = 0
>>> ival tab_i index,icopy
>>> tabw_i ival, (index + inb) % imod ,ift
>>> index = index + 1
>>> ileng = ileng -1
>>> if (ileng > 0) igoto loop
>>> endop
>>> ;;Without Modulo
>>> opcode TbRot, 0, ii
>>> ;rotate the elements of ift
>>> ift, inb, imod xin ;;entrée ft et nb de rotations (shift)
>>> itablen = ftlen (ift)
>>> icopy ftgentmp 0, 0, -itablen, -2, 0
>>> tableicopy icopy, ift
>>> ileng = itablen
>>> loop:
>>> index = 0
>>> ival tab_i index,icopy
>>> tabw_i ival, index + inb ,ift
>>> index = index + 1
>>> ileng = ileng -1
>>> if (ileng > 0) igoto loop
>>> endop
>>>
>>>
>>>
>>> ;;;utilitaire pour imprimer (print) la ftable resultante
>>> opcode TbDmp, 0, iojjo
>>> ifn, istart, iend, iprec, ippr xin
>>> ippr = (ippr == 0 ? 10 : ippr)
>>> iend = (iend == -1 ? ftlen(ifn) : iend)
>>> iprec = (iprec == -1 ? 3 : iprec)
>>> indx = istart
>>> Sformat sprintf "%%.%df, ", iprec
>>> Sdump sprintf "%s", "["
>>> loop:
>>> ival tab_i indx, ifn
>>> Snew sprintf Sformat, ival
>>> Sdump strcat Sdump, Snew
>>> imod = (indx+1-istart) % ippr
>>> if imod == 0 && indx != iend-1 then
>>> puts Sdump, 1
>>> Sdump = ""
>>> endif
>>> loop_lt indx, 1, iend, loop
>>> ilen strlen Sdump
>>> Slast strsub Sdump, 0, ilen-2
>>> printf_i "%s]\n", 1, Slast
>>> endop
>>> instr 1
>>> ishift = 4
>>> print:
>>> TbRotModLen giTab,ishift
>>> TbDmp giTab, 0, -1, 0, 12
>>> endin
>>>
>>> instr 2
>>> ishift = 4
>>> print:
>>> TbRotMod giTab,ishift,6
>>> TbDmp giTab, 0, -1, 0, 12
>>> endin
>>>
>>> instr 3
>>> ishift = 3
>>> print:
>>> TbRot giTab,ishift
>>> TbDmp giTab, 0, -1, 0, 12
>>> endin
>>>
>>> 
>>> 
>>> i1 0 1
>>> i2 0 1
>>> i3 0 1
>>> e
>>>
>>> 
>>> 
>>>
>>> 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"
>
>