Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] audio rate tablew

Date2006-03-13 21:20
FromVictor Lazzarini
SubjectRe: [Cs-dev] audio rate tablew
I had put a pitch shifter that used it  in the UDO database,
but that seems
to have disappeared. Anyway, the excerpt below is
from  tpscaler.csd that is in the examples. Tablew is used
to
write the input signal in the table for the granulator.

instr 1

iomax = 100          /* just to be in the safe side */
kol = int(gk4)       /* number of overlapped grains */
kgr = gk3            /* grain size in secs */
kfr = kol/kgr        /* freq or density in gr/sec */
kps = 1/kol          /* pointer rate scaling */

/* gk1 controls timescale, gk2 controls pitchscale */

ain    in
awp  phasor sr/ftlen(1)
awin tablei awp, 2, 1
     tablew ain*awin, awp, 1, 1
asig syncgrain  gk5, kfr, gk2, kgr, kps*gk1,1, 3, iomax

   out   asig

endin


>
> I still do not exactly know how tablew was intended to be
> used in the orchesra. Could the relevant parts be posted ?
> Maybe some code changes are still needed.
>
> On Monday 13 March 2006 21:54, Victor Lazzarini wrote:
>
> > So that was actually a bug fix. That's OK, I just wanted
> > to check.
> >
> > Victor
> > >
> > > On Monday 13 March 2006 20:28, Victor Lazzarini wrote:
> > >
> > > > When running an orchestra prepared for 4.23, I kept
> > > > getting these errors with audio rate tablew. It
> > > > seems that csound 4 allowed for any rates for the
> > > > index to tablew, whereas
> > > > csound 5 is only allowing audio rate indexes. I
> > > > thought that perhaps they should be compatible so
> > > > that older orchestras do not get broken. Worth
> > > > checking before the 5.01 release.
> > >
> > > Do you mean writing an audio signal to a control rate
> > > index ? That would not work as there is no code
> > > written for that case; it may be that 4.xx still
> > > allowed to do so, but then the results could be
> > > unpredictable and possibly include memory access
> > > errors. It is actually an intentional bug fix that the
> > > table opcodes require the signal and the index to
> > > agree in rate, to avoid the above mentioned undefined
> behavior.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language that extends applications into web and
> mobile media. Attend the live webcast and join the prime
> developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-03-13 21:43
FromIstvan Varga
SubjectRe: [Cs-dev] audio rate tablew
AttachmentsNone  

Date2006-03-14 11:11
FromVictor Lazzarini
SubjectRe: [Cs-dev] audio rate tablew
In fact, I was wrong about tablew, it was table that seemed to
have changed. The Rasmus Ekman cs 4 help says

ar      table   xndx, ifn [,ixmode][, ixoff][, iwrap]

and in Csound 4.23  you can use a k-rate index for reading
the table. The same does not seem to apply for Csound 5.

The UDO below compiles on 4.23 but not on 5:


opcode  PitchShifter, a, akkii
         setksmps  1

asig,kpsc,kfdb,ifn,iwin  xin

ilen = ftlen(ifn) /* delay length (samples) */
ihl = ilen/2      /* delay half-length      */
krp init 0        /* read pointer           */
kwp init 0        /* write pointer          */
awp = kwp         /* a-type copy of kwp     */

kbsdiff = abs(krp - kwp) /* absolute difference */

if kbsdiff > ihl then
   if krp > kwp then
   kbsdiff = kwp+ilen - krp
   else
   kbsdiff = krp+ilen - kwp
   endif
endif

kenv table kbsdiff, iwin /* envelope/crossfade */

as1  table krp, ifn, 0, 0, 1     /* 'read-head' 1  */
as2  table krp, ifn, 0, ihl, 1   /* 'read-head' 2  */
amix = as1*kenv + as2*(1-kenv)   /* mixed signal  */
      tablew asig+amix*kfdb, awp, ifn  /* delay input */

/* update the pointers, check bounds */
kwp = kwp + 1
krp = krp + kpsc
if kwp > ilen then
kwp = 0
endif
if krp > ilen then
krp = 0
endif

        xout  amix
endop


Victor

At 21:43 13/03/2006, you wrote:
>On Monday 13 March 2006 22:20, Victor Lazzarini wrote:
>
> > I had put a pitch shifter that used it  in the UDO database,
> > but that seems to have disappeared. Anyway, the excerpt below
> > is from  tpscaler.csd that is in the examples. Tablew is used
> > to write the input signal in the table for the granulator.
>
>tpscaler.csd does work for me without problems using version 5.00
>or the current CVS, although it should anyway as both the signal
>and the index are a-rate for tablew. Or did the errors occur in
>another orchestra file ?
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-03-14 14:15
FromIstvan Varga
SubjectRe: [Cs-dev] audio rate tablew
AttachmentsNone  

Date2006-03-14 14:39
FromDavid Akbari
SubjectRe: [Cs-dev] audio rate tablew
On Mar 14, 2006, at 9:15 AM, Istvan Varga wrote:

>   amix = ks1*kenv + ks2*(1-kenv)   /* mixed signal  */

Would this be possible in Victor's example if setksmps != 1 ? Other 
than of course just setting the global orchestra kr = sr ...


I find this conversation to be quite interesting.


-David



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-03-14 14:43
FromIstvan Varga
SubjectRe: [Cs-dev] audio rate tablew
AttachmentsNone  

Date2006-03-14 14:45
FromIstvan Varga
SubjectRe: [Cs-dev] audio rate tablew
AttachmentsNone