Welcome to %s forums

BrainModular Users Forum

Login Register

Scripting - Text Input Stream Separation

I need help on a Patch
Post Reply
sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 28 Nov 2017, 21:15

Hello!

So I am trying to wrap my head around this at the moment.
I have incoming messages. Most of these messages are hex, with about 5 bits per message max for standard messages.


The problem I am having is separating each of the characters in the stream.
I believe I could just bring these in as Array, but I don't think there is any integer to ASCII conversions within the fastscripting.
If there was I think this would be easier to do.

So the path at the moment I am looking at is text input...however I don't know how I would separate each character to process?
Messages at times I would expect to asynchronously come in and together so when I bring in the message would be a full byte not in consistent fashion.


Any suggestions or ideas with Fastscript on how I could bring/shift each character into a variable easily as they come in?
Or is there a method to take the Array input and do some sort of ASCII conversion?


-s
"Every act of creation is first an act of destruction." -Picasso

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 28 Nov 2017, 22:07

not sure got it all

but you can convert an int to a ascii char in script using

mychar := Chr(myint); // where myint is an int and mychar is a char

so looping thru you arrayin, myint being i you get each chars.

or use the function StrGet(var S : String; i : Integer) : Char; //to exctact a char from a string.

or as text is virtually an array of ascii char already in usine you can seamlessly just plug a string in an array or an array to a texfield to convert both ways if thats more conveniant.

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 29 Nov 2017, 01:54

Yeah I knocked out, I was pretty dopey when I wrote this...but you answered everything I was looking for man...lol :lol:
Im bringing in and parsing serial data from my Mackie d8b. Commands are like 5-char... CHXXi,
so the text representation is then in hex...ex... Fader would be like 1087f (channel 10, value 87, fader).

So I was figuring out how I can shift the data in and parse the characters.....I did find that bringing the Array in was the best idea...but still wanted to be able to convert back and forth for other things.

Just kinda started realizing how Usine did the Array/ASCII stuff.

But awesome thanks 23fx23!
Thanks for the help!


-s
"Every act of creation is first an act of destruction." -Picasso

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests