Page 1 of 1
Hauptwerk and sysex
Posted: 27 Jun 2014 10:50
by gjschipper
I use Lemur to send MIDI signals to Hauptwerk, this is working fine. (Hauptwerk is used as virtual pipeorgan simulator, see
http://www.hauptwerk.com).
Now I want to receive the sysex messages from Hauptwerk in my Lemur app, to show status information on a LCD screen.
I think I have to use the Surface LCD object, but I've no idea how to show the messages in my Lemur app.
If I capture the sysex messages with MIDI-OX I get a kind of:
00005230 4 4 F0 Buffer: 39 Bytes System Exclusive
SYSX: F0 7D 01 00 00 01 20 20 20 20 20 20 20 20 20 20 20 20
SYSX: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
SYSX: 20 20 F7
Any idea how to script or to implement this kind of feature in Lemur Liine?
Best regards,
Gert Jan
Re: Hauptwerk and sysex
Posted: 27 Jun 2014 12:32
by oldgearguy
to start, you need a script to receive the sysex data. Look on page 73 of the Lemur manual for the basic idea.
Inside the script, you can first just display the buffer to a Monitor object to see:
Monitor.value = MIDI_ARGS;
There are a lot of scripts already available that show how to receive sysex, change the values from hex to ASCII, and display them nicely. Look at the links at the bottom of any message posted by Softcore to start.
Re: Hauptwerk and sysex
Posted: 28 Jun 2014 19:34
by gjschipper
Thanks that's working now. But I can not found the function to convert the HEX string into ascii. Where can I find an example?
Re: Hauptwerk and sysex
Posted: 28 Jun 2014 20:19
by gjschipper
It's the function arraytostring
Where can I find a list of functions?
Re: Hauptwerk and sysex
Posted: 29 Jun 2014 10:35
by oldgearguy
You have to write that conversion. The best thing to do is look through all the Lemur templates people have posted and then download and edit them to see how it is done.
Here is something I pulled from a Waldorf microWave editor.
Create a manual script called arraytohex(array) and inside the script put this code:
Code: Select all
decl a, b, c , i;
c = sizeof(array)*3-1;
if(c>255) return({0x00}); // array size limit
a = fill(1,0x20,c);
// break up each number into two nibbles of 4 bits each.
// If the nibble is 9 or less, it's a number and add 30h to it.
// ASCII '0' is 0x30
// If the nibble
is greater than 9, add 0x37 to it.
// ASCII 'a' is
for(i = 0; i < c; i++)
{
b = array[i] >> 4;
a[i*3] = b > 9 ? b+55 : b+48;
b = array[i] & 0xF;
a[i*3+1] = b > 9 ? b+55 : b+48;
}
return arraytostring(a);
You can use it like this: Monitor.value = arraytohex(MIDI_ARGS);
Re: Hauptwerk and sysex
Posted: 30 Jun 2014 14:08
by gjschipper
Clear! It's working fine now!
Re: Hauptwerk and sysex
Posted: 30 Jun 2014 15:12
by oldgearguy
gjschipper wrote:Clear! It's working fine now!
Great! Glad it is working for you. Make sure you take time to understand what the script is doing. There is a check in there ( if(c>255) return({0x00}); // array size limit ) that will cause the script to return nothing if you pass in MIDI_ARGS with more than 84 bytes of data. The reason is the way the script stores and outputs the data.
You will have to either pass in parts of MIDI_ARGS or do something different if you have more than 84 bytes to display. One solution is to use subarray(MIDI_ARGS, 0, 84), subarray(MIDI_ARGS, 84, 84), etc to get the pieces. Another would be to rewrite the arraytohex() script to stream the bytes out (which is harder to do)