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
@pejman : what do you mean by “correct value”?
It is showing the value you that you set it to. If you think it should be a different value then your code should be different…but we can’t tell what you want to happen. Part of the point of the exercise was to see what you want to happen.
What I mean by correct value is the same value that was previously assigned to x, but after (if MIDIByte2 = speedcc and MIDIByte3 > 0 and countnote = 1 and countcc = 1 ) it shows the value 0 instead of 6 for example.
Do the exercise I suggested and we can find the problem.
Write down the series of cc events and the values that you think x should have before and after the cc event is processed. What you think the correct values should be.
Then send those events and screenshot the log. When we compare your list of what you wanted to happen to what actually happened, we can advise you.
Until we see the specifics of what you think should happen we can't help.
@espiegel123 .
@pejman : i think you are misunderstanding.
Create the list of what you think should happen. Use this format.
Literally write down these column names:
x-before.......cc#..........cc value.......x-after
under the columns write the numbers that you expect. For each cc that you list there should be 4 numbers:
-- the value of x before the cc is processed
-- the cc number
-- the cc value
-- the value x should have when processing is done
IN YOUR CODE, add logging so that at the very beginning of the handler you log
Add a log line in the cc handler like
log {processing done. x: }, x
Then send the cc's and values you wrote down. Screenshot the log. Mark any log lines that differ from what you wanted.
And also post the script so that all the information is in the one post.
@espiegel123 ,
You wrote: Add a log line in the cc handler like
log {processing done. x: }, x
I don't know exactly where in the cc handler I should put this log.
After
if MIDIByte2 = modecc
x = Round TranslateScale (MIDIByte3), 0, 127, 0, 7
log {processing done. x: }, x ???
endif
log {processing done. x: }, x ???
Or after endif
.
And after this line
if MIDIByte2 = speedcc and MIDIByte3 > 0 and countnote = 1 and countcc = 1
What phrase should I use to write the log? ??
@pejman : add it as the last line of the handler. The purpose of the log lines I am suggesting is so that every time the handler runs, you will end up seeing information for the received event, and the value of x at the start and at the end.
A bug is when the result is different from the desired outcome. You feel that x sometimes has the wrong value. Logging this information gives you a tool for examining what is happening and communicating to us the specifics of a situation where the result differs from what you expect.
@espiegel123
![](https://forum.loopypro.com/uploads/editor/7f/yl7c9ncbq6r0.jpeg)
![](https://forum.loopypro.com/uploads/editor/vf/fkmjdycodvt7.jpeg)
@pejman : you wrote that you expect cc number 13 (speedcc) with a value of 31 to change x’s value.
Your code changes x’s value only when modecc (cc 14) is received.
@espiegel123 .
Yes your right. I wrote it wrong.
x-before.......cc#..........cc value.......x-after
0 13 31 0
0 14 35 2
That is the result you get. What is the problem?
I notice you did not add the log line I suggested you add at the end of the cc handler to log x’s value. You only log it in the conditional. I suggested that you add it as the last thing in the handler so it is logged every time a cc is handled.
@espiegel123 . Sorry for late.
The problem is that after this line of code,( if MIDIByte2 = speedcc and MIDIByte3 > 0 and countnote = 1 and countcc = 1 ) I want x to display the number 2, which represents the number zero, and I don't know where I made a mistake in the code or what I should do to display the number 2 after the if line of code.
@pejman : the last value displayed in the log is 2.
Please write down as earlier the midi events you plan to send and the value of x before and after.
Then screenshot the log that results when you send the values. Circle any line that does not end with the x value you think is correct.
You haven’t yet posted a series of values where x is 0 but shouldn’t be.
But not after ,( if MIDIByte2 = speedcc and MIDIByte3 > 0 and countnote = 1 and countcc = 1 ) .
I already sent it to you.
Can you Please more explanation.
That conditional is only triggered when speedcc is non-zero. In your example, that happens one time. And when it happens x is 0 because you haven't yet sent modecc
x will only be greater than 0 after you send modecc with a sufficiently large value.
In your example, you send speedcc before you have sent modecc. So, x is 0 when it is logged.
I am not understanding why you think x would be anything other than 0 after you send speedcc.
You need to send modecc before x will be anything other than 0.
In the example you sent earlier, the value logged was the value expected. What you sent earlier was not a case where the value logged was different from the predicted value.
@espiegel123
But speedcc and modecc are both greater than zero in step number one of steppolyarp and both are sent to mozaic at the same time as you can see in the midi monitor.
![](https://forum.loopypro.com/uploads/editor/98/x0ugfrrg4ybv.jpeg)
![](https://forum.loopypro.com/uploads/editor/5m/ailzt5prt693.jpeg)
![](https://forum.loopypro.com/uploads/editor/sc/u81fa4nozwx3.jpeg)
MOZAIC handles events one at a time in the order received. In this case, speedcc arrives after the note on and before modecc . So, x is 0.
What needs to be changed in the code to solve this problem? Is there a solution?
I am sure there is a solution. I don’t have the time to solve it for you, however. Now that you know that events processed one at a time, think about the tools mozaic provides and consider how to accomplish your end goal.
What problem does it cause that x is the wrong value for a fraction of a millisecond?
@espiegel123
The only solution that comes to my mind is to create another mozaic as an intermediary between steppolyarp and the target mozaic and send cc14 to the target mozaic with a delay. I just tested this and it worked.
@espiegel123 .
Is this the only way available?
There are many other ways. What the best way us depends a lot on exactly what you need. I don’t have the time to do a detailed rundown.
One possibility is to collect information as your events come in but act on them based on a timer. There are other ways, too.
@pejman - If you have two things that are supposed to happen virtually simultaneously, but you can't be sure which will happen first, then you need to check if the first has happened yet.
I haven't been following the conversation closely so this may not be the proper solution, but here's what I was thinking in generalized pseudo code.
The idea is, nothing happens unless both cc's are in the state you expect them to be. If one hasn't been set yet then wait for the other to be set. Then take the action that you want to do and un-set them both to repeat the next time around.
Interesting. Thank you for taking the time 🙏
@wim
Thanks @wim for help 🙏🙏🙏 , I'm glad there's a solution that doesn't require another mozaic.
I will try your method. It is a valuable experience.
@wim
I added the codes to the script. Is this what you have in mind? If so, unfortunately it doesn't work.
In the first step of steppolyarp, which sends both speedcc and modecc with values (midibyte3) higher than 0, nothing happens. These codes only prevent the number 0 corresponding to the modecc value from being sent, whereas I expect that after x, log will show the number corresponding to modecc which is higher than 0.
@wim
But in step numbers 2 The correct value will be sent.
OH nice thread![:) :)](https://forum.loopypro.com/resources/emoji/smile.png)
I'm working on Mozaic tonight -- I'll be joining this thread soon!
@OscarSouth
Welcome. 👍
A quick one for now -- what'd be a quick/efficient way to get the first index in an array holding a -1 value?
What I'm really trying to do here is basically to get the 'length' of an array where -1 is representing an empty value. Preferably as a one liner rather than a loop if possible.