Hauptwerk and sysex

Discuss Lemur and share techniques.
Post Reply
gjschipper
Newbie
Posts:16
Joined:27 Jun 2014 07:38
Hauptwerk and sysex

Post by gjschipper » 27 Jun 2014 10:50

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

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Hauptwerk and sysex

Post by oldgearguy » 27 Jun 2014 12:32

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.

gjschipper
Newbie
Posts:16
Joined:27 Jun 2014 07:38

Re: Hauptwerk and sysex

Post by gjschipper » 28 Jun 2014 19:34

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?

gjschipper
Newbie
Posts:16
Joined:27 Jun 2014 07:38

Re: Hauptwerk and sysex

Post by gjschipper » 28 Jun 2014 20:19

It's the function arraytostring :)
Where can I find a list of functions?

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Hauptwerk and sysex

Post by oldgearguy » 29 Jun 2014 10:35

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);

gjschipper
Newbie
Posts:16
Joined:27 Jun 2014 07:38

Re: Hauptwerk and sysex

Post by gjschipper » 30 Jun 2014 14:08

Clear! It's working fine now!

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Hauptwerk and sysex

Post by oldgearguy » 30 Jun 2014 15:12

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)

Post Reply