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 - Create your own AU MIDI plugins - OUT NOW!

19798100102103108

Comments

  • @pejman said:
    Hi

    According to the topic that I already sent to you in my previous post, what should I do now so that this problem does not arise?

    I wrote: “_But when I was using your code for this method I noticed a new problem, : Sometimes I keep ( remain ) the fingers on the keys for chords that contains notes that are the same between both two chords and move the other fingers that should be on different notes. ( If you are interested in knowing why I have to do this, I will explain it to you in a separate post ) .

    So with the method you suggested, whenever I move one of my fingers for a new note, only the new note is counted, and it counts as one note, not along with the previous notes that were taken.”_

    I think you need to describe more precisely what you want the script to do. Do you want it to track all notes currently held down (my interpretation) or notes played together as a block chord (what ki and McD are addressing.. though McD's script doesn't quite do that as I mentioned )

  • wimwim
    edited December 2023

    @pejman - people are stumbling around somewhat because it isn’t really clear what you’re trying to do. First you say you need to detect chords, but then you say you only need to count the number of notes held down to get their average velocity. You don’t say when or for what you would use that velocity.

    Advice will be haphazard until you define the requirement better.
    [edit] cross posted while @espiegel123 was saying about the same thing.

  • edited December 2023

    @espiegel123

    @espiegel123 said:

    @pejman said:
    Hi

    According to the topic that I already sent to you in my previous post, what should I do now so that this problem does not arise?

    I wrote: “_But when I was using your code for this method I noticed a new problem, : Sometimes I keep ( remain ) the fingers on the keys for chords that contains notes that are the same between both two chords and move the other fingers that should be on different notes. ( If you are interested in knowing why I have to do this, I will explain it to you in a separate post ) .

    So with the method you suggested, whenever I move one of my fingers for a new note, only the new note is counted, and it counts as one note, not along with the previous notes that were taken.”_

    I think you need to describe more precisely what you want the script to do. Do you want it to track all notes currently held down (my interpretation) or notes played together as a block chord (what ki and McD are addressing.. though McD's script doesn't quite do that as I mentioned )

    I just need to get the count of the number of notes held down.

    Because sometimes I add or reduce some of the notes of the chord I play , instead of lifting my hand completely from the keyboard and then putting it down again.

    So the number of notes taken by my fingers can increase or decrease at the same moment.

    As I said before, I need this code to average the velocity notes taken ( held down )
    So I need the number of notes held down.

  • wimwim
    edited December 2023

    @pejman said:
    I just need to get the count of the number of notes held down.

    Because sometimes I add or reduce some of the notes of the chord I play , instead of lifting my hand completely from the keyboard and then putting it down again.

    So the number of notes taken by my fingers can increase or decrease at the same moment.

    As I said before, I need this code to average the velocity notes taken ( held down )
    So I need the number of notes held down.

    That’s what I thought, but the conversation got confused as soon as you mentioned chords.
    So … you don’t need timers at all.

    Counting the number of notes held down is simple. Create a variable to hold the number of notes. Initialize it to zero in the @OnLoad event. In the @OnMidiNoteOn event add 1 to the variable. In the @OnMidiNoteOff event subtract one from it.

    Averaging the velocity is trickier because you only get the velocity you’re looking for in the Note On event. So, you have to store that, then retrieve it when the note off occurs.

    • Create a variable to hold the velocity total. Initialize it to zero in the @OnLoad event.
    • Initialize the NoteState array to hold zero for each note in the OnLoad event. ResetNoteStates 0.
    • In the @OnMidiNoteOn event:

      • Add the midi velocity to the variable you created for it.
      • Store the midi velocity in the NoteState Array. SetNoteState MIDIChannel, MIDINote, MIDIVelocity
      • Divide the midi velocity total by the note total to get the average.
    • In the @OnMidiNoteOff event:

      • Retrieve the velocity stored in the note state array. x = GetNoteState MIDIChannel, MIDINote, MIDIVelocity
      • Subtract that from the midi velocity total variable.
      • Reset the velocity stored in the note state array to zero. SetNoteState MIDIChannel, MIDINote 0

    I’m not sure what you plan to do with this average velocity. You can’t use it to change the playing note velocity. That only happens once when the note On velocity is received.

  • edited December 2023

    @wim

    You wrote; I’m not sure what you plan to do with this average velocity. You can’t use it to change the playing note velocity. That only happens once when the note On velocity is received.

    I want use average velocity to changing notes length that goes from an arpeggiator to the mozaic and from the mozaic to the desired app.

  • @wim

    Thanks wim for help and explanation.

    Sorry, I thought the previous post was posted by @espiegel123

  • edited December 2023

    @wim

    @wim said:
    @pejman - people are stumbling around somewhat because it isn’t really clear what you’re trying to do. First you say you need to detect chords, but then you say you only need to count the number of notes held down to get their average velocity. You don’t say when or for what you would use that velocity.

    Advice will be haphazard until you define the requirement better.
    [edit] cross posted while @espiegel123 was saying about the same thing.

    Your right , but believe me, I didn't know that the issue could be so sensitive and complicated, because I actually play chords, I thought I should talk about it in chord format.

    But if you look at my second post to @McD and @espiegel that started this topic, you'll see that I explained perfectly what the problem was and exactly what I wanted.

    https://forum.audiob.us/discussion/comment/1287596/#Comment_1287596

    Anyway, I apologize if the question was not clear.

  • @pejman Are you interested in code that solves a problem you might be working on?

    For the note carry over between chords you need a @OnNoteOff block that decrements “count” so that next chord would start from 1 and not zero. The added complexity is that the array would save the first note. So extra code to remove the correct note would need to be in that NoteOff event block and insure that correct note is saved for the following chord.

    Let’s assume you have recognized a complete chord and have the notes saved with a count. What’s next?

    Ideally someone else is learning something about how Mozaic “knows” something… the only thing it knows are events. All the memory and Logic are our responsibility.

  • @pejman : are you going to need to keep track of which notes are down or just the average velocity?

    If you need to keep track of which notes are down, it is an interesting puzzle to solve. It is a straightforward problem to solve but maybe not obvious.

    The tricky part is removing the notes when a note off comes in.

  • To add average velocity just add a variable to sum incoming velocities (MIDIByte3) and divide by count.

  • edited December 2023

    @espiegel123
    @McD

    Sorry for late . I don't know why recently I'm not getting notifications when someone sends a message.

    @espiegel123 wrote: are you going to need to keep track of which notes are down or just the average velocity?

    🔺Just average velocity .

    @espiegel123 wrote : If you need to keep track of which notes are down, it is an interesting puzzle to solve. It is a straightforward problem to solve but maybe not obvious.

    The tricky part is removing the notes when a note off comes in.

    🔺 I am interested in solving this puzzle because I know it will help me somewhere.

    @McD , Thank you for the explanations you gave in your previous two posts.

    I have to think about The explanations you gave.

    @McD wrote : To add average velocity just add a variable to sum incoming velocities (MIDIByte3) and divide by count.

    Yes, I know the averaging formula, the only problem I have with the case you just mentioned is that :

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down

    2, How to get the number of generated velocities, Do we still need to get the number of down notes with this method?

  • @pejman: i would approach the note tracking in two steps.

    Step 1:
    Set up your script so that it adds played notes to an array and updates a counter for each added note.

    Write a routine also that logs the number of notes in the array and the notes it holds.

    After each note is added, call the note logging handler you created.

    Step 2:
    Once step 1 is working, and a note off handler that removes the note from the array created in step 1. There are a few ways to solve this problem. I'll let you try to puzzle that through.

  • @espiegel123

    Ok i will try .

    But before I try to do that, I would be very interested if you could answer the question I asked earlier.

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down ?

  • wimwim
    edited December 2023

    @pejman said:

    Ok i will try .

    But before I try to do that, I would be very interested if you could answer the question I asked earlier.

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down ?

    I think I covered that in my earlier post.
    https://forum.audiob.us/discussion/comment/1287849/#Comment_1287849

    (You can't "obtain" the set of velocities held down. You have to capture and store them as the note-on event comes in, then reset that storage to zero when the note-off comes in.)

    For your learning benefit, I'd prefer not to provide an actual code example. Also, @espiegel123 's approach and mine are slightly different, so I don't want to get further in the middle of the discussion and confuse things.

  • @pejman said:
    @espiegel123

    Ok i will try .

    But before I try to do that, I would be very interested if you could answer the question I asked earlier.

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down ?

    The Velocity of each NoteOn event comes in as MidiByte3. So. adding all the MidiByte3’s with a chord and dividing by the
    chord “count” is a solution:

    @OnLoad
    
      count = 0 // Stores the note count for chord notes
      SetTimerInterval 500 // a timer to log the count of the recent chord input
      StartTimer
      velocity_total = 0
    
    @End  
    
    @OnMidiNoteOn
    
      Chord[count] = MidiByte2
      velocity_total = velocity_total + MidiByte3
      Inc count
      SendMIDIThru
      ResetTimer
    
    @End
    
    @OnTimer
    
      if count > 0
        Log {Note Count = }, count, { Velocity_Average = }, round (velocity_total / count)
        ResetTimer
        count = 0
        velocity_total = 0
      endif
    
    @End
    
  • @McD : it was determined earlier in the thread that onTimer isn’t needed for this use-case. He is tracking the currently held-down notes not just the notes that are played within a particular time interval.

    Wim provided excellent instructions a few messages up about how to track the average velocity of the currently held keys.

  • @wim said:

    For your learning benefit, I'd prefer not to provide an actual code example. Also, @espiegel123 's approach and mine are slightly different, so I don't want to get further in the middle of the discussion and confuse things.

    At some point, I would be curious about your and anyone else’s methods for tracking the held down keys. My method works but I feel like there are probably better methods.

  • wimwim
    edited December 2023

    @espiegel123 said:

    @wim said:

    For your learning benefit, I'd prefer not to provide an actual code example. Also, @espiegel123 's approach and mine are slightly different, so I don't want to get further in the middle of the discussion and confuse things.

    At some point, I would be curious about your and anyone else’s methods for tracking the held down keys. My method works but I feel like there are probably better methods.

    https://patchstorage.com/sustainuto/ is a recent simple example of one way I’ve done note tracking. Sorry, there aren’t any comments, but the code is broken down into understandable discrete events.

  • @wim said:

    @espiegel123 said:

    @wim said:

    For your learning benefit, I'd prefer not to provide an actual code example. Also, @espiegel123 's approach and mine are slightly different, so I don't want to get further in the middle of the discussion and confuse things.

    At some point, I would be curious about your and anyone else’s methods for tracking the held down keys. My method works but I feel like there are probably better methods.

    https://patchstorage.com/sustainuto/ is a recent simple example of one way I’ve done note tracking. Sorry, there aren’t any comments, but the code is broken down into understandable discrete events.

    Cool. That is one of the two methods I've used. It is more elegant than the one I've tended to use.

  • edited December 2023

    @McD

    @McD said:

    @pejman said:
    @espiegel123

    Ok i will try .

    But before I try to do that, I would be very interested if you could answer the question I asked earlier.

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down ?

    The Velocity of each NoteOn event comes in as MidiByte3. So. adding all the MidiByte3’s with a chord and dividing by the
    chord “count” is a solution:

    @OnLoad
    
      count = 0 // Stores the note count for chord notes
      SetTimerInterval 500 // a timer to log the count of the recent chord input
      StartTimer
      velocity_total = 0
    
    @End  
    
    @OnMidiNoteOn
    
      Chord[count] = MidiByte2
      velocity_total = velocity_total + MidiByte3
      Inc count
      SendMIDIThru
      ResetTimer
    
    @End
    
    @OnTimer
    
      if count > 0
        Log {Note Count = }, count, { Velocity_Average = }, round (velocity_total / count)
        ResetTimer
        count = 0
        velocity_total = 0
      endif
    
    @End
    

    Thanks @McD for answer my question about ( How to get the sum of the values ​​obtained from a variable in the mozaic )

    velocity_total = velocity_total + MidiByte3

    That’s great 👌🙏.

  • @pejman said:
    @McD

    @McD said:

    @pejman said:
    @espiegel123

    Ok i will try .

    But before I try to do that, I would be very interested if you could answer the question I asked earlier.

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down ?

    The Velocity of each NoteOn event comes in as MidiByte3. So. adding all the MidiByte3’s with a chord and dividing by the
    chord “count” is a solution:

    @OnLoad
    
      count = 0 // Stores the note count for chord notes
      SetTimerInterval 500 // a timer to log the count of the recent chord input
      StartTimer
      velocity_total = 0
    
    @End  
    
    @OnMidiNoteOn
    
      Chord[count] = MidiByte2
      velocity_total = velocity_total + MidiByte3
      Inc count
      SendMIDIThru
      ResetTimer
    
    @End
    
    @OnTimer
    
      if count > 0
        Log {Note Count = }, count, { Velocity_Average = }, round (velocity_total / count)
        ResetTimer
        count = 0
        velocity_total = 0
      endif
    
    @End
    

    Thanks @McD for answer my question about ( How to get the sum of the values ​​obtained from a variable in the mozaic )

    velocity_total = velocity_total + MidiByte3

    That’s great 👌🙏.

    Don’t forget to compute the average when you need it:

    Velocity_Average = round (velocity_total / count)

  • wimwim
    edited December 2023

    It's also important to decrement velocity_total when notes are released. However this is tricky because you don't get the velocity with the note-off.

    velocity_total = velocity_total - MidiByte3

    will not work when the note is released. 😬

    For this reason, you also have to store the MidiByte3 value when the note-on comes in. Then you have to look it up and subtract it when the note-off comes in. NoteStates is the perfect place to store this. So in the Note-on event you need something like:

    @OnMidiNoteOn
      Inc count
      SetNoteState MidiChannel, MidiNote, MidiByte3
      velocity_total = velocity_total + MidiByte3
      velocity_average = Round(velocity_total / count)
    @End
    

    Then when the note-off comes in you have to do something like:

    @OnMidiNoteOff
      Dec count
      velocity = GetNoteState MidiChannel, MidiNote
      velocity_total = velocity_total - velocity
      velocity_average = Round(velocity_total / count)
    @End
    

    Note 1: Note-Off may come with a "velocity" value in MidiByte3. However, this is not the same thing as the Note-On velocity. Not many synths make use of this "release velocity", but it is a part of the midi spec. The important thing is it has no relation to the note's velocity.

    Note 2: MidiVelocity can be substituted for MidiByte3 in the @OnMidiNoteOn event. They're the same thing. MidiVelocity might be clearer to understand in the code.

  • @McD

    @McD said:

    @pejman said:
    @McD

    @McD said:

    @pejman said:
    @espiegel123

    Ok i will try .

    But before I try to do that, I would be very interested if you could answer the question I asked earlier.

    1, With which mozaic mathematical function should be obtained the set of velocities of notes held down ?

    The Velocity of each NoteOn event comes in as MidiByte3. So. adding all the MidiByte3’s with a chord and dividing by the
    chord “count” is a solution:

    @OnLoad
    
      count = 0 // Stores the note count for chord notes
      SetTimerInterval 500 // a timer to log the count of the recent chord input
      StartTimer
      velocity_total = 0
    
    @End  
    
    @OnMidiNoteOn
    
      Chord[count] = MidiByte2
      velocity_total = velocity_total + MidiByte3
      Inc count
      SendMIDIThru
      ResetTimer
    
    @End
    
    @OnTimer
    
      if count > 0
        Log {Note Count = }, count, { Velocity_Average = }, round (velocity_total / count)
        ResetTimer
        count = 0
        velocity_total = 0
      endif
    
    @End
    

    Thanks @McD for answer my question about ( How to get the sum of the values ​​obtained from a variable in the mozaic )

    velocity_total = velocity_total + MidiByte3

    That’s great 👌🙏.

    Don’t forget to compute the average when you need it:

    Velocity_Average = round (velocity_total / count)

    Yes, Sure

    Thank you very much for reminder.

  • @wim

    @wim said:
    It's also important to decrement velocity_total when notes are released. However this is tricky because you don't get the velocity with the note-off.

    velocity_total = velocity_total - MidiByte3

    will not work when the note is released. 😬

    For this reason, you also have to store the MidiByte3 value when the note-on comes in. Then you have to look it up and subtract it when the note-off comes in. NoteStates is the perfect place to store this. So in the Note-on event you need something like:

    @OnMidiNoteOn
      Inc count
      SetNoteState MidiChannel, MidiNote, MidiByte3
      velocity_total = velocity_total + MidiByte3
      velocity_average = Round(velocity_total / count)
    @End
    

    Then when the note-off comes in you have to do something like:

    @OnMidiNoteOff
      Dec count
      velocity = GetNoteState MidiChannel, MidiNote
      velocity_total = velocity_total - velocity
      velocity_average = Round(velocity_total / count)
    @End
    

    Note 1: Note-Off may come with a "velocity" value in MidiByte3. However, this is not the same thing as the Note-On velocity. Not many synths make use of this "release velocity", but it is a part of the midi spec. The important thing is it has no relation to the note's velocity.

    Note 2: MidiVelocity can be substituted for MidiByte3 in the @OnMidiNoteOn event. They're the same thing. MidiVelocity might be clearer to understand in the code.

    !

    😍 GREAT, GREAT,GREAT

    The big problem for me was the midi note-off, which you explained and helped me very well.

    Thanks for the explanations in Note 1 and Note 2 🙏.

    Thank you for all your continuous help @espiegel123 @ki @wim @McD ❤️

    I am glad to learn this very valuable content, Because I plan to make a patch so that the user can control the desired parameters through Velocity Average, and can translate ( calibration ) them to the desired amount.

    Has such a patch ever been made in patch storage?
    I haven't found anything like that yet.

  • @pejman said:
    @wim

    @wim said:
    It's also important to decrement velocity_total when notes are released. However this is tricky because you don't get the velocity with the note-off.

    velocity_total = velocity_total - MidiByte3

    will not work when the note is released. 😬

    For this reason, you also have to store the MidiByte3 value when the note-on comes in. Then you have to look it up and subtract it when the note-off comes in. NoteStates is the perfect place to store this. So in the Note-on event you need something like:

    @OnMidiNoteOn
      Inc count
      SetNoteState MidiChannel, MidiNote, MidiByte3
      velocity_total = velocity_total + MidiByte3
      velocity_average = Round(velocity_total / count)
    @End
    

    Then when the note-off comes in you have to do something like:

    @OnMidiNoteOff
      Dec count
      velocity = GetNoteState MidiChannel, MidiNote
      velocity_total = velocity_total - velocity
      velocity_average = Round(velocity_total / count)
    @End
    

    Note 1: Note-Off may come with a "velocity" value in MidiByte3. However, this is not the same thing as the Note-On velocity. Not many synths make use of this "release velocity", but it is a part of the midi spec. The important thing is it has no relation to the note's velocity.

    Note 2: MidiVelocity can be substituted for MidiByte3 in the @OnMidiNoteOn event. They're the same thing. MidiVelocity might be clearer to understand in the code.

    !

    😍 GREAT, GREAT,GREAT

    The big problem for me was the midi note-off, which you explained and helped me very well.

    Thanks for the explanations in Note 1 and Note 2 🙏.

    Thank you for all your continuous help @espiegel123 @ki @wim @McD ❤️

    I am glad to learn this very valuable content, Because I plan to make a patch so that the user can control the desired parameters through Velocity Average, and can translate ( calibration ) them to the desired amount.

    Has such a patch ever been made in patch storage?
    I haven't found anything like that yet.

    I think your idea will be unique. Go for it.

  • Hi .
    Why are there sending extra values ​​in Square type lfo in mozaic ?

  • @pejman said:
    Hi .
    Why are there sending extra values ​​in Square type lfo in mozaic ?

    Can you post some code? In particular it would be helpful to see your SetLFOType, SetupLFO, and GetLFOValue commands in context. If this is a part of a large program, then it might be worth the time to write a simple program that does nothing else but log the values.

    All that said ... I think I remember running into this in a program earlier. I don't remember what was up, but I concluded that reading from a square LFO wasn't going to work for what I was doing.

  • @pejman - I did a quick test and the square LFO is working as expected. I did manage to get a wrong reading or two on the first cycle or two, but nothing that would explain your results.

    LFO's are rarely perfectly square. If you have a slow LFO and high sampling rate you will be likely to get a few off values on the edges if you sample right in the middle of the down or up cycle.

    Here's some test code I used to play with various values for SetTimerInterval and LFO speed.

    @OnLoad
      hz = 1
      interval = 60
    
      SetTimerInterval interval
      SetLFOType 0,{Square}
      SetupLFO 0,0,127,NO,hz
      running = NO
    @End
    
    @OnTimer
      Log GetLFOValue 0
    @End
    
    @OnPadDown
      running = not running
      if running
        StartTimer
      else
        StopTimer
      endif
    @End
    
  • @wim

    @wim said:

    @pejman said:
    Hi .
    Why are there sending extra values ​​in Square type lfo in mozaic ?

    Can you post some code? In particular it would be helpful to see your SetLFOType, SetupLFO, and GetLFOValue commands in context. If this is a part of a large program, then it might be worth the time to write a simple program that does nothing else but log the values.

    All that said ... I think I remember running into this in a program earlier. I don't remember what was up, but I concluded that reading from a square LFO wasn't going to work for what I was doing.

    The image you see in the screenshot is related to the performance of LFOs patch by orchid.

    I have this problem in the codes that I wrote myself, but unfortunately, because the codes that I wrote are not readable for you, I refuse to send them.

  • @pejman said:
    I have this problem in the codes that I wrote myself, but unfortunately, because the codes that I wrote are not readable for you, I refuse to send them.

    I don’t understand what you mean by that, but OK. 🤷🏻‍♂️
    Hopefully someone else can help you.

Sign In or Register to comment.