Mapping a Ring Area device
Mapping a Ring Area device
Let's say I have a Ring Area device joystick. I want to seperate it into 4 quadrants that do different things. I want the positive X axis (64-127 velocity) to send on one note and the negative X axis (63-0 velocity) to send on another...same deal for the Y axis. So I want the x and y axises to work on a combination of 4 notes...how do I do this?? I can't find anything in the manual to help.
Re: Mapping a Ring Area device
The RingArea object has x and y variables - they both have a range of 0 to 1.
The "negative x" you describe is actually the range 0<x<0.5 while the "positive x" you describe is 0.5<x<1. The same is true for y while obviously when the RingArea ball is at center position x=y=0.5
Taking under consideration the above you need to script different note outs on the following scenarios
if ((x<0.5) && (y<0.5)) (bottom left quadrant) ...
if ((x<0.5) && (y>0.5)) (top left quadrant) ...
if ((x>0.5) && (y<0.5)) (bottom right quadrant) ...
if ((x>0.5) && (y>0.5)) (top left quadrant) ...
if you are planning to send note outs I believe the most practical way to go about this is to set the script so that it is triggered by z value (whenever you "touch" the RingArea).
So you would need to define noteout(target, note, velocity, channel) functions after each "if" statement (where the dots are in the above example code).....Again check the manual for a full list of functions available.
So here is a finished example that sends note outs on Midi Target 0 with pitches 50 to 54 on Midi Ch 1 with fixed velocities according to the quadrant, when you touch the RingArea and then sends the noteoffs when you release your finger from the RingArea
Script on Expression z, any
Finally, by your description I believe you also want to incorporate different velocities for the note outs? based on what? x distance from center, y distance from center? You need to be more clear as to what you want your object to do. 
The "negative x" you describe is actually the range 0<x<0.5 while the "positive x" you describe is 0.5<x<1. The same is true for y while obviously when the RingArea ball is at center position x=y=0.5
Taking under consideration the above you need to script different note outs on the following scenarios
if ((x<0.5) && (y<0.5)) (bottom left quadrant) ...
if ((x<0.5) && (y>0.5)) (top left quadrant) ...
if ((x>0.5) && (y<0.5)) (bottom right quadrant) ...
if ((x>0.5) && (y>0.5)) (top left quadrant) ...
if you are planning to send note outs I believe the most practical way to go about this is to set the script so that it is triggered by z value (whenever you "touch" the RingArea).
So you would need to define noteout(target, note, velocity, channel) functions after each "if" statement (where the dots are in the above example code).....Again check the manual for a full list of functions available.
So here is a finished example that sends note outs on Midi Target 0 with pitches 50 to 54 on Midi Ch 1 with fixed velocities according to the quadrant, when you touch the RingArea and then sends the noteoffs when you release your finger from the RingArea
Script on Expression z, any
Code: Select all
if (z==1)
{
if ((x<0.5) && (y<0.5)) noteout(0, 50, 127, 1);
if ((x<0.5) && (y>0.5)) noteout(0, 51, 127, 1);
if ((x>0.5) && (y<0.5)) noteout(0, 52, 127, 1);
if ((x>0.5) && (y>0.5)) noteout(0, 53, 127, 1);
}
else
{
noteout(0, 50, 0, 1);
noteout(0, 51, 0, 1);
noteout(0, 52, 0, 1);
noteout(0, 54, 0, 1);
}

Re: Mapping a Ring Area device
Thank you so much for the prompt response! I realize now I was going about this completely the wrong way, trying to map the velocity range (64 to 127) and (63,0). As for your question, yes I do need velocity on the noteout's. I want to be able to control 4 different rotaries from start to finish so I do I want the distance from center to range the velocity of the signal out. While we're on the subject, there's something that somewhat complicates things. Let's say I want to send a second note at specific delay after a first note. For instance, when I move the joystick or push a button...I want to send one note, and I want lemur to automatically send a second note several milliseconds later. I dont want this to repeat, but happen only once. I've seen posts here on how to send repeated notes at certain intervals, but if I just want a second note to go out several milliseconds after my first note each time I press a pad, how would I accomplish this? Thanks again for all your insight.
Re: Mapping a Ring Area device
So I can't seem to understand why this won't work
I want a button to send out a "sequence" of messages in quick succession, seperated by several milliseconds to insure the messages don't get dropped by the program.
I made an expression "delay" and set it to 0.03 and then another expression "last_trigger"
Thus, when I press x, it will send out it's own note, then by the script above, a second note should be coming out 3 milliseconds after that. In midimonitor, I see both notes coming out, but they're coming out at the exact same moment...without any delay in-between.
Code: Select all
if(x>0);
{
(last_trigger=time);
if(time-last_trigger > delay)ctlout(0, 15, 127, 1);
}
I made an expression "delay" and set it to 0.03 and then another expression "last_trigger"
Thus, when I press x, it will send out it's own note, then by the script above, a second note should be coming out 3 milliseconds after that. In midimonitor, I see both notes coming out, but they're coming out at the exact same moment...without any delay in-between.
Re: Mapping a Ring Area device
Hi
Syntax errors - It works , you're just not telling it what you think you are . . .
Check Chapter 11 of the manual . . .
Also you need to understand 'Frame rate' - your code executes ~60 times a second , roughly every 16ms . . .
Then your next section of code assigns time to last_trigger - lets say it is 1 : then the next line is always if(1-1 > ).03 ? It never will be . . .
Try a Forum search on Time functions this has been discussed before at length . .
Cheers
MM
Syntax errors - It works , you're just not telling it what you think you are . . .
Check Chapter 11 of the manual . . .
Also you need to understand 'Frame rate' - your code executes ~60 times a second , roughly every 16ms . . .
Then your next section of code assigns time to last_trigger - lets say it is 1 : then the next line is always if(1-1 > ).03 ? It never will be . . .
Try a Forum search on Time functions this has been discussed before at length . .
Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Mapping a Ring Area device
Ok, I was aware of the 16 ms in between "frames"...though I was naively, and somewhat desperately, hopeful that using an "on expression" instead of "on frame" would let me do something just once after 3 ms. Doing a search on here I found a couple more posts asking for similar things and from what I read, in addition to what I believe you're alluding to, it's not possible to have serial events happen at such small intervals

