Loopy Pro: Create music, your way.

What is Loopy Pro?Loopy Pro is a powerful, flexible, and intuitive live looper, sampler, clip launcher and DAW for iPhone and iPad. At its core, it allows you to record and layer sounds in real-time to create complex musical arrangements. But it doesn’t stop there—Loopy Pro offers advanced tools to customize your workflow, build dynamic performance setups, and create a seamless connection between instruments, effects, and external gear.

Use it for live looping, sequencing, arranging, mixing, and much more. Whether you're a live performer, a producer, or just experimenting with sound, Loopy Pro helps you take control of your creative process.

Download on the App Store

Loopy Pro is your all-in-one musical toolkit. Try it for free today.

Mozaic: Variable already "assigned" when script loaded but unassigned when code "uploaded"

Not sure if this is intentional, but for me it's a bug:
When I load a script for the first time, a test variable is reported as already assigned.
When I go to the code section and click on "Upload", the variable is unassigned.
I would expect the variable in both cases not to be assigned.
I tried both with the stand alone version of Mozaic, and with the AUv3. Both show this behaviour.
The test script is rather simple:

@OnLoad
if Unassigned variable
log {not assigned}
variable = 1
else
log {assigned}
log variable
endif
@End

Comments

  • @catherder said:
    Not sure if this is intentional, but for me it's a bug:
    When I load a script for the first time, a test variable is reported as already assigned.
    When I go to the code section and click on "Upload", the variable is unassigned.
    I would expect the variable in both cases not to be assigned.
    I tried both with the stand alone version of Mozaic, and with the AUv3. Both show this behaviour.
    The test script is rather simple:

    @OnLoad
    if Unassigned variable
    log {not assigned}
    variable = 1
    else
    log {assigned}
    log variable
    endif
    @End

    It displays unassigned when I upload it.

    What are the exact steps from first uploading the patch until it displays assigned?

  • @espiegel123 said:

    @catherder said:
    Not sure if this is intentional, but for me it's a bug:
    When I load a script for the first time, a test variable is reported as already assigned.
    When I go to the code section and click on "Upload", the variable is unassigned.
    I would expect the variable in both cases not to be assigned.
    I tried both with the stand alone version of Mozaic, and with the AUv3. Both show this behaviour.
    The test script is rather simple:

    @OnLoad
    if Unassigned variable
    log {not assigned}
    variable = 1
    else
    log {assigned}
    log variable
    endif
    @End

    It displays unassigned when I upload it.

    What are the exact steps from first uploading the patch until it displays assigned?

    With “load” I mean the load button that loads the patch as opposed to “upload” from the code section. This is what I observe:

    • create the patch and save it. Let’s call it “test”.
    • Load “test”. It shows the variable falsely as assigned. I would expect a freshly loaded script to have unassigned variables.
    • If you upload the already loaded code, the script will show correctly an unassigned variable.
  • @catherder said:

    @espiegel123 said:

    @catherder said:
    Not sure if this is intentional, but for me it's a bug:
    When I load a script for the first time, a test variable is reported as already assigned.
    When I go to the code section and click on "Upload", the variable is unassigned.
    I would expect the variable in both cases not to be assigned.
    I tried both with the stand alone version of Mozaic, and with the AUv3. Both show this behaviour.
    The test script is rather simple:

    @OnLoad
    if Unassigned variable
    log {not assigned}
    variable = 1
    else
    log {assigned}
    log variable
    endif
    @End

    It displays unassigned when I upload it.

    What are the exact steps from first uploading the patch until it displays assigned?

    With “load” I mean the load button that loads the patch as opposed to “upload” from the code section. This is what I observe:

    • create the patch and save it. Let’s call it “test”.
    • Load “test”. It shows the variable falsely as assigned. I would expect a freshly loaded script to have unassigned variables.
    • If you upload the already loaded code, the script will show correctly an unassigned variable.

    That is by design I believe. As soon as that script loads when uploaded, the variable is assigned a value. When you save the script, its variables get saved. So when you Load, you are loading a script that was saved after the variable was assigned.

  • wimwim
    edited August 19

    (deleted due to posting before the coffee kicked in)

  • @espiegel123 said:

    @catherder said:

    @espiegel123 said:

    @catherder said:
    Not sure if this is intentional, but for me it's a bug:
    When I load a script for the first time, a test variable is reported as already assigned.
    When I go to the code section and click on "Upload", the variable is unassigned.
    I would expect the variable in both cases not to be assigned.
    I tried both with the stand alone version of Mozaic, and with the AUv3. Both show this behaviour.
    The test script is rather simple:

    @OnLoad
    if Unassigned variable
    log {not assigned}
    variable = 1
    else
    log {assigned}
    log variable
    endif
    @End

    It displays unassigned when I upload it.

    What are the exact steps from first uploading the patch until it displays assigned?

    With “load” I mean the load button that loads the patch as opposed to “upload” from the code section. This is what I observe:

    • create the patch and save it. Let’s call it “test”.
    • Load “test”. It shows the variable falsely as assigned. I would expect a freshly loaded script to have unassigned variables.
    • If you upload the already loaded code, the script will show correctly an unassigned variable.

    That is by design I believe. As soon as that script loads when uploaded, the variable is assigned a value. When you save the script, its variables get saved. So when you Load, you are loading a script that was saved after the variable was assigned.

    +1. This is discussed on page 12 of the manual, in the section on "Advanced shizzle: variables, initialization and state-saving"

     If only there was a way of knowing whether we’re running the script for the very
    first time (in which case we want to initialize) or just loaded a previously saved preset from a file (in which
    case we don’t)… There is!
    
    @OnLoad
      if Unassigned testvariable
        // testvariable does not exist yet,
        // so we know we’re running the script for the first time!
        // we can safely create and initialize it!
        testvariable = 0
      endif
    @End
    
  • @hes said:

    @espiegel123 said:

    @catherder said:

    @espiegel123 said:

    @catherder said:
    Not sure if this is intentional, but for me it's a bug:
    When I load a script for the first time, a test variable is reported as already assigned.
    When I go to the code section and click on "Upload", the variable is unassigned.
    I would expect the variable in both cases not to be assigned.
    I tried both with the stand alone version of Mozaic, and with the AUv3. Both show this behaviour.
    The test script is rather simple:

    @OnLoad
    if Unassigned variable
    log {not assigned}
    variable = 1
    else
    log {assigned}
    log variable
    endif
    @End

    It displays unassigned when I upload it.

    What are the exact steps from first uploading the patch until it displays assigned?

    With “load” I mean the load button that loads the patch as opposed to “upload” from the code section. This is what I observe:

    • create the patch and save it. Let’s call it “test”.
    • Load “test”. It shows the variable falsely as assigned. I would expect a freshly loaded script to have unassigned variables.
    • If you upload the already loaded code, the script will show correctly an unassigned variable.

    That is by design I believe. As soon as that script loads when uploaded, the variable is assigned a value. When you save the script, its variables get saved. So when you Load, you are loading a script that was saved after the variable was assigned.

    +1. This is discussed on page 12 of the manual, in the section on "Advanced shizzle: variables, initialization and state-saving"

     If only there was a way of knowing whether we’re running the script for the very
    first time (in which case we want to initialize) or just loaded a previously saved preset from a file (in which
    case we don’t)… There is!
    
    @OnLoad
      if Unassigned testvariable
        // testvariable does not exist yet,
        // so we know we’re running the script for the first time!
        // we can safely create and initialize it!
        testvariable = 0
      endif
    @End
    

    Ah! Getting it now. I read that page but somehow forgot the “very first time”. So my wrong assumption was that the actual preset/script only contains code, but no data.

  • @catherder said:
    Ah! Getting it now. I read that page but somehow forgot the “very first time”. So my wrong assumption was that the actual preset/script only contains code, but no data.

    There are probably very few of us who haven't been caught out occasionally by forgetting that at one point or another. I really hate it when I accidentally forget and upload a script to patch storage after having tweaked knobs and things in order to create a screenshot. 😂

    It's a good feature though.

  • edited August 20

    @wim said:

    @catherder said:
    Ah! Getting it now. I read that page but somehow forgot the “very first time”. So my wrong assumption was that the actual preset/script only contains code, but no data.

    There are probably very few of us who haven't been caught out occasionally by forgetting that at one point or another. I really hate it when I accidentally forget and upload a script to patch storage after having tweaked knobs and things in order to create a screenshot. 😂

    It's a good feature though.

    It is a good feature. And thanks for the compassion :) But I just found another thing that added to my confusion - and causes trouble in my current Mozaic project: Because of the lack of multi dimensional arrays I often use the NoteState functions as a replacement. Sadly values stored as NoteState will not be saved with the script file but with the NoteStates you always start with a clean slate.
    One would probably argue that these are functions and not arrays. However, one could also argue that these functions access arrays (that should be saved....). ;)

  • @catherder said:

    Because of the lack of multi dimensional arrays

    The best workaround for multi-dimensional is to create a series of arrays that can get/set column values by using the same index value.

    You still have the burden of using each array element in the code but it helps visualize a matrix or table of values.

    I like to create tables of midi input:

    Type
    Note
    Velocity
    TimeOffset
    CC
    Value

    Each inserted or recalled using the same index.

    You can make a midi recorder using this idea.

    You can replay batches of 255 notes using the TimeOffset as a delay value.

  • wimwim
    edited August 20

    @catherder said:
    It is a good feature. And thanks for the compassion :) But I just found another thing that added to my confusion - and causes trouble in my current Mozaic project: Because of the lack of multi dimensional arrays I often use the NoteState functions as a replacement. Sadly values stored as NoteState will not be saved with the script file but with the NoteStates you always start with a clean slate.
    One would probably argue that these are functions and not arrays. However, one could also argue that these functions access arrays (that should be saved....). ;)

    Are you sure about that? I don't think I've seen that behavior.
    [edit] nvm. I see what you mean.

    I can see the logic of it, since you wouldn't think a session would ever be loaded with actual Notes in anything other than an OFF state. But I can also see why you'd expect it to behave like a regular variable.

    I generally use other ways around the variable length limitations, but they do kind of clutter up code.

Sign In or Register to comment.