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

Re: [sc-users] map midi data



val.linlin(0, 127, 0.0, 4.0) for linear mapping

Or, for arbitrary ControlSpec mapping:

c = ControlSpec(0, 4, \lin);  // or whatever other mapping: \exp, a
curve number, etc.

CCResponder( { |src,chan,num,val| x.set(\pitch, c.map(val / 127)); },
nil, 0, 1, nil);

A ControlSpec always maps 0..1 onto the given range, so it's necessary
to divide the 0..127 value by 127 to get 0.0 .. 1.0.
hjh

On Mon, Dec 1, 2008 at 4:13 PM, Jroen van Rijzewijk
<supercollidermailinglist@xxxxxxxxx> wrote:
> Hi list,
> i want to map midi data [0, 127] to [0.0, 4.0] or any other value's, do i do
> that with asSpec of something else?
> I would like it if it would be in the same line as my controller data:
> CCResponder( { |src,chan,num,val| x.set(\pitch, val); }, nil, 0, 1, nil);
> so somewhere in that line of code, is this possible and how would i do that?
> Or is there any ohter way to do this?
> Thanks in advance,
> Jroen



-- 
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

_______________________________________________
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/