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 StoreLoopy Pro is your all-in-one musical toolkit. Try it for free today.
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
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: 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:
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.
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.
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.
What I'd like you to do is add this functionality:
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?
I meant initialize to 0 when the app loads
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.)
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:
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.
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 ?
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.
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.
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