Thanks for the reply.


Thanks for the reply.
Re: Mapping a Ring Area device
I have yet to understand how you modulate the noteout that comes out of the Ring Area device. I've tried using the code above that Softcore mentioned and/or something like this:
I've tried noteoute (0,1, x, 1); in addition to the above and/or declaring a value and trying to associate it with x and y...those being the distance of x/y from the center of the joystick.
I can't understand why noteout(0, 1, x, 1) doesn't grab the "x" value from the device or how to otherwise define a value as the distance from center of the device. I've searched the manual left and right and have come up with nothing.
Code: Select all
if (z==1)
{
if (x<0.5)(noteout(0, 1, range(x,0,127), 1));
if (y<0.5)(noteout(0, 3, range(y,0,127), 1));
if (x>0.5)(noteout(0, 2, range(x,0,127), 1));
if (y>0.5)(note out(0, 4, range(y,0,127), 1));
}
I can't understand why noteout(0, 1, x, 1) doesn't grab the "x" value from the device or how to otherwise define a value as the distance from center of the device. I've searched the manual left and right and have come up with nothing.
Re: Mapping a Ring Area device
Hi
Use some Monitor objects to show you what is actually happening to help work out what you want to happen . . .
It depends on a few things what do you mean by 'modulate'?
Where and why is the script running? That script could potentially make lots of notes but few note offs. . .
Are you having 1 of them or 10? Do the need to respond to anything etc etc
Write out exactly what you want ! A diffferent note in each quad that modulates? ala modulation? kinda dubstep maybe?
Lots of notes? Velocity linked to distance from centre? from side? veolcity on x, expression on y, mod on distance?
Do up what ever you have and label parts of it then post it here . . .
Cheers
MM
Use some Monitor objects to show you what is actually happening to help work out what you want to happen . . .
It depends on a few things what do you mean by 'modulate'?
Where and why is the script running? That script could potentially make lots of notes but few note offs. . .
Are you having 1 of them or 10? Do the need to respond to anything etc etc
Write out exactly what you want ! A diffferent note in each quad that modulates? ala modulation? kinda dubstep maybe?
Lots of notes? Velocity linked to distance from centre? from side? veolcity on x, expression on y, mod on distance?
Do up what ever you have and label parts of it then post it here . . .
Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Mapping a Ring Area device
Hey, ya pretty much just simple modulation of one device per axis
Nothing too complex at the moment as I need to understand the basic premise of something like this before teaching myself other more complex stuff. Basically, rather than having the x and y axis control 2 faders, I want to control 4 taking advantage of the center position as a "split." The center position will essentially reset all 4 faders back to zero. Since all the faders are on different midi notes, I don't know how to make the joystick increase one note going to the right, but increase another when it goes to the left.


Re: Mapping a Ring Area device
Why where you asking for note ons-offs in the first place ?
on expression x, on epxression y (create two scripts)
or if you dont want to control Lemur faders and you want to directly send CC out (why would you want note ons out to control faders?)
which will obviously send CC numbers 50, 51, 52, 53 on midi target 0, midichannel 1.
The logic for the "mapping" of the ranges of x and y to new values is based on the posible values these get in each quadrant and the following equation:
NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin
where:
OldRange = (OldMax - OldMin)
NewRange = (NewMax - NewMin)
EDIT: there was a mistake for 3rd and 4th quadrant, I edited the code!
on expression x, on epxression y (create two scripts)
Code: Select all
decl i,k,l,m;
i=(y-0.5)*2;
k=(x-0.5)*2;
l=1-(y*2);
m=1-(x*2);
if (i<0) i=0;
if (k<0) k=0;
if (l <0) l=0;
if (m<0) m=0;
fader1.x=i;
fader2.x=k;
fader3.x=l;
fader4.x=m;
Code: Select all
decl i,k,l,m;
i=(y-0.5)*2;
k=(x-0.5)*2;
l=1-(y*2);
m=1-(x*2);
if (i<0) i=0;
if (k<0) k=0;
if (l <0) l=0;
if (m <0) m=0;
ctlout(0, 50, i, 1);
ctlout(0, 51, k, 1);
ctlout(0, 52, l, 1);
ctlout(0, 53, m, 1);
The logic for the "mapping" of the ranges of x and y to new values is based on the posible values these get in each quadrant and the following equation:
NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin
where:
OldRange = (OldMax - OldMin)
NewRange = (NewMax - NewMin)
EDIT: there was a mistake for 3rd and 4th quadrant, I edited the code!
Last edited by Softcore on 11 Jan 2013 14:42, edited 1 time in total.