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
@espiegel123
@OnLoad
ShowLayout 2
for p = 4 to 15
LabelPad p, {pattern: },p-3
endfor
LabelPad 0, {1️⃣}
LabelPad 1, {2️⃣}
LabelPad 2, {3️⃣}
LabelPad 3, {4️⃣}
selectedtrack = 0
selectedpattern = 4
//only for when loading
ColorPad 0, 2
ColorPad 4, 7
trackpattern = [0,1,2,3]
@End
@OnPadDown
if lastPad < 4
call @trackSelected
else
call @patternSelected
endif
@End
@trackSelected
// When a track (pad 0-3) is tapped:
// make all other track pads white [by making previous pad white]
ColorPad selectedtrack, 0
// make the tapped pad yellow
ColorPad LastPad,2
//Update the pattern pads so the track’s associated pattern is pink (and all others are white)
// NEEDED: we need to add the code to update the pattern pads
// remember that this track is the current one
selectedtrack = LastPad
ColorPad trackpattern[LastPad] + 4 , 7
@end
@patternSelected
// When a pattern (pad 4-15) is tapped:
// make all other pattern pads white [by making previous pad white]
ColorPad selectedpattern, 0
// make the tapped pad pink
ColorPad LastPad, 7
// remember that this pattern is the current one
selectedpattern = LastPad
//Remember that this is the current pattern associated with the last track
//selectedpattern[trackpattern]
@end
I don't know if I put the code in the right place or not.
Is +4 correct or not?
I don't see any logical and correct behavior of the script at the moment .
every trackpad I touch turns pink after four tracks
If you upload the script and tap pad 0, what happens ?
If you tap pad 1, what happens?
What is happening that does not follow the logic of the script as it is written?
@espiegel123
Sorry for late.
you wrote:
If you upload the script and tap pad 0, what happens ?
pad 4 turns pink.
If you tap pad 1, what happens?
pad 5 turns pink.
What is happening that does not follow the logic of the script as it is written?
Probably because we haven't entered the necessary code in @patternselected part yet
And I have entered the wrong offset
@pejman wrote "I don't see any logical and correct behavior of the script at the moment ."
It is important at this stage that you be able to look at the script and be able to predict just from reading through the script what will happen. And we need to make sire before we go further that everything so far is clear.
When you say you don't see "any" logical and correct behavior, it gives me the impression that there is something not clear.
There are things that haven't been added to the script.
Please read through the script and compare it to the behavior you observed.
Is there anything that surprises you?
If so, please explain what?
So far, we are only looking at touching pads 0 thru 3. So @patternselected isn't relevant.
There is one piece of functionality missing in @trackselected.
Can you explain what isn't happening that should?
Can you propose in words (not Mozaic code) what needs to be done.
No, Unfortunately this script is very confusing to me and I don't understand any other connection between the codes. Even by reading the lines.
Unfortunately, I don't know
I only know to this extent that the pattern number should be saved in each track separately and then read again by touching each track. I only know this much.
So, we need to clarify your confusion. Please go through line by line and when you get to a line you don't understand, please post the line in a new message.
We can't move on until you understand what is in the script.
I also suggest that you re-read the Mozaic manual from the beginning until the end of the tutorials.
I am not asking for a technical explanation. You have said that the behavior is not correct. Say in words what behavior you observe that is not correct when touching the track pads.
Things for which I cannot find a solution
In @trackSelected
//Update the pattern pads so the track’s associated pattern is pink (and all others are white)
// NEEDED: we need to add the code to update the pattern pads
In @patternSelected
//Remember that this is the current pattern associated with the last track
I'm only reading the mozaic manual to the extent of my understanding. If there is a specific topic or chapter that I should revisit to learn something about this script, please let me know.
that when touching each trackpad, the four pads in front of the touched trackpad will turn pink instead of only pad number 4 turning pink by default
Nothing else is going to happen because we haven't yet created the codes we need to create.
ColorPad trackpattern[LastPad] + 4 , 7
Is what I have written here correct?
Did I create the offset correctly, should I have used plus or some other math symbol?
Who else should I add to make this code ( ColorPad trackpattern[LastPad] ? ? , 7 )work properly?
@pejman: you wrote earlier
I asked you to go through the script until there is a line of code that you don’t understand.
But your reply was a quote of comments, not lines of code.
I am not asking what you don’t know how to implement. I am asking you to go through the program line by line and stop at the first existing line of code that you don’t understand. Since you said you find the script very confusing and don’t understand any connections , I am surprised that a comment
—————
@pejman wrote:
You need to try and evaluate this on your own and communicate back your evaluation:
When you tap pads 0-3, do the correct pattern pads light up?
Please test and report the results for each track. Report
Track tapped , pattern pad that lights up, pattern you expected to light up
Look in Mozaic’s log and report any errors
I apologize if I did not express my meaning correctly.
I understood every line of the script very well until this code came up :” ColorPad trackpattern[LastPad] + 4 , 7 “ , That is, I don't understand the role of this code in the script very well, what exactly this code is supposed to do for us, And what is the relationship of this code with the codes that are going to be added . It’s confusing me.
What do you mean by “ do the correct pattern pads light up?” ?
Do you mean after loading the script and tapping the trackpads?
Or after I randomly select patterns, what happens when I touch each trackpad?
Please answer my questions so that I can follow the three things you asked me to do below and report back to you.
What is confusing about the ColorPad line?
ColorPad takes two arguments: padNumber and color number.
Please answer the following questions to help me understand what you do or don’t understand.
You wrote this code
Which part of that line will be the pad number that gets colored?
Can you explain what trackPattern[lastPad] is or represents or does ?
When lastPad is 0 , which pad will be colored by the call to ColorPad ?
What about when lastPad is 3?
You have said that when a track’s pad is tapped, the associated pattern should be given a color other than white. By “light up”, I mean assign the color that indicates the active pattern.
We are only dealing with tapping track pads.
Before we deal with tapping pattern pads, we need to make sure that tapping track pads works correctly and that you understand how the script works.
@espiegel123
I mean Padnumber . The thing that's confusing me is that we have a trackpattern that we've already created an array for [0,1,2,3] and here we have a [LastPad] again. Can this lastpad in the @trackselected section be related to the first 4 pads or patterns ?
What is the relationship between these two ( trackpattern and lastpad ) ?
We used to use notenumber array for pads in the previous project, this is understandable to me, but here we are using pads in pads, and I don't understand this.
And if we use Lastpad in the trackselected, the lastpad is only related to the first 4 pads?
I use Log for trackpattern and lastpad and trackpattern[LastPad] after trackpattern[LastPad] + 4 , 7
After touching trackpads From 0 to 3 in order
Result:
Log Lastpad :
0
1
2
3
Log trackpattern :
0
0
0
0
Log trackpattern[Lastpad] :
0
1
2
3
And with touching patternpads : No number is reported
As it turns out, ColorPad is a command for the color of the pad neck and the option after which can be a number or a variable determines the number of the pad or pads to be painted.
In this line, the trackpattern[LastPad] is related to the number of the pad that is to be painted, but considering the things I wrote about the log reports above, I do not know which of them are related to the pad number and whether they should also be related to the color patterpads or not.
Based on the above, I have to say no.
By default pad 4
By default pad 4
Definitely no, probably because of the wrong offset.
Ok,
I have always thought that the codes should go parallel to each other in both parts ( trackselected and patternselected ) so that their correct operation is clear and they work correctly .
@pejman : after gathering some more information, I will try to address your confusion. It sounds like you are not clear on how arrays work. It may be worthwhile for you to read and re-read the parts of the Mozaic manual about arrays and variables. LastPad is just the number of the last pad that was tapped. We are using it as an index to an array in order to retrieve the pattern number associated with the tapped pad.
You said above that when you tap a track, the correct pattern does not get colored but did not provide details.
For EACH pad 0 to 3 answer these questions:
Which pattern pad become selected ?
Which pattern pad do you want to be selected?
=====
You said in your previous post that touching a pattern pad didn’t log anything?
Did you expect information about them to be logged?
If so, please post your code so that we can discuss why the logging didn’t happen.
I know the use of array in mozaic
So why is it necessary to use trackpattern array when the result of ( Log Lastpad ) and ( Log trackpattern ) is the same
With touch pad 0 ==> pad 4 is selected
With touch pad 1 ==> pad 5 is selected
With touch pad 2 ==> pad 6 is selected
With touch pad 3 ==> pad 7 is selected
With touch pad 0 to 3 I expect only pad number 4 to be selected as default
I expected this before, but now I realized that when we enter the code in the @trackselected section ,and befor we called it if lastpad < 4 call trackselected , so it does not include the pattern pads as Lastpad.
But I'll post the code again so we can discuss if it's something other than what I said
Please touch show previous quotes
@pejman : I think I have more of an idea about what your points of confusion are. Since, you wrote all of the code, I mistakenly believed that you understood how it was supposed to work. I have a request. If you post a script and there are lines in it that you don't thoroughly understand, please BOTH mark them with a comment indicating that you don't know why they work AND mention in your post when you post the script that there are lines you don't understand.
Let's see if we can make this clear.
===== trackPattern[LastPad]
You explained that there are four tracks (pads 0 - 3). Each track has one associated pattern. We proposed that you create an array with 4 cells to store the number of the pattern associated with each track.
Earlier in the conversation, I proposed that you call that array trackPattern.
Your script initializes trackPattern as
According to what was said above we have:
LastPad is the number of the last pad that was tapped.
Since you want to color the pad of pattern associated with the tapped pad, we need to use LastPad to retrieve the associated pattern number from trackPattern.
trackPattern[LastPad] gives us the pattern number associated with the track whose pad was tapped.
Since pattern 0's pad is pad 4, pattern 1's pad is pad 5, etc... we need to add 4 to the pattern number to get the pad number for the pattern. Since trackPattern[LastPad] is the pattern number not the pattern's pad number, we add 4 to get the correct pad for the pattern. So,
You asked:
Does what I wrote above clarify this for you. Since trackSelected is only called for pads 0 through 3, lastPad is a track number. trackPattern[lastPad] is the pattern associated with the tapped track.
Is that clear now? If not, please let me know.
If you want to change the default patterns for the tracks, change the values in trackPattern to the numbers of the patterns you want them to have.
Please experiment with different default values to make sure you understand.
KEEP IN MIND: currently, your code does not remove the color from the old selected pattern when a new track is tapped. That will be the next thing to tackle after you understand this code.
====== trackPattern WITHOUT brackets
You asked:
Do you now understand why we use the trackPattern array?
Your question and your having logged trackPattern separately from trackPattern[lastPad] lead me to think that you may not be clear about the relationship between trackPattern and trackPattern[anArrayIndex]
In Mozaic, trackPattern by itself means the same trackPattern[0]
So,
============ IF THE ABOVE IS CLEAR
If you have any questions, please experiment a bit on your own and then post any remaining questions.
If you understand all of the above, see below and then add a new post with your updated script with the trackPattern array setup so that it has the numbers of the default patterns. For testing, it probably is useful to have different values for each track -- that way it will be easier to see what might be going wrong.
THEN: ask yourself if you can see in @trackSelected how to get the pattern number that is already selected.
If you can figure out the answer (you might want to experiment with logging to test your theories), add to trackSelected the line or lines needed to color the previous track's pattern pad white before you color the new track's pattern.
If you can't figure it out, let me know and I will see if I can help you figure it out.
@espiegel123
Before I get into the details of your post, you wrote something that made me doubt and scare
You wrote: You explained that there are four tracks (pads 0 - 3). Each track has one associated pattern. We proposed that you create an array with 4 cells to store the number of the pattern associated with each track.
When I was introducing the project to you and telling you my goal of the project, I did not say such a sentence at all. That : Each track has one associated pattern.
I already said that each track has 12 patterns for itself, not just one pattern, And each time we can choose only one pattern out of 12 patterns for each track.
Did you understand my meaning in the same way?
Yes. That is my understanding. Let me clarify:
I realize that there is something ambiguous that we need to clarify (though not immediately relevant). Will the patterns ultimately be the same for each track. What I mean is: will pattern 0 have the same meaning for each track. For example, if track 0 has pattern 0 as its pattern and track 1 has pattern 0 as its pattern, are both pattern 0's the same.
@espiegel123
👍👌
YES exactly, Yes, it is possible that, for example, several tracks have the same pattern number .
If you fully understand what I mean about the goal I have with this project , there is still a question for me.
It is reasonable with touching pad 0 turn on pad 4.
BUT Why should we expect such a thing? I think you expect that, Or you want something like that from me :
With touch pad 1 ==> Turn on pad 5
With touch pad 2 ==> Turn on pad 6
With touch pad 3 ==> Turn on pad 7
But in fact, it should be in our default mode ( after loading patch , befor touching pattern pads ) , pad 4 ( pattern 1 ) should be turned on by touching every Trackpads, not pad 5,6,7 .
I don't understand your question. We expect a script to behave consistent with the instructions it contains. Your script did exactly what you told it to do.
Given the code that you wrote, track 0 was asscoiated with pattern 0, track 1 with pattern 1, etc. It the behavior was what was expected based on what you coded into the script.
It behaved as expected.
You can assign whatever defaults you want.
I advised you in my most recent assignment to NOT have all tracks default to 0 as that will make errors harder to detect.
My recommendation (as I said earlier) for the sake of testing is to use a different default pattern for each track. It is easy to change the defaults to what you want after you have debugged the code and confirmed that it works correctly. Until you have it working correctly, it will be to your benefit for the defaults to be different patterns.
You misunderstand. It is not something that I want from you. You set the default patterns to be 0,1,2,3. So, I assumed that was what you wanted.
I expected that behavior because that was what you coded it to do.
@espiegel123
Ok very nice , This is exactly what caused me doubts and confusion. But I don't remember that you made such an offer to me.
“ My recommendation (as I said earlier) for the sake of testing is to use a different default pattern for each track. It is easy to change the defaults to what you want after you have debugged the code and confirmed that it works correctly. Until you have it working correctly, it will be to your benefit for the defaults to be different patterns.”
Anyway, This issue is now completely resolved for me.
Because I always thought that due to the coloring of pads number 5, 6 and 7, something was wrong and something did not match, that's why I was confused and it caused me to have doubts about the relationship of variables with each other in different parts.
@espiegel123
You wrote: THEN: ask yourself if you can see in @trackSelected how to get the pattern number that is already selected.
With Log LastPad + 4
Or
With Log trackpattern[LastPad]+4
You wrote: If you can figure out the answer (you might want to experiment with logging to test your theories), add to trackSelected the line or lines needed to color the previous track's pattern pad white before you color the new track's pattern.
I added 2 line codes for color the previous track's pattern pad white.
@pejman : this is on the right track. Let’s talk about how to set the pattern that is selected white before we call colorpad for the new pattern.
You have the line
This expression doesn’t help us because selectedTrack is the previous track that was selected. It isn’t a pattern. (it coincidentally works because the default pattern numbers are the same as the track numbers. It might be clearer if you set trackPattern to be [12,13,14,15]
TrackPattern[lastPad] is a pattern. If we did a comparison, we would need compare it to a pattern. Because it is a pattern we want to turn white.
For simplicity, let’s not do a test. Let’s find the pattern that currently is selected. If we color it white before the new pattern is colored we don’t need to do a test.
So, let’s figure out how to know which pattern to color white.
When @trackSelected starts executing, we have this information available:
Keeping that information in mind, before we have selected the newPattern or updated selectedTrack, what is an expression that provides us with the currently selected pattern? We can get the pattern number from the information above.
@espiegel123
I have edited my last post
@espiegel123
Therefore, in this script, we do not need to compare in this field at all.
Did I understand correctly?
trackpattern
Or
trackpattern[LastPad] + 4
@pejman : I guess I was unclear in my previous explanations.
You suggested as possible solutions to find the currently selected pattern
Unfortunately, no.
When @trackSelected starts
lastPad is the track not yet selected. We want the pattern of the track already selected. We are looking for the pattern that is already colored.
Please answer these questions.
1) when trackSelected starts, what variable contains information about the track that is currently selected?
2) what variable can tell us the pattern associated with a track?
3) what does trackPattern without an index tell us?
@espiegel123
selectedtrack
In your previous post, you introduced trackpattern as an array
But If we consider trackpattern as both a variable and an array :
trackpattern
0
@pejman : let me ask another way.
How do we get the pattern number associated with selectedTrack?
@espiegel123
Do you mean variable in @trackselected ?
@espiegel123
If you mean a variable in @trackselected, I have no answer.
@pejman:
When @trackSelected starts executing, we have this information available:
lastPad - this is the pad of the new track to select
selectedTrack - the previously selected track
trackPattern array- an array that tells us the pattern associated with each track
Keeping that information in mind, before we have selected the newPattern or updated
selectedTrack, what is an expression that provides us with the currently selected pattern? We can get the pattern number from the information above.
trackPattern is an array that tells us the pattern associated with each track. To find the pattern associated with a track, you use the track's number as an index to the array.
SelectedTrack is the currently selected track.
Those two variables can be used together to find the pattern associated with the selectedTrack.
Think about that and if you can't find the answer read below
==== An exercise to try...
If you haven't figured it out, I want you to do this exercise to help you understand the information available to you to see if it will help you see a solution
Imagine that the script has just been loaded and started running.
Read your script and answer these questions before trying to run the code.
At startup:
Imagine that you touch pad 2.
When @trackSelected is first called after you touch the pad (before any of its code has run):
When @trackSelected is finished running: