Hi All,
Apologies if this has been asked and answered. I'm trying to figure out how to build strings dynamically in Lemur by concatenating a series of smaller strings. Ideally I would store the smaller strings in an array.
I am using the wonderful Missing Link (OSC over WiFi to MIDI box) wifimidi.com. The ML parses incoming OSC strings (addresses) containing MIDI hex data and sending the MIDI to its output.
What I'd like to do is assemble these OSC strings on-the-fly based on user input in Lemur.
Any suggestions would be appreciated.
How can I concatenate strings?
Re: How can I concatenate strings?
Here you go:
Hope that helps,
B.
Code: Select all
decl str1={1,2,3};
decl str2={4,5};
decl str3={7,8,9,0x0A};
decl string;
string={str1,str2,str3};
B.
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
Re: How can I concatenate strings?
Unfortunately there is no real string handling available. The "strings" in the example above are actually arrays containing an entry for each character in ASCII. Saying that, displaying a string like yours could like this:
Not sure if this helps,
B.
Code: Select all
decl txtsharpy={47,115,104,97,114,112,121,47};
decl i=3;
decl parameter={67,111,108,111,114,87,104,101,101,108,32,53};
decl s = arraytostring({ txtsharpy, i+48, 47, parameter });
setattribute(Text,'content',s);
B.
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
Re: How can I concatenate strings?
The array with a character per character approach is the only way I am aware of. Perhaps in a future version of Lemur?decl s = arraytostring({ '/sharpy/', i+49, '/', 'ColorWheel' });
doesn't work? Is there any way to make that work?
You could define the common used strings as variables (expressions), so that they are only defined once to avoid bugs.If I have to replace all of these strings with ascii arrays it is going to be quite a big pain! (and be potentially quite bug-prone).
E.g.: expression txtsharpy = {47,115,104,97,114,112,121,47} Then use "txtsharpy" whenever you need it in an osc command.
Not sure if values like 0.234 can be converted into an array./sharpy/1/Dimmer 0.234
Good Luck,
B.
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
Re: How can I concatenate strings?
Great job, really slick Yep, I agree some more string functions would be helpfull.
Cheers,
B.
Cheers,
B.
Win7 64, Ipad Lemur, Cubase6 and a bunch of Roland Synths and Samplers
Re: How can I concatenate strings?
Thanks for this. You saved me hours.memosan wrote:
A http://www.processing.org sketch that converts a string text to an array in the format of lemur:
-A
Re: How can I concatenate strings?
thanks for posting this - very cool. One question. What if the lemur object is the variable as opposed to message you wanted to send?
using the example above - what if the object you are referring to is the variable that you've defined with your arraytosring
like this:
setattribute(s, 'content', 'test'); // check address string
or in my case:
setexpression(s, 'x', 1); // turn button on
can't seem to make that work. i've confirmed s is correct (in this case s = LOOPER1.record, which is the name of the object i want to set the expression of) If i replace s with LOOPER1.record, it works, but with the declared variable s, it doesn't.
Any ideas?
Thanks!
using the example above - what if the object you are referring to is the variable that you've defined with your arraytosring
like this:
setattribute(s, 'content', 'test'); // check address string
or in my case:
setexpression(s, 'x', 1); // turn button on
can't seem to make that work. i've confirmed s is correct (in this case s = LOOPER1.record, which is the name of the object i want to set the expression of) If i replace s with LOOPER1.record, it works, but with the declared variable s, it doesn't.
Any ideas?
Thanks!