[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Re: Help me map a control rate signal with a buffer



It's just linear interpolation. e.g. if the input is 12.53 and the
buffer contains [11,12,13] then the output is 1.53, where the "1" is
because it's somewhere between indices numbered 1 and 2, and the ".53"
is reverse-linear-interpolation:
frac = (input-b[1]) / (b[2]-b[1])

Dan

2009/5/3, Carlo Capocasa <theman@xxxxxxxxxxxxxxxxx>:
> Hi Dan!
>
>  Thanks, that sounds really helpful. Can you explain something about this?
> How is the interpolation done, IE how does the program 'know' how far in
> between the elements of ~from the signal was at any given point?
>
>  Thanks a lot for your reply,
>
>  Carlo
>
>
>  Dan Stowell wrote:
>
> > Hi Carlo -
> >
> > One way you can do it is using IndexInBetween to "unmap" your input
> > into integer slots, and then use IndexL to do the reverse, to "map"
> > onto your other distribution. This example maps a sort-of-exponential
> > curve onto a sort-of-sinusoidal curve:
> >
> > ~from = [1, 2, 4, 8, 16];
> > ~to   = [0, 1,  0,  -1,    0];
> > x={IndexL.kr(~to.as(LocalBuf),
> IndexInBetween.kr(~from.as(LocalBuf),
> > MouseX.kr(~from.first,~from.last).poll).poll).poll}.play
> >
> > HTH
> > Dan
> >
> >
> > ---------- Forwarded message ----------
> > From: Carlo Capocasa <theman@xxxxxxxxxxxxxxxxx>
> > Date: 3.5.2009 11:35
> > Subject: [sc-users] Help me map a control rate signal with a buffer
> > To: sc-users@xxxxxxxxxxxxxxxx
> >
> >
> > Hi! Thanks for reading. I'm looking for some help... I need to
> > re-shape a control rate signal with a mapping function defined by a
> > series of float (X|Y) values and linear interpolation in-between.
> > Using a buffer seems to be the most elegant way to do this, could you
> > kindly point me to Ugens that might do this? IndexInBetween seemed
> > promising but then the X-Values have to be integers. Thanks!
> >
> >  Carlo
> >
> >
> >  _______________________________________________
> >  sc-users mailing list
> >
> >  info (subscription, etc.):
> >
> http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
> >  archive:
> https://listarc.bham.ac.uk/marchives/sc-users/
> >  search:
> https://listarc.bham.ac.uk/lists/sc-users/search/
> >
> >
> >
>
>
>  _______________________________________________
>  sc-users mailing list
>
>  info (subscription, etc.):
> http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
>  archive: https://listarc.bham.ac.uk/marchives/sc-users/
>  search:
> https://listarc.bham.ac.uk/lists/sc-users/search/
>


-- 
http://www.mcld.co.uk

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/