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.

Foot switch send midi note increments

2

Comments

  • Hi Wim,
    Thank you for your fast response. I am glad you are safe.
    This script change is well on the way. It works correctly except there is a second note #24 sent on channel three That interferes with the results. I have attached pic of midiflow to show this. Ignore the CC command. It is not used here but I use this switch for other purposes.

  • Did you comment out the two SendMIDIThruOnCh 2 lines? If doing that doesn't help, please post the script and I'll take a look. When posting scripts, place three "`" marks on a line by themselves before and after the script to avoid the forum software formatting it weirdly:

    Like this:
    ```

    // Your code here...

    ```

  • Tried it and no luck. Here is my code.
    I had changed the 4 notes in the sequence to 5.
    And I was logging the counter when I though it was the problem.

    ‘’’@OnLoad

    // This is the incoming note and channel from the footswitch
    // 0 = MIDI channel 1
    noteIn = 24
    channelIn = 0

    // The channel (0-15) to send midi notes out on.
    channelOut = [0, 2] //added 2 to send note to lower manual per wim

    // List the notes to send out separated by commas. Leave -1 at the end
    // of the sequence to mark the end of the sequence
    notesOut = [24, 25, 26, 27, 28, -1]

    counter = -1
    @End

    @OnMidiNoteOn
    if (MIDIChannel = channelIn) and (MIDINote = noteIn)

    if notesOut[counter+1] = -1
      counter = 0
    else
      Inc counter
    endif
    
    SendMIDINoteOn channelOut[0], notesOut[counter], 127
    SendMIDINoteOn channelOut[1], notesOut[counter], 127, 2
     //slight delay to help some hosts
    

    log {Note Counter Status }, notesOut[counter] //added to check counter

    elseif MIDIChannel = 1
    //SendMIDIThruOnCh 2

    else
    //Comment out the next line if you want to block notes on otherchannels
    SendMIDIThru
    endif

    @End

    @OnMidiNoteOff
    if (MIDIChannel = channelIn) and (MIDINote = NoteIn)
    SendMIDINoteOff channelOut[0], notesOut[counter], 0
    SendMIDINoteOff channelOut[1], notesOut[counter], 0, 2

    elseif MIDIChannel = 1
    //SendMIDIThruOnCh 2

    else
    //Comment out the next line if you want to block notes on other channels
    SendMIDIThru
    endif
    @End

    @OnMidiInput

    // 0x90 and 0x80 are already handled by @OnMidiNoteOn and @OnMidiNoteOff
    // so it's important not to duplicate here.

    if MIDICommand <> 0x90 and MIDICommand <> 0x80
    //Comment out the next line if you want to block CC's and other messages
    //Or, just delete the whole @OnMidiInput section.
    SendMIDIThru
    endif

    @End’’’
    Thanks,
    Bruce

  • Hey Bruce, can you do me a favor and edit the above post so that the "```" are on a line by themselves before and after the code? It will make it a lot easier to read. Thanks.

  • wimwim
    edited September 2020

    [edit ... deleted post] Incomplete thought.

  • _ki_ki
    edited September 2020

    @Bellow And use of three backticks instead of forward ticks for starting and ending the code block.

    You can ‚edit‘ the above post by pressing the ‚cogwheel icon‘ in the comments title bar on the right.

  • wimwim
    edited September 2020

    Hi @Bellows - the script works fine here.

    Is it possible you forgot to press "Upload" after editing the code? I do that sometimes myself. If you did, then I suggest checking the input to be sure you're not getting extra notes on that end.

    MidiSpy is free and is a good tool for checking this kind of thing. In this case, you would add MidiSpy and route the input to it and to Mozaic. Then you would add a second instance and route the Mozaic output (only) to it. This will give you a before and after picture in the two instances.

  • Thanks guys. I don’t know how to type back ticks on my iOS keyboard.

  • wimwim
    edited September 2020

    Hold down the apostrophe/quotation mark key until the "`" pops up. You'll have to do this three times, which is kind of a pain. Or, just copy and paste this:

    ```

    B)

  • @Bellows I know @wim will try to help, but I'm having trouble believing the program you posted generated the results you posted. For example, notice that note on for C#1 was sent on channels 1 and 3, but the corresponding note off was sent twice on channel 1. And it's not clear what is causing the rogue note on and off for C1 on channel 3. Please repost the program, exactly as it appears in Mozaic. And with the 3 backticks on a separate line before and after. That'll make the solution much easier to find.

  • I am working on it now. I really appreciate your help.
    Here is a pic from MidiWrench showing the output of my foot switch. 4 presses.
    Also a pic from midiflow after Mozaic in Audiobus where I normally use Mozaic.
    I did make a mistake with the upload and commenting out the 2 lines. BTW, I only commented out the lines that read:
    //SendMIDIThruonch 2
    In two places. I did not comment out the whole elseif statement.


  • @OnLoad // This is the incoming note and channel from the footswitch // 0 = MIDI channel 1 noteIn = 24 channelIn = 0 // The channel (0-15) to send midi notes out on. channelOut = [0, 2] //added 2 to send note to lower manual per wim // List the notes to send out separated by commas. Leave -1 at the end // of the sequence to mark the end of the sequence notesOut = [24, 25, 26, 27, 28, -1] counter = -1 @End @OnMidiNoteOn if (MIDIChannel = channelIn) and (MIDINote = noteIn) if notesOut[counter+1] = -1 counter = 0 else Inc counter endif SendMIDINoteOn channelOut[0], notesOut[counter], 127 SendMIDINoteOn channelOut[1], notesOut[counter], 127, 2 //slight delay to help some hosts log {Note Counter Status }, notesOut[counter] //added to check counter elseif MIDIChannel = 1 //SendMIDIThruOnCh 2 else //Comment out the next line if you want to block notes on otherchannels SendMIDIThru endif @End @OnMidiNoteOff if (MIDIChannel = channelIn) and (MIDINote = NoteIn) SendMIDINoteOff channelOut[0], notesOut[counter], 0 SendMIDINoteOff channelOut[1], notesOut[counter], 0, 2 elseif MIDIChannel = 1 //SendMIDIThruOnCh 2 else //Comment out the next line if you want to block notes on other channels SendMIDIThru endif @End @OnMidiInput // 0x90 and 0x80 are already handled by @OnMidiNoteOn and @OnMidiNoteOff // so it's important not to duplicate here. if MIDICommand <> 0x90 and MIDICommand <> 0x80 //Comment out the next line if you want to block CC's and other messages //Or, just delete the whole @OnMidiInput section. SendMIDIThru endif @End

    Hey, the more you know.
    Thanks

  • wimwim
    edited September 2020

    Hi @Bellows - this script works perfectly, as you posted it. It is almost certainly something about the input or routing.

    btw, it isn't necessary to comment out the entire elseif statement, but it doesn't hurt.

  • @uncledave said:
    @Bellows I know @wim will try to help, but I'm having trouble believing the program you posted generated the results you posted. For example, notice that note on for C#1 was sent on channels 1 and 3, but the corresponding note off was sent twice on channel 1. And it's not clear what is causing the rogue note on and off for C1 on channel 3. Please repost the program, exactly as it appears in Mozaic. And with the 3 backticks on a separate line before and after. That'll make the solution much easier to find.

    Thankyou uncle Dave. You have a sharp eye. There was a mistake in the code (mine) at that time which I assume caused this erroneous output.
    I have since corrected it but still am fighting the problem.
    The problem now is that the scrip outputs the original midi note #24 from the footswitch on Mozaic channel 2 after sending the incremented note.
    Thanks for your help
    Bruce

  • edited September 2020

    Wim,
    I haven’t tried your recommended monitors yet.
    Do you see that per the output from midiflow monitor channel 3 (2 for Mozaic) the original note #24 (C1) is set every time after the incremented note from the counter?

    It is not sent after the incremented note from the counter on channel 1 (0 for Mozaic).
    This illustrates the problem. Channel 1 works correctly and channel 3 sends the original note #24 (C1) after the incremented note.

    This extra note #24 (C1) should not be on channel 3 (2 in Mozaic).
    Thankyou so much for your time. I am tired of trying to fix it and I need it. You must be quite tired of helping me by now.

  • I have used midispy to show the same data.

  • wimwim
    edited September 2020

    Hi @Bellows. Thanks, I was just writing a note requesting exactly this.

    The problem is clearly that your foot switch is sending a note 24 on both MIDI channel 1 and channel 3. The script is passing through the channel 3. Why your foot switch would be sending that channel 3 note, I don't know, but the fix is simple.

    Just comment out the SendMidiThru line in both the @OnMidiNoteOn and @OnMidiNoteOff events.

    Or, reconfigure your foot switch so it's not sending out two notes for each switch press.

    ... and no, I'm not getting tired of helping you with this. Yet. ;)

  • Wim, thanks again so much. I don’t know how I could have missed this 🙀
    I was probably trying some different ways to accomplish the same task. Unfortunately my footswitch programming software is not working at the moment. Another dilemma.It does have the capability of sending many messages with one foot press. I will try out your solution ASAP. Thanks
    Bruce

  • Hi Wim,
    You were absolutely correct and now the drawbars work correctly 👍Whoo Hoo..
    On the downside now my played notes are not passed through as I would expect.
    The low notes used for this switching are not in a range that I would every play from the keyboard. Would it be possible to only send through only notes C2 and higher?
    Would that be a good solution?
    Thanks
    When my footswitch is able to be reprogrammed a better solution would exist as you said.

  • Sure, that's easy:

    @OnLoad
    
      // This is the incoming note and channel from the footswitch
      // 0 = MIDI channel 1
      noteIn = 24
      channelIn = 0
    
      // The channel (0-15) to send midi notes out on.
      channelOut = [0, 2] //added 2 to send note to lower manual per wim
    
      // List the notes to send out separated by commas. Leave -1 at the end
      // of the sequence to mark the end of the sequence
      notesOut = [24, 25, 26, 27, 28, -1]
    
      counter = -1
    @End
    
    @OnMidiNoteOn
      if (MIDIChannel = channelIn) and (MIDINote = noteIn)
    
        if notesOut[counter+1] = -1
          counter = 0
        else
          Inc counter
        endif
    
        SendMIDINoteOn channelOut[0], notesOut[counter], 127
        SendMIDINoteOn channelOut[1], notesOut[counter], 127, 2
         //slight delay to help some hosts
    
      log {Note Counter Status }, notesOut[counter] //added to check counter
    
      elseif midiNote >= 36
        SendMIDIThru 
      endif
    
    @End
    
    @OnMidiNoteOff
      if (MIDIChannel = channelIn) and (MIDINote = NoteIn)
        SendMIDINoteOff channelOut[0], notesOut[counter], 0
        SendMIDINoteOff channelOut[1], notesOut[counter], 0, 2
    
      elseif MIDINote >= 36
        SendMIDIThru
      endif
    @End
    
    @OnMidiInput
    
      // 0x90 and 0x80 are already handled by @OnMidiNoteOn and @OnMidiNoteOff
      // so it's important not to duplicate here.
    
      if MIDICommand <> 0x90 and MIDICommand <> 0x80
        //Comment out the next line if you want to block CC's and other messages
        //Or, just delete the whole @OnMidiInput section.
        SendMIDIThru 
      endif
    
      @End
    
  • As I am looking at how to do this I realize that I have to pass much data. In fact I want to pass through everything except the notes C1 through B1which are handled as we do now.
    I don’t really understand why the ones we are sending out to switch the drawbars aren’t sounding notes now.

  • Hi Wim,
    I wrote my last comment before I saw what you have sent. Please disregard above until I try what you have sent.
    Thanks

  • You can also change the to elseif MIDINote >= 36 to elseif (MIDINote < 24) and (MIDINote >= 36) if you want to pass throuh the notes below 24 as well.

  • Wim,
    Thank you so much for all your help here.
    One thing we lost was channel 1 to 2 notes but at the moment I don’t care. I am very excited to be trying out this script. It appears to all be working. Switching these drawbar sets from one footswitch is going to be wonderful.

  • I will study it in the morning to better understand it.
    Thanks for giving me so much both in knowledge and useable tools.
    Bruce

  • @Bellows said:
    Wim,
    Thank you so much for all your help here.
    One thing we lost was channel 1 to 2 notes but at the moment I don’t care. I am very excited to be trying out this script. It appears to all be working. Switching these drawbar sets from one footswitch is going to be wonderful.

    Yes, we took that out in the troubleshooting process. Here's a version that has lines to put that back in and to temporarily exclude the notes between C1 - B1 (24 - 35) on MIDI Channel 3.

    @OnLoad
    
      // This is the incoming note and channel from the footswitch
      // 0 = MIDI channel 1
      noteIn = 24
      channelIn = 0
    
      // The channel (0-15) to send midi notes out on.
      channelOut = [0, 2] //added 2 to send note to lower manual per wim
    
      // List the notes to send out separated by commas. Leave -1 at the end
      // of the sequence to mark the end of the sequence
      notesOut = [24, 25, 26, 27, 28, -1]
    
      counter = -1
    @End
    
    @OnMidiNoteOn
      if MIDIChannel = 1
        SendMIDIThruOnCh 2
    
      elseif (MIDIChannel = channelIn) and (MIDINote = noteIn)
    
        if notesOut[counter+1] = -1
          counter = 0
        else
          Inc counter
        endif
    
        SendMIDINoteOn channelOut[0], notesOut[counter], 127
        SendMIDINoteOn channelOut[1], notesOut[counter], 127, 2
    
      else
        // temporary fix for extra notes from the footswitch
        // excludes notes 24 - 36 on MIDI channel 3
        // remove the if and endif statements when the footswitch is fixed
        if MIDINote < 24 or MIDINote >= 36 or MIDIChannel <> 2
          SendMIDIThru 
        endif
    
      endif
    
    @End
    
    @OnMidiNoteOff
      if MIDIChannel = 1
        SendMIDIThruOnCh 2
      elseif (MIDIChannel = channelIn) and (MIDINote = NoteIn)
        SendMIDINoteOff channelOut[0], notesOut[counter], 0
        SendMIDINoteOff channelOut[1], notesOut[counter], 0, 2
      else
        // temporary fix for extra notes from the footswitch
        // remove the if and endif statements when the footswitch is fixed
        if MIDINote < 24 or MIDINote >= 36 or MIDIChannel <> 2
          SendMIDIThru 
        endif
      endif
    @End
    
    @OnMidiInput
    
      // 0x90 and 0x80 are already handled by @OnMidiNoteOn and @OnMidiNoteOff
      // so it's important not to duplicate here.
    
      if MIDICommand <> 0x90 and MIDICommand <> 0x80
        //Comment out the next line if you want to block CC's and other messages
        //Or, just delete the whole @OnMidiInput section.
        SendMIDIThru 
      endif
    
      @End
    
  • BTW: The forum editor offers a simple way for adding long code blocks with the 6 needed back-ticks:

    Pressing the ‚format icon‘ (looks like a flipped P) above the textbox and selecting ‚code‘ three times will result in 6 back-ticks with the cursor beeing right in the middle. Now one could paste in the code or press ‚return‘ and copy 3 of the backticks around.

    .

    Cool that you both got the script to work now 👍🏼

  • wimwim
    edited September 2020

    Thanks @_ki thats a great tip. Getting that back-tick character on an iOS keyboard is a pain, especially on a phone.

  • Thanks again to both of you for your help and guidance. This script is working wonderfully.
    BTW, I am not afraid of hex. I am retired now but I used to program industrial PLCs for factories and did much work in factories like Budweiser, Bristol, Meyers Squibb, Revere Copper etc. as a IBEW electrician. I also taught PLC programming in our Apprenticeship program for the IBEW.
    I am sometimes frustrated by trying to do simple things in Mozaic but I love the challenge .
    It is quite different from ladder logic which used to be used in the electrical industry

    I would not succeed without your help and greatly appreciate it. I am having so much fun playing this Hammond organ app with these controls.
    Stay safe,
    Bruce

  • @Bellows Actually, the simple @OnEvent, if/else chain is very similar to ladder logic. Those tests are contacts, NO for true, NC for else. The actions are coils, and the counter is just a counter that recycles. The trick, I think, is visualizing how each individual MIDI message will be handled by this logic.

Sign In or Register to comment.