Two SysEx parameters on one fader. (For a range of 0-255
-
- Newbie
- Posts: 6
- Joined: 14 Apr 2012 09:13
Two SysEx parameters on one fader. (For a range of 0-255
Hi.
I'm creating various editors for hardware synths that only use sysex, in this case the yamaha tg33 (sy22). Some of the parameters have a range of 0-255 rather than the usual 0-127 & they use two different sysex messages to control them, one that controls 0-127 & another that controls 128-255. I'm programming sliders/knobs with a maximum range of 0-127 by using scripts like this for each knob/slider.....
midiout(2, {0xF0, 0x43, 0x10, 0x26, 0x02, 0x02, 0x00, 0x00, 0x09, 0x01, 0x7F, 0x00, x*127, 0xF7}); ... ('x' being the fader variable & '127' representing the range) and all is working well for parameters that have a maximum range of 127.
here's an example of a parameter (oscillator b waveform) that has a range of 0-255, see how it uses two different messages that are the same except for the single '01' before the variable in the second. i can assign each to a different slider (one that controls 0-127 & another that controls 128-255) & it works well but i'd like to assign both messages to one fader so the first half of the fader controls the first message (0-127) & the second half of the fader controls the second message (128-255). any ideas?
0-127.......
midiout(2, {0xF0, 0x43, 0x10, 0x26, 0x02, 0x00, 0x01, 0x00, 0x16, 0x01, 0x7F, 0x00, x*127, 0xF7});
128-255......
midiout(2, {0xF0, 0x43, 0x10, 0x26, 0x02, 0x00, 0x01, 0x00, 0x16, 0x01, 0x7F, 0x01, x*127, 0xF7});
also, is there a way to reverse the 'polarity' of a fader so at the bottom the fader value is 127 & the value is 0 at the top? some of the parameters on the tg33 are in reverse & i'd like them to be 'normal' as some parameters like short envelope times being represented by a fader with a high value just doesn't feel natural.
All the best & thanks for your time & help....
pat.
I'm creating various editors for hardware synths that only use sysex, in this case the yamaha tg33 (sy22). Some of the parameters have a range of 0-255 rather than the usual 0-127 & they use two different sysex messages to control them, one that controls 0-127 & another that controls 128-255. I'm programming sliders/knobs with a maximum range of 0-127 by using scripts like this for each knob/slider.....
midiout(2, {0xF0, 0x43, 0x10, 0x26, 0x02, 0x02, 0x00, 0x00, 0x09, 0x01, 0x7F, 0x00, x*127, 0xF7}); ... ('x' being the fader variable & '127' representing the range) and all is working well for parameters that have a maximum range of 127.
here's an example of a parameter (oscillator b waveform) that has a range of 0-255, see how it uses two different messages that are the same except for the single '01' before the variable in the second. i can assign each to a different slider (one that controls 0-127 & another that controls 128-255) & it works well but i'd like to assign both messages to one fader so the first half of the fader controls the first message (0-127) & the second half of the fader controls the second message (128-255). any ideas?
0-127.......
midiout(2, {0xF0, 0x43, 0x10, 0x26, 0x02, 0x00, 0x01, 0x00, 0x16, 0x01, 0x7F, 0x00, x*127, 0xF7});
128-255......
midiout(2, {0xF0, 0x43, 0x10, 0x26, 0x02, 0x00, 0x01, 0x00, 0x16, 0x01, 0x7F, 0x01, x*127, 0xF7});
also, is there a way to reverse the 'polarity' of a fader so at the bottom the fader value is 127 & the value is 0 at the top? some of the parameters on the tg33 are in reverse & i'd like them to be 'normal' as some parameters like short envelope times being represented by a fader with a high value just doesn't feel natural.
All the best & thanks for your time & help....
pat.
-
- Newbie
- Posts: 25
- Joined: 13 Apr 2012 23:48
Re: Two SysEx parameters on one fader. (For a range of 0-255
Check out the attached jzml to see if that's what you need. I've been fighting with multi-byte parameters for some Yamaha console controls I'm trying to get running for awhile now, and am finally starting to get a grasp on it. I didn't spend a whole lot of time naming stuff on the template, but it gets the job done. In your case, where you have ...0x00, x*127... you'd substitute the variable you choose to use, or skip the variable and just put the "floor(val)>>7,floor(val)&0x7F" straight in the midiout string. My variable "test" is for converting back from the sysex in, so that the knobs onscreen can match up with the device.
For 127 to 0, I did val=127-round(range(x,0,127)), so that when the knob is at the bottom (127-0)=127, and at the top (127-127)=0. Again, test is just for incoming conversion, but nothing out of the ordinary there if that's the range your knob naturally transmits.
I've read in a few posts on here, and have found it to definitely help me - whenever I'm stumped I grab a clean page, throw in a fader and monitor, and figure out how to get the numbers to do what i want them to do, then go back and apply it to the real project.
Hope that helps, and that I understood what you're trying to do correctly.
CS
For 127 to 0, I did val=127-round(range(x,0,127)), so that when the knob is at the bottom (127-0)=127, and at the top (127-127)=0. Again, test is just for incoming conversion, but nothing out of the ordinary there if that's the range your knob naturally transmits.
I've read in a few posts on here, and have found it to definitely help me - whenever I'm stumped I grab a clean page, throw in a fader and monitor, and figure out how to get the numbers to do what i want them to do, then go back and apply it to the real project.
Hope that helps, and that I understood what you're trying to do correctly.
CS
- Attachments
-
- fader_range.jzml
- (10.94 KiB) Downloaded 95 times
-
- Newbie
- Posts: 6
- Joined: 14 Apr 2012 09:13
Re: Two SysEx parameters on one fader. (For a range of 0-255
Wow!
Thanks for your reply pngaudioguy & your effort in helping me out, I managed to squeeze both methods into my editor without too much head scratching. One more question: How would i use the multibyte array method with two parameters that have a range of 12 each? The TG33 uses two different parameters to control the pitch of oscillators, one for 12 semitones up & another for 12 semitones down as I'm currently using two menu's. (one for negative pitch values & another for positive pitch values)
All the best, Pat.
Thanks for your reply pngaudioguy & your effort in helping me out, I managed to squeeze both methods into my editor without too much head scratching. One more question: How would i use the multibyte array method with two parameters that have a range of 12 each? The TG33 uses two different parameters to control the pitch of oscillators, one for 12 semitones up & another for 12 semitones down as I'm currently using two menu's. (one for negative pitch values & another for positive pitch values)
All the best, Pat.
-
- Newbie
- Posts: 25
- Joined: 13 Apr 2012 23:48
Re: Two SysEx parameters on one fader. (For a range of 0-255
I'm trying to understand exactly how they are encoding the data. I take it that you have a string that includes ... xx, yy ... where xx is pitch shift down and yy is pitch shift up. When you shift 12 semitones down, what is the value of xx? When you shift 1 semitone down, what is the value of xx? Same for yy - when shifted 1 and 12 semitones up, what are the values? I'm assuming up is just 01-12, but not sure what method they used on down. Presumably 00 for both is no shift.
CS
CS
Re: Two SysEx parameters on one fader. (For a range of 0-255
Hi
Whenever possible it is best to get the Sysex info from the manufacturer rather than by discovery .
You could also look up 14-bit midi control messages to understand the 'multibyte method a bit more
For the Pitch Shift I would look at using a slider or knob in bipolar mode and scripting accordingly for the values.
Cheers
MM
Whenever possible it is best to get the Sysex info from the manufacturer rather than by discovery .
You could also look up 14-bit midi control messages to understand the 'multibyte method a bit more
For the Pitch Shift I would look at using a slider or knob in bipolar mode and scripting accordingly for the values.
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]
-
- Newbie
- Posts: 25
- Joined: 13 Apr 2012 23:48
Re: Two SysEx parameters on one fader. (For a range of 0-255
FWIW, Macciza's posts are how I finally figured out how to get 14 bit messages working (which is essentially what I sent previously.) I agree that manufacturer info is definitely preferred to discovery, however, in the few minutes I spent on google and scanning pdf files, I was unable to find what our compatriot was seeking, so decided to ask what the exact variable ranges he/she is seeking do. Your input is highly regarded, MM, and if you've got the manufacturer info on this, kingpeepee, that would help us help you.
-
- Newbie
- Posts: 6
- Joined: 14 Apr 2012 09:13
Re: Two SysEx parameters on one fader. (For a range of 0-255
Thanks for your reply guys, here's the info........
For the shift up (range in bold)....
F0 43 10 26 02 01 00 00 01 01 7F 00 00-0C F7 (0=0 shift, 0C = +12 shift)
For the shift down (range in bold)....
F0 43 10 26 02 01 00 00 01 01 7F 01 74-7F F7 (74 = -12 shift, 7F = -1 shift)
Again, thanks for your help, it's much appreciated. I'm more of a studio/synth guy than a programmer so this is all a bit new to me, I'm starting to get it though.
Best, Pat.
PS: I'm planning on using a bipolar knob/fader for this.....
For the shift up (range in bold)....
F0 43 10 26 02 01 00 00 01 01 7F 00 00-0C F7 (0=0 shift, 0C = +12 shift)
For the shift down (range in bold)....
F0 43 10 26 02 01 00 00 01 01 7F 01 74-7F F7 (74 = -12 shift, 7F = -1 shift)
Again, thanks for your help, it's much appreciated. I'm more of a studio/synth guy than a programmer so this is all a bit new to me, I'm starting to get it though.
Best, Pat.
PS: I'm planning on using a bipolar knob/fader for this.....
Re: Two SysEx parameters on one fader. (For a range of 0-255
Hi
Found this on the net - will be very handy if you don't have it yet . .
http://www2.yamaha.co.jp/manual/pdf/emi ... G33E_2.PDF
Old school sysex - reminds me of when I first hacked sysex info for the old FB-01, sighs . . .
If you have problems with any of this then post part of the project for debugging . .
Cheers
MM
Found this on the net - will be very handy if you don't have it yet . .
http://www2.yamaha.co.jp/manual/pdf/emi ... G33E_2.PDF
Old school sysex - reminds me of when I first hacked sysex info for the old FB-01, sighs . . .
If you have problems with any of this then post part of the project for debugging . .
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]
-
- Newbie
- Posts: 25
- Joined: 13 Apr 2012 23:48
Re: Two SysEx parameters on one fader. (For a range of 0-255
That is a very useful thing to have! Apparently I fail at google. There's a similar thing in the yamaha consoles on the EQ gain where range is -180 to 180 doing that same kind of thing. Here's how I resolved it. Like yourself I'm mostly an audio engineer and just do the coding as a hobby, so if there's a better solution, hopefully someone will chime in. In the meantime, this should work to at least get your control working. I know how frustrating it can be to pound your head against a formula that's keeping you from moving forward.
On the jazzmutant forum, Axel posted the following at http://forum.jazzmutant.com/viewtopic.p ... 752a#15653 in response to someone's inquiry. I think it does a good job of explaining the use of multiple bytes, using a fader range of 1024 as the demo, obviously.
Code: Select all
decl val;
val=floor(range(x,-12,12));
if(val<0) val=pow(2,8)+val;
midiout(0,{0xF0, 0x43, 0x10, 0x26, 0x02, 0x01, 0x00, 0x00, 0x01, 0x01, 0x7F, floor(val)>>7&0x7F, floor(val)&0x7F, 0xF7});
The first thing to do is to turn Fader.x into a 10-bit integer, in the 0..1023 range :
floor(Fader.x * 1024)
(Technically it could reach 1024, but let's not worry about that).
The SysEx spec requires the 10bit value to be sent in two separate bytes : the first will hold the 3 upper bits, the second one will hold the final 7 bits.
To get the 3 top bits of the 10 bits values, you need to shift it 7 bits to the right, which amount to dividing it by 128. So you get :
floor( Fader.x * 1024 / 128 ), which is floor( Fader.x * 8 )
To get the second byte, you need to extract only the 7 final bits of the Fader value. To do that, you just substract from the Fader value the amount calculated above, shifted 7 bits to the left :
floor( Fader.x * 1024) - floor( Fader.x * 8 ) * 128
Hope that explains a bit...
I can't test it where I'm at currently, but could you try the following SysEx string ? It uses bitwise operators which should simplify it a bit.
{0x06, 0x00, 32 + c, p, floor(Fader.x * 1024)>>7, floor(Fader.x * 1024) & 0x7F}
That basically means : shift 7 bits to the right to obtain the first byte, and keep only the last 7 bits to obtain the second byte.
axel
Site Admin
-
- Newbie
- Posts: 6
- Joined: 14 Apr 2012 09:13
Re: Two SysEx parameters on one fader. (For a range of 0-255
Thanks yet again pngaudioguy, it worked perfectly.
I'll have a look into Jazzmutant forum post, although at a glance it may be a little beyond me tbh.
It's good that people here are happy to share knowledge & help people like myself learn, it's refreshing.
Best, Pat.
I'll have a look into Jazzmutant forum post, although at a glance it may be a little beyond me tbh.
It's good that people here are happy to share knowledge & help people like myself learn, it's refreshing.
Best, Pat.