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 Help Line

1246716

Comments

  • No, this was an example, I don't mean if and elseif. I want to see what exactly should be written for the Log so that the cc number and cc value issued from the pad are displayed by the Log.

    Because when I write something like this, Such a message is sent :

    cc# number0ccvalue0
    [OnPadDown] Syntax Error: unknown or invalid argument "CCVALUE"
    [OnPadDown] Syntax Error: unknown or invalid argument "CCNUM"

    @OnPadDown

    if LastPad = 0
    SendMIDICC 1, 4, 113
    Log {cc# number},ccnum ,{ccvalue}, ccvalue ??

    endif

    @End

  • @pejman said:
    No, this was an example, I don't mean if and elseif. I want to see what exactly should be written for the Log so that the cc number and cc value issued from the pad are displayed by the Log.

    Because when I write something like this, Such a message is sent :

    cc# number0ccvalue0
    [OnPadDown] Syntax Error: unknown or invalid argument "CCVALUE"
    [OnPadDown] Syntax Error: unknown or invalid argument "CCNUM"

    @OnPadDown

    if LastPad = 0
    SendMIDICC 1, 4, 113
    Log {cc# number},ccnum ,{ccvalue}, ccvalue ??

    endif

    @End

    That syntax error is telling you that there is no variable named ccnum and no variable named ccalue

    If you added this to the script you showed above, you are getting the error because there are variables with those names.

  • @pejman: it is important for you to understand the error messages that Mozaic returns. If you see something like that, the first thing you should do is look at the message carefully. If you see something in quotes, look in your script in the location it tells you.

    It is telling you that there is a syntax error -- which means a line that it can't make sense of -- in OnPadDown.

    Do you see CCVALUE or CCNUM in OnPadDown?

    Until you assign a value to CCVALUE or CCNUM in the script, those words mean nothing to Mozaic.

  • I hope it’s ok to jump in here. If not please let us know.

    Here’s how’s to get the CCNUM and CCVALUE that is being sent:

    SendMIDICC 1, 4, 113
    Log {cc# number}, 4,{ccvalue}, 113

    You choose those values. To use variables do this:

    CCNUM = 4
    CCVALUE = 113

    SendMIDICC 1, CCNUM, CCVALUE
    Log {cc# number = },ccnum ,{ ccvalue = }, ccvalue

    Note: Mozaic is case insensitive for variable names. Also notice you need to added spaces to have it logged with spaces.

  • Thank you very much for your explanation. But unfortunately, my problem cannot be solved by the method you said.

    My goal is if I hit the pad number 0, will the cc number and CC value be issued from it or not. If it is exported, show me in the log.
    Just like when I use an external midi monitor and when I hit pad number 0, the monitor shows the number of channel and cc and cc value.

    But if we want to act with the method you mentioned , and disable the command of ( SendMIDICC 1, CCNUM, CCVALUE ) , The log keeps sending this message :
    ( cc# number = 4 ccvalue = 113 ).
    That is, in this case, the log has nothing to do with whether the cc is sent or not.

    @OnPadDown

    CCNUM = 4
    CCVALUE = 113

    if LastPad = 0

    ////SendMIDICC 1, CCNUM, CCVALUE

    Log {cc# number = },ccnum ,{ ccvalue = }, ccvalue

    endif

    @End

  • @pejman said:
    Thank you very much for your explanation. But unfortunately, my problem cannot be solved by the method you said.

    My goal is if I hit the pad number 0, will the cc number and CC value be issued from it or not. If it is exported, show me in the log.
    Just like when I use an external midi monitor and when I hit pad number 0, the monitor shows the number of channel and cc and cc value.

    But if we want to act with the method you mentioned , and disable the command of ( SendMIDICC 1, CCNUM, CCVALUE ) , The log keeps sending this message :
    ( cc# number = 4 ccvalue = 113 ).
    That is, in this case, the log has nothing to do with whether the cc is sent or not.

    @OnPadDown

    CCNUM = 4
    CCVALUE = 113

    if LastPad = 0

    ////SendMIDICC 1, CCNUM, CCVALUE

    Log {cc# number = },ccnum ,{ ccvalue = }, ccvalue

    endif

    @End

    @pejman: in order for these lessons to work, I am going to ask that for the time being that we stick to the script that we are working on. We are working to make sure that at every step of the way that you have a complete understanding. I would like to ask to leave this aside for the moment since the tutorial script you wrote doesn't have CCs. Let's try not to get side-tracked.

    Is that ok?

  • I'm very sorry, maybe I should have asked my question clearly from the beginning, maybe my question was not clear enough that the posts were so long, I didn't want this at all.

    Yes, I agree, we continue on our main path.

  • @pejman wrote:

    1, Question about this paragraph: Inside this array we can store whatever we like: every cell is exactly like any other variable. The powerful thing is that we can reference each cell by its index number. We can use this to ‘parametrize’ our code:

    I do not understand the meaning of this sentence very well : ( we can reference each cell by its index number ).

    Think of arrays as cupboards in which you can store information (numbers in our case). Each cupboard has a name and has a number of slots where we can store information.

    To put things in the cupboard or take them them out, you need the name of the cupboard AND the number of the slot in which it is stored. The number of the slot is called an index. Its the address of the information.

    Here is a diagram of the notenum array you created in your script with this line of code:

    ``` notenum = [49, 51, 54, 56, 58, 61, 63, 66]

    In Bram's example, he has

    notenum = [49, 51, 54, 56, 58, 61, 63, 66]

    Each of those numbers is a "slot" in our array. Mozaic allows you to put a bunch of numbers into an array at once without explicitly mentioning their index (the slot number). This may be confusing if you don't fully understand arrays.

    The notenum assignment above does the exact same thing as:

    notenum[0] = 49
    notenum[1] = 51
    notenum[2] = 54
    notenum[3] = 56
    notenum[4] = 58
    notenum[5] = 61
    notenum[6] = 63
    notenum[7] = 66

    AND notenum = 49 is the same thing as saying notenum[0] = 49

    Every variable is really an array.

    ================ YOUR QUESTION
    You said that this wasn't clear: "we can reference each cell by its index number"

    This just means that we can access the contents of an array by using its number. This is convenient for accessing related information.

    For example, our notenum array is associated with pads 0 through 7. So we can use the pad number to retrieve the note it plays just by using its number.

    So, to get the note number for pad 3 we use the index 3 with our notenum array.

    pad 3's note number is notenum[3]

    =========== RELATED EXERCISE

    So, let's expand your program to make use of this. I'd like to add an array to your program called noteColors. It should be an array with 8 slots (cells as Bram calls them) just like the notenum array. Each slot should contain a color number (use the numbers that colorPad uses).

    When your program loads, use the noteColors array to set the colors of pads 0 through 7

  • Should I create the exercise that you suggest in the script that Wim created for me ( Without my manipulations ) ?

  • Wouldn't it be better to start this exercise with a new script?
    As long as I don't mix it with previous issues and In order not to get confused.

  • @pejman said:
    Wouldn't it be better to start this exercise with a new script?
    As long as I don't mix it with previous issues and In order not to get confused.

    I’d like you to add this to the tutorial script from the Mozaic manual.

    We are sticking with one base to ensure all elements are understood and reenforce your understanding.

  • edited May 2023


    @OnLoad ShowLayout 2 // these are the 8 notenumbers for Ruismaker drums notenum = [49, 51, 54, 56, 58, 61, 63, 66] notecolors = [2,1,6,0,5,7,4,3] p = LastPad for p = 0 to 7 ColorPad p, notecolors[p] LabelPad p, notenum[p] endfor @End @OnPadDown if LastPad < 8 nn = notenum[LastPad] vel = LastPadVelocity SendMIDINoteOn 0, nn, vel SendMIDINoteOff 0, nn, 0, 500.0 endif @End
  • I edited the script

  • Thank you very much for your clear explanation.

  • @pejman: Nice work!

    Now, let's get into some changes where you'll be using knobs to change those arrays.

    Here is the next stage. Add this functionality to your script.

    • in the loading section, put the array setups inside an if-block so that they only get initialized the first time the script loads
    • in the load section assign 0 to a variable called padUsedFlag.
    • label knob 0 "note #"
    • label knob 1 "color"
    • setup the note knob so that

    What I'd like you to do is add this functionality:

    • when a pad is touched, set padUsedFlag to 1.
    • if knob 0 or 1 is turned and padUsedFlag is 0, change the knobs area label to "Error"
    • when a pad is touched change the knobs area label to "Pad n" where n is the pad number
    • when a pad is touched, set knob 0's value to the note number associated with the pad and set the knob's label to that number
    • when a pad is touched, set knob 1's value to the color associated with the pad. HINT: you should use TranslateScale to map from the color number range to the knob's range (0 to 127)
    • when knob 0 is changed, round the value, check to see if it is different from the previous value. if it is different, play the midi note AND store the knob's value back into the noteNum array
    • when knob 1 is changed, translate the value back to the color range, if the value is different from the old value, color the pad with the new value and store the new value back into the array
  • Hi @espiegel.

    I know that padUsedFlag is one variable .

    But I don't understand what you mean by these two lines.

    when a pad is touched, set padUsedFlag to 1.
    if knob 0 or 1 is turned and padUsedFlag is 0, change the knobs area label to "Error"

  • @pejman said:
    Hi @espiegel.

    I know that padUsedFlag is one variable .

    But I don't understand what you mean by these two lines.

    when a pad is touched, set padUsedFlag to 1.
    if knob 0 or 1 is turned and padUsedFlag is 0, change the knobs area label to "Error"

    You are going to use padUsefFlag to indicated whether any pad has been touched yet. In this example That matters because turning a knob is supposed to change something about the most recently touched pad.

    We don’t want them to do anything if a pad hasn’t been touched.

    For simplicity, I am asking you to use a variable to know whether a pad has been touched.

    So, initialize0 it to -1 when the script loads.

    If a knob is turned and the flag is 0, do nothing but display an error. If it is 0 , it means no pad has been touched.

  • @pejman : I should gave asked , which part of the instruction wasn’t clear? Are you unclear about how to make use of whether padUsedFlag is 0 or 1?

  • Thanks for explanation.

    You said ; So, initialize0 it to -1 when the script loads. ( initialize0 ) ? ( to -1 ) ?
    you said already to assign padusedflag to 0 in the onload section =>( in the load section assign 0 to a variable called padUsedFlag. )

    Are you unclear about how to make use of whether padUsedFlag is 0 or 1?
    Yes .

    Is the padusedflag the same as lastpad?

  • edited May 2023

    @pejman said:
    Thanks for explanation.

    You said ; So, initialize0 it to -1 when the script loads. ( initialize0 ) ? ( to -1 ) ?
    you said already to assign padusedflag to 0 in the onload section =>( in the load section assign 0 to a variable called padUsedFlag. )

    I meant initialize to 0 when the app loads

    Are you unclear about how to make use of whether padUsedFlag is 0 or 1?
    Yes .

    Is the padusedflag the same as lastpad?

    No, the flag is not the same as lastPad. Its purpose is to tell you if any pad has been tapped since you loaded the script.

    I'd like you to carefully read again my original instructions:
    https://forum.audiob.us/discussion/comment/1208123/#Comment_1208123

    [EDIT] I give pretty precise directions about what to do with it. If it is not clear, "initialize" means to assign a variable a starting value. If padUsedFlag is 0, it tells your script no pad has ever been tapped since the script loaded IF you follow the directions I have about when to change its value.

    (The paragraph above edited for clarity.)

  • _ki_ki
    edited May 2023

    Perhaps another clarification: LastPad isn‘t a variable at all. It is Mozaic build-in function returning the index of the last pressed pad. There are many parameterless Mozaic functions that might look like they are variables:

    • MIDIChannel MIDICommand MIDINote MIDIVelocity MIDIByte1 MIDIByte2 MIDIByte3 MIDISustainPedalDown
    • SysexSize HostTempo HostBar HostBeat HostBeatsPerMeasure HostRunning CurrentMetroPuls
    • LastAUParameter QuarterNote GetXValue GetYValue LastKnob LastPad LastPadVelocity
    • MotionPitch MotionYaw MotionRoll ShiftPressed SystemTime NO YES TRUE FALSE

    Never ever assign to these, at the point in time when that part of the script code runs, a variable of the same name is created and the original Mozaic function is no longer accessible and will not be called. (See spoiler for sample)

    A single LastPad = 1 in you script and pressing pads won‘t change LastPad to the number of the currend pad.

    Never use any of the Mozaic build-in names as variable name - i have seen scripts using ‚div‘ as variable name accidentially shadowing the buildin Div function.

    @OnLoad
      ShowLayout 2
      LabelPads {Pads press updates this label. SHIFT assigns to LastPad and thereby 'kills' the LastPad function}
    @End
    
    @OnShiftDown
      LastPad = 0
      LabelKnobs {LastPad is now a variable}
    @End 
    
    @OnPadDown
      LabelPads {Pad },LastPad, { pressed}
    @End 
    
  • @_ki said:
    Never ever assign to these, at the point in time when that part of the script code runs, a variable of the same name is created and the original Mozaic function is no longer accessible and will not be called. (See spoiler for sample)

    Don’t you think Mozaic should tag this as an “error” on load an refuse to run? Most languages call the “function names” protected tokens that cannot be used for variable names. I don’t expect Bram will give us a major update since it’s really an exceptionally well behaving application and the user needs to assume responsibility for coding errors and doing this is an unannounced error situation.

    Mozaic is such a wonderful tool and a true gift to IOS hackers.

  • @ki_ thanks
    The information was very useful for me. Thank you very much for your explanation, and nice example .

  • @McD Yes, there could be more syntax checks in Mozaic, but i suspect that not adding more checks was a deliberate and well thought about decision. Tests and error output cost cpu time and resources, the interpreters code size would grow making it harder to manage etc.

    As a work-around the ‘Mozaic Language Support’ for Code Text Editors features full Moazic syntax error checking in Textastic and Sublime:

  • I remember getting the bright idea that I could “re-play” a users session by setting LASTPAD values and then writing “Call OnPadDown”. I thought I had a real cool extra feature to be able to record pad sequences and play them back later.

    I posted my “achievement” and @_Ki slipped me a clue: “Once you assign LASTPAD, it is now a variable and the LASTPAD function will never work again as intended.”

    It would be nice if programmers are not allowed to shoot their foot off and not need @_Ki to point out their bloody stump.
    Still, driving this point home is key. If @pejman has been setting LASTPAD or other reserved functions then things would get weird fast and no amount of Logging variables will disclose this violation of the runtime engine’s “rules” or syntax treatment.

  • Does ( p = LastPad ) also cause the same problem ?

  • @McD said:
    Still, driving this point home is key. If @pejman has been setting LASTPAD or other reserved functions then things would get weird fast and no amount of Logging variables will disclose this violation of the runtime engine’s “rules” or syntax treatment.

    This hasn’t happened in the scripts we’ve looked at together.

  • edited May 2023

    @espiegel123 said:

    @McD said:
    Still, driving this point home is key. If @pejman has been setting LASTPAD or other reserved functions then things would get weird fast and no amount of Logging variables will disclose this violation of the runtime engine’s “rules” or syntax treatment.

    This hasn’t happened in the scripts we’ve looked at together.

    That's why I asked this question : Does ( p = LastPad ) also cause the same problem ?

    Because I also doubted that maybe this type of coding removes LastPad from mozaic function mode.

  • @pejman said:
    Does ( p = LastPad ) also cause the same problem ?

    No. The variable “p” is assigned the value of the Function “LastPad” without LastPad behavior being changed in any way.

    If you switch the order to:
    LastPad = p

    Then Mozaic creates a new variable called “LastPad” and starts to use it everytime as a variable when LastPad occurs in a script.

  • @pejman said:

    @espiegel123 said:

    @McD said:
    Still, driving this point home is key. If @pejman has been setting LASTPAD or other reserved functions then things would get weird fast and no amount of Logging variables will disclose this violation of the runtime engine’s “rules” or syntax treatment.

    This hasn’t happened in the scripts we’ve looked at together.

    That's why I asked this question : Does ( p = LastPad ) also cause the same problem ?

    Because I also doubted that maybe this type of coding removes LastPad from mozaic function mode.

    This only applies to assigning a value to LastPad which means when LastPad is on the left side of the equals sign.

    p = LastPad is fine

    LastPad = p is not fine

Sign In or Register to comment.