couple basic things

Home Forums General Using Ctrlr couple basic things

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #5207
    msepsis
    Participant
    • Topics: 219
    • Replies: 732
    • Total: 951
    • ★★★

    A couple basic things:

    How do I print the value of a variable in the console?

    Also how do I write a series of variables to a string? Say I have variables
    wb7, wb8, wb9,wb10 all the way to wb134 which are all 1 byte messages. I want to store them in sequence to a string named wbString.

     

     

     

    Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

    #5213
    dasfaker
    Keymaster
    • Topics: 80
    • Replies: 793
    • Total: 873
    • ★★★

    Print value to console:

    a = 10
    console("a = "..a)

    Write variables to string

    a = "a"
    b = 10
    c = string.format("%s%s",a,b)
    console("c = "..c)

    #5214
    msepsis
    Participant
    • Topics: 219
    • Replies: 732
    • Total: 951
    • ★★★

    thank you!!

     

    Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

    #5215
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    I’ll be a bit more specific.

    Not all data can be printed directly for example, some numbers might not get automagicly converted to Strings, to be safe use string.format() when dealing with strings. Here is a string tutorial for lua http://lua-users.org/wiki/StringLibraryTutorial read it, there are many nice things you can do in LUA.

    #5231
    msepsis
    Participant
    • Topics: 219
    • Replies: 732
    • Total: 951
    • ★★★

    thank you atom.. I was noticing exactly what you described .

    I’m curious now, to send a chunk of data to a string.

    Say I’ve obtained my data and assigned it to a variable through:

    programData = midiMessage:getLuaData():getRange(7,263)

    How do I then get each byte of that range into a string, comma delineated?

    Is there a quick way to send that range of incoming MIDI sysex 7-263 directly to a string?

    Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

    #5232
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    A string of what. String can represent many things, you can easily convert that data to a HEX string, but if you want ASCII characters (like a name of a patch that the device sends) then you need to converts each byte to an ASCII character.

    #5233
    msepsis
    Participant
    • Topics: 219
    • Replies: 732
    • Total: 951
    • ★★★

    Thanks again for posting that link. good stuff there. I also have Ierusalmimschy’s “Programming in Lua” earmarked to page 175 on the string library.

    I guess in the example I was giving w/ program data I would want to store the bytes in hex as they’re all the values for params on the synth.

    A couple of things I think I’m on the verge of figuring out in terms of why I wasn’t able to get the values I expected when trying to print them to the Lua console..

    Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Using Ctrlr’ is closed to new topics and replies.
There is currently 0 users and 60 guests online
No users are currently active
Forum Statistics
Threads: 2,495, Posts: 17,374, Members: 77,605
Most users ever online was 12 on January 22, 2019 3:47 pm
Ctrlr