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.

Request new Mozaic Scripts *HERE*

1596062646569

Comments

  • @wim said:
    Very nice @Dante777. Thanks for that. 😎

    I think values[i] = Clip values[i], 0, 127 could replace calling @clamp if you want to save a few lines of code.

    I really like how you used Exit in the for loop. I've always resorted a while loop, which is more cumbersome and risks an infinite loop if I'm not careful. Yours is a much better approach.

    Thanks! I've missed this Clip function in the manual )

  • faulty post, sorry!

  • Hello, not sure if Mozaic is the right solution, but figured this is the best place to ask.

    I'd like the ability to quickly choose which hardware synth each MIDI controller — e.g. a LaunchPad and a LaunchKey — is controlling. I have a couple of grooveboxes that each claim a lot of MIDI channels, so addressing via channel alone gets messy.

    If I'm understanding correctly, this a sort of "master keyboard" scenario, though ideally it's not limited to just one master.

    Maybe wishful thinking here, but it'd be great if Mozaic could:
    • Autoscan and show the current devices — great for variety with DAWless setups.
    • Choose the controller(s)
    • Choose the device being controlled per controller.
    • Do this all with large pad style buttons for each switching.

    Even more wishful: maybe there's a screen-free variation where I could use a reserved channel per controller, so I could say map drumpads to the possible destinations for fast toggling.

    Would love to hear suggestions for other options if Mozaic isn't a great fit. AUM can do it, but it's more of a settings screen situation rather than a quickly toggleable UI.

  • wimwim
    edited May 2024

    @seafoamery said:
    Hello, not sure if Mozaic is the right solution, but figured this is the best place to ask.

    I'd like the ability to quickly choose which hardware synth each MIDI controller — e.g. a LaunchPad and a LaunchKey — is controlling. I have a couple of grooveboxes that each claim a lot of MIDI channels, so addressing via channel alone gets messy.

    If I'm understanding correctly, this a sort of "master keyboard" scenario, though ideally it's not limited to just one master.

    Maybe wishful thinking here, but it'd be great if Mozaic could:
    • Autoscan and show the current devices — great for variety with DAWless setups.

    Sorry, Mozaic cannot do this.

    • Choose the controller(s)
    • Choose the device being controlled per controller.

    Mozaic is only able to work with MIDI channels. It has no ability to recognize or select actual devices.**

    • Do this all with large pad style buttons for each switching.

    Mozaic has only one pad layout with 16 fixed-size pads. Labeling of those pads isn't really dynamic either except through a lot of conditional "if" statements that can multiply rapidly when trying to do anything but basic labeling.

    Even more wishful: maybe there's a screen-free variation where I could use a reserved channel per controller, so I could say map drumpads to the possible destinations for fast toggling.

    If I understand what you're saying correctly, that would be possible. Mozaic can listen to individual channels and act in just about any way on them.

    Would love to hear suggestions for other options if Mozaic isn't a great fit. AUM can do it, but it's more of a settings screen situation rather than a quickly toggleable UI.

    Have you investigated MIDI Busses in AUM? These, combined with MIDI bindings to enable and disable them might get you closer to what you want. A Mozaic script could probably be devised that would give you buttons for the routing. However, a Mozaic script isn't a magic bullet. What you need to do has to be very well thought through, and as mentioned has only MIDI channels to work with.

    To be honest, Loopy Pro as a host seems like it would get you far closer to what you want. Loopy can bind actions of almost any type to specific controllers, has buttons that you can make as large as you like and placed where you need them, can do multiple routing tasks with one button press, and can activate all those actions in response to an external midi controller. I believe everything you mentioned could be done with Loopy Pro, and probably without any coding. The learning curve is somewhat steep for the type of things you want to do, but it's the best option as far as I can see.

    ** Well, provided all the controllers send and receive Sysex (not all do) to identify themselves, with advanced programming it could probably recognize and then leverage midi channels to do selective routing. It would be an uphill battle, if it could work at all, though.

  • I read a comment on another discussion about the upcoming scale eq app. The op mentioned that Scaler EQ can be used for filtering sound frequencies. They posted a link where someone takes a waterfall sample sound and uses scaler eq to filter the frequencies to only let selected (in this case C) chord notes pass through.
    See link below. This sounds really cool, is this something that could be done in Mosaic?

    https://forum.scalerplugin.com/t/scaler-eq-and-sound-design/15035

  • @jking said:
    I read a comment on another discussion about the upcoming scale eq app. The op mentioned that Scaler EQ can be used for filtering sound frequencies. They posted a link where someone takes a waterfall sample sound and uses scaler eq to filter the frequencies to only let selected (in this case C) chord notes pass through.
    See link below. This sounds really cool, is this something that could be done in Mosaic?

    https://forum.scalerplugin.com/t/scaler-eq-and-sound-design/15035

    Mozaic only deals with midi, not audio so it couldn't be used for something like that.

  • @wim said:

    @jking said:
    I read a comment on another discussion about the upcoming scale eq app. The op mentioned that Scaler EQ can be used for filtering sound frequencies. They posted a link where someone takes a waterfall sample sound and uses scaler eq to filter the frequencies to only let selected (in this case C) chord notes pass through.
    See link below. This sounds really cool, is this something that could be done in Mosaic?

    https://forum.scalerplugin.com/t/scaler-eq-and-sound-design/15035

    Mozaic only deals with midi, not audio so it couldn't be used for something like that.

    Ah, of course, silly me! Thanks for the feedback wim, I appreciate it 👍

  • Hi there!
    I’m sure what I’m requesting has been done a million times and it’s probably super simple so excuse me in advance…
    I’d like to try out Mozaic to do polyphony on the Digitakt. I saw a video where they use one of those custom midi cables (Retrokits) to achieve it and I believe the concept is quite simple. If you setup say 4 tracks on the Digitakt with the same sample set to different channels, then upon note input route notes sequentially to each.
    So if you enter a chord the first note will go to channel 1, second to channel 2, and so on…
    I’m sure on Mozaic world this is kindergarten stuff and has been done a million times as part of much more complex setups.
    I believe the variables/options would be:

    • polyphony count - how many channels to send to
    • Starting midi channel

    I’ve done some Mozaic noodling in the past but tbh I have a really hard time editing text/code on the iPad, don’t know why…
    Cheers!

  • wimwim
    edited May 2024

    @tahiche said:
    Hi there!
    I’m sure what I’m requesting has been done a million times and it’s probably super simple so excuse me in advance…
    I’d like to try out Mozaic to do polyphony on the Digitakt. I saw a video where they use one of those custom midi cables (Retrokits) to achieve it and I believe the concept is quite simple. If you setup say 4 tracks on the Digitakt with the same sample set to different channels, then upon note input route notes sequentially to each.
    So if you enter a chord the first note will go to channel 1, second to channel 2, and so on…
    I’m sure on Mozaic world this is kindergarten stuff and has been done a million times as part of much more complex setups.
    I believe the variables/options would be:

    • polyphony count - how many channels to send to
    • Starting midi channel

    I’ve done some Mozaic noodling in the past but tbh I have a really hard time editing text/code on the iPad, don’t know why…
    Cheers!

    Here are some things you can check out...

    https://apps.apple.com/app/polythemus-au/id1439815017
    https://patchstorage.com/poly-it-up-channel-rotator/
    https://patchstorage.com/roll-a-poly/
    https://patchstorage.com/polymono-midi-router/

  • @wim said:

    @tahiche said:
    Hi there!
    I’m sure what I’m requesting has been done a million times and it’s probably super simple so excuse me in advance…
    I’d like to try out Mozaic to do polyphony on the Digitakt. I saw a video where they use one of those custom midi cables (Retrokits) to achieve it and I believe the concept is quite simple. If you setup say 4 tracks on the Digitakt with the same sample set to different channels, then upon note input route notes sequentially to each.
    So if you enter a chord the first note will go to channel 1, second to channel 2, and so on…
    I’m sure on Mozaic world this is kindergarten stuff and has been done a million times as part of much more complex setups.
    I believe the variables/options would be:

    • polyphony count - how many channels to send to
    • Starting midi channel

    I’ve done some Mozaic noodling in the past but tbh I have a really hard time editing text/code on the iPad, don’t know why…
    Cheers!

    Here are some things you can check out...

    https://apps.apple.com/app/polythemus-au/id1439815017
    https://patchstorage.com/poly-it-up-channel-rotator/
    https://patchstorage.com/roll-a-poly/
    https://patchstorage.com/polymono-midi-router/

    Wow, you’re a ⭐️. This is just prrrfect! 👏👏🤟🤟
    I’m checking out the code in these. They have more code and features than I expected, for example in how to deal with the “extra notes” after max channels have been met, how it resets them on note release… All these things I hadn’t thought of in advance and would have been a pain.
    Thank uuuu!.

    BTW, now that you’re here… I’ve been wanting to know forever, how to save patches in folders in Mozaic.

    I tried using a name like “Mono2Poly/poly-it-up” to no avail… How do you create the patch folders and save stuff in them?.

  • @tahiche said:
    BTW, now that you’re here… I’ve been wanting to know forever, how to save patches in folders in Mozaic.

    It’s kinda ugly. I never bother.
    https://forum.audiob.us/discussion/54708/can-i-create-subfolders-to-store-my-mozaic-scripts

  • Hello everyone, I didn't see the option to send the nrpn with mozaic in the doc... Can you confirm? Do you know of another solution for using lfo and nrpn?

  • wimwim
    edited May 2024

    @biggir said:
    Hello everyone, I didn't see the option to send the nrpn with mozaic in the doc... Can you confirm? Do you know of another solution for using lfo and nrpn?

    Sending an NRPN is just a matter of sending 4 midi messages together. This can be done programatically. The first two cc messages set the CCs to use for the MSB and LSB, and the second two send the actual MSB and LSB values.

    This article explains the mechanics of the message fairly simply: https://www.morningstar.io/post/sending-midi-nrpn-messages

    It would be nice if Mozaic had a convenience feature for this as it does for pitch bend, but it should be fairly straightforward to make a custom event that could be easily re-used in other projects.

  • edited May 2024

    yes ! done with :

    function sendNRPN(ch,MSB,LSB,val)
    local f=sendMIDI;ad=176+ch-1
    f({ad,99,MSB})
    f({ad,98,LSB})
    f({ad,6,val})
    f({ad,99,127})
    f({ad,98,127})
    end

    ( https://gist.github.com/turbo/3a55cd31103722b4c03087ac02679e6d )

    Thanks :-)

  • @biggir said:
    yes ! done with :

    function sendNRPN(ch,MSB,LSB,val)
    local f=sendMIDI;ad=176+ch-1
    f({ad,99,MSB})
    f({ad,98,LSB})
    f({ad,6,val})
    f({ad,99,127})
    f({ad,98,127})
    end

    ( https://gist.github.com/turbo/3a55cd31103722b4c03087ac02679e6d )

    Thanks :-)

    Sorry, I'm confused. That isn't Mozaic scripting.

  • @wim said:

    @biggir said:
    yes ! done with :

    function sendNRPN(ch,MSB,LSB,val)
    local f=sendMIDI;ad=176+ch-1
    f({ad,99,MSB})
    f({ad,98,LSB})
    f({ad,6,val})
    f({ad,99,127})
    f({ad,98,127})
    end

    ( https://gist.github.com/turbo/3a55cd31103722b4c03087ac02679e6d )

    Thanks :-)

    Sorry, I'm confused. That isn't Mozaic scripting.

    indeed, it's just an extract of the git code ;-)

    mozaic code :

    sendMIDICC ch,99,MSBvalue
    sendMIDICC ch,98,LSBvalue
    sendMIDICC ch,6,valuetosend
    sendMIDICC ch,99,127
    sendMIDICC ch,98,127

  • wimwim
    edited May 2024

    @biggir said:

    @wim said:

    @biggir said:
    yes ! done with :

    function sendNRPN(ch,MSB,LSB,val)
    local f=sendMIDI;ad=176+ch-1
    f({ad,99,MSB})
    f({ad,98,LSB})
    f({ad,6,val})
    f({ad,99,127})
    f({ad,98,127})
    end

    ( https://gist.github.com/turbo/3a55cd31103722b4c03087ac02679e6d )

    Thanks :-)

    Sorry, I'm confused. That isn't Mozaic scripting.

    indeed, it's just an extract of the git code ;-)

    mozaic code :

    sendMIDICC ch,99,MSBvalue
    sendMIDICC ch,98,LSBvalue
    sendMIDICC ch,6,valuetosend
    sendMIDICC ch,99,127
    sendMIDICC ch,98,127

    Sorry, that isn't correct. Here's an example that would work correctly. The important part is the @SendNRPN event. You can reuse that in any script provided you always set channel, nrpnNum, and nrpnVal before calling.

    The rest of the code is just to provide a knob to set nrpnVal as an example.

    @Description
    Example: Send NRPN 1624 by moving Knob 0
    @End
    
    @OnLoad
      channel = 0
      nrpnNum = 1624
      nrpnVal = 0
      SetKnobValue 0,nrpnVal
      LabelKnob 0,{NRPN}
    @End
    
    @OnKnobChange
      if LastKnob = 0
        nrpnVal = TranslateScale (GetKnobValue 0),0,127,0,16383
        Call @SendNRPN
        LabelKnob 0,(RoundDown nrpnVal)
      endif
    @End
    
    @SendNRPN
    // Send an NRPN message set
    // Set channel, nrpnNum, and nrpnVal before calling!
    
      NumLSB = nrpnNum % 128
      NumMSB = div nrpnNum, 128
      ValLSB = nrpnVal % 128
      ValMSB = div nrpnVal, 128
    
      SendMIDICC channel,98,NumLSB, 1
      SendMIDICC channel,99,NumMSB, 1
      SendMIDICC channel,38,ValLSB, 1
      SendMIDICC channel,6,ValMSB, 1
    @End
    
  • edited May 2024

    bizarre my code works at home on my digitakt, I was inspired both by the code found and what my faderfox sends via midispy :-) I did notice" a concern about some of the values,

    Thanks anyway for yours, I'll give it a try.

  • edited May 2024

    There’s an app called ribn, it’s a midi cc controller with 8 ribbons that you can use to record and loop finger movements to allow you to add repeating modulations.
    Is there anything created in Mozaic that does something similar?

  • @jking said:
    There’s an app called ribn, it’s a midi cc controller with 8 ribbons that you can use to record and loop finger movements to allow you to add repeating modulations.
    Is there anything created in Mozaic that does something similar?

    While it's possible to do such things in a limited sense with Mozaic, it isn't a great fit for that kind of thing.

    Mozaic's internal variables are somewhat limited in that each can only hold 1024 pieces of information. Assuming 10ms resolution is smooth enough, a script would fill up 2 arrays every 10 seconds for each parameter when recording. Playing back those is pretty expensive in processing power. Trying to simultaneously record and play back multiple such arrays would be very complicated and taxing.

    There's also only one XY pad, so the UI is a bit limiting. You could use the dials, but it wouldn't be ideal.

    I wrote an experimental midi recorder for simple capture and playback of notes and automation. It functioned, but was limited to non-simultaneous record and playback. It could only manage limited UI updates while processing due to the overhead needed for playback. That project satisfied me that while Mozaic can do many things, this type of application isn't very practical.

  • @wim said:

    @jking said:
    There’s an app called ribn, it’s a midi cc controller with 8 ribbons that you can use to record and loop finger movements to allow you to add repeating modulations.
    Is there anything created in Mozaic that does something similar?

    While it's possible to do such things in a limited sense with Mozaic, it isn't a great fit for that kind of thing.

    Mozaic's internal variables are somewhat limited in that each can only hold 1024 pieces of information. Assuming 10ms resolution is smooth enough, a script would fill up 2 arrays every 10 seconds for each parameter when recording. Playing back those is pretty expensive in processing power. Trying to simultaneously record and play back multiple such arrays would be very complicated and taxing.

    There's also only one XY pad, so the UI is a bit limiting. You could use the dials, but it wouldn't be ideal.

    I wrote an experimental midi recorder for simple capture and playback of notes and automation. It functioned, but was limited to non-simultaneous record and playback. It could only manage limited UI updates while processing due to the overhead needed for playback. That project satisfied me that while Mozaic can do many things, this type of application isn't very practical.

    Thanks @wim once again for your comprehensive and knowledgeable response. I wish that I had 10% of your ability 😀

  • Hello, after seeing the demo of the oxi one, and its matrix mode functionality, I'm sure it would be a hit on a launchpad with Mozaic, by reusing the melodic generation scripts that already exist :-)

    Of course, less advanced but certainly fun :-)

    Have a nice day :-)

  • edited July 2024

    Hello @wim I hope ypu can help me like the last time with the Sustainuto script.

    I have a Pianoled Visualizer where the raspberrry controls the ledstrip. The raspberry accept incoming midi notes and then turn a led that corresponds to the physical key position.
    As I don’t use all the keys all the time, I always end up with underused Leds that could provide some info too like the sustain pedal position or the modwheel or any other CC. And I am thinking about this script specially when driving a hammomd, I want to somehow reproduce the rotary speaker speed which is controlled with the modwheel or any other CC

    This time what I ask is if you could help me to generate a code that is able to generate a Circle LFO with a starting rotation speed X that can be modified via midi CCXX up to a rotation speed of Y. Then that LFO’s position should be converted to a range of notes from 2 to any number. Then declare the specific notes that are going to be triggered.

    Meaning that if lets say I choose a range of 2 and I choose C1 and C5 when the Circle LFO is at 0 position it should trigger C1 and if the Circle LFO is at 127, then the script should trigger C5.

    Another example, if I choose range as 3 and then I Choose C1 C3 C5 s the notes to be triggered, then when the Circle is at 0 it should trigger C1 if the Circle LFO is at 64 position then it should trigger C3 and if the Circle LFO is at 127 position it should Trigger C5.

    This means that the Range should select in how many parts the Circle LFO position should be splitted and then the NOTES is going to dictate which notes are going to be triggered.
    Maybe the script could declare an array of 127 notes but the range will decide how many positions of that array it is going to take. This it to generate some continuous range of notes with some AI tool and then paste it on the script’s array in case I want to extend such effect to the whole led strip.

    Just to end I would ask you, (as if it is not already a complicated script request) if you could add a CC to Note line to select which of the notes I want to be triggered when I press the Sustain pedal, I think I already can do such thing on keystage alone, but I would love to be everything contained on the same script.

    Please let me know if I was not clear enough on some parts.

    EDIT: I forgot to say that the LEDs are going to be on as long as they receive a midi note off, it could be neat to select the duration of the On Off time. But I leave to you if that is possible to be implemented.

  • Relative CC to Absolute CC?

    Any chance there’s a script floating around out there that can convert relative midi cc messages (ie 63/65, etc) to absolute cc?

    Obviously the script would have to maintain the absolute cc value internally between sessions… But something like this would be awesome for encoder-based midi controllers like FaderFoxes etc…

  • @MonkeyDrummer said:
    Relative CC to Absolute CC?

    Any chance there’s a script floating around out there that can convert relative midi cc messages (ie 63/65, etc) to absolute cc?

    Obviously the script would have to maintain the absolute cc value internally between sessions… But something like this would be awesome for encoder-based midi controllers like FaderFoxes etc…

    https://patchstorage.com/relativeccv0-1/
    (I haven't tried it myself.)

  • edited August 2024

    @jjpl2001 said:
    Hello @wim I hope ypu can help me like the last time with the Sustainuto script.

    I have a Pianoled Visualizer where the raspberrry controls the ledstrip. The raspberry accept incoming midi notes and then turn a led that corresponds to the physical key position.
    As I don’t use all the keys all the time, I always end up with underused Leds that could provide some info too like the sustain pedal position or the modwheel or any other CC. And I am thinking about this script specially when driving a hammomd, I want to somehow reproduce the rotary speaker speed which is controlled with the modwheel or any other CC

    This time what I ask is if you could help me to generate a code that is able to generate a Circle LFO with a starting rotation speed X that can be modified via midi CCXX up to a rotation speed of Y. Then that LFO’s position should be converted to a range of notes from 2 to any number. Then declare the specific notes that are going to be triggered.

    Meaning that if lets say I choose a range of 2 and I choose C1 and C5 when the Circle LFO is at 0 position it should trigger C1 and if the Circle LFO is at 127, then the script should trigger C5.

    Another example, if I choose range as 3 and then I Choose C1 C3 C5 s the notes to be triggered, then when the Circle is at 0 it should trigger C1 if the Circle LFO is at 64 position then it should trigger C3 and if the Circle LFO is at 127 position it should Trigger C5.

    This means that the Range should select in how many parts the Circle LFO position should be splitted and then the NOTES is going to dictate which notes are going to be triggered.
    Maybe the script could declare an array of 127 notes but the range will decide how many positions of that array it is going to take. This it to generate some continuous range of notes with some AI tool and then paste it on the script’s array in case I want to extend such effect to the whole led strip.

    Just to end I would ask you, (as if it is not already a complicated script request) if you could add a CC to Note line to select which of the notes I want to be triggered when I press the Sustain pedal, I think I already can do such thing on keystage alone, but I would love to be everything contained on the same script.

    Please let me know if I was not clear enough on some parts.

    EDIT: I forgot to say that the LEDs are going to be on as long as they receive a midi note off, it could be neat to select the duration of the On Off time. But I leave to you if that is possible to be implemented.

    Ok. I made this thing, but it doesn’t work as it needs OnMetroPulse to be able to start the LFOs. There are things that I don’t completely understand.

    On the other hand I found that I don’t need a circle LFO with just a sine it will work. I would love you could help me @wim

    The specific issue I have is that for the MetroPulse to work I need to press play on my Keystage Daw, and I would like to work with some internal routine or buckle, I have all day on this, but couldn’t figure it out

    @OnLoad 
      // LFO default settings
      min = 0
      max = 127
      if (Unassigned speed)
        speed = 0.5 // half a Hz.
      endif 
      SetLFOType 0, {sine}
      SetLFOType 1, {cosine}
      Call @MyLFOSetup
      // set start phases for both LFOs
      ResetLFO 0
      ResetLFO 1
    
      // set the metronome to 100ppqn resolution
      SetMetroPPQN 48
    
      // GUI
      LabelKnob 0, {Speed}  
    
      // Initialize a clock with a 50 ms interval
      StartClock 50
    @end
    
    @Clock
      x = GetLFOValue 0
      y = GetLFOValue 1
      SetXYValues x, y
    
      // Check the value of x and send corresponding MIDI note on
      if x == 1
        SendMIDINoteOn 1, 69, 127 // A3
      elseif x == 64
        SendMIDINoteOn 1, 81, 127 // A5
      endif
    @end
    
    @MyLFOSetup
      SetupLFO 0, min, max, no, speed
      SetupLFO 1, min, max, no, speed
    @end
    
    @OnKnobChange
      if LastKnob == 0
        v = GetKnobValue 0 
        speed = TranslateScale v, 0, 127, 0.1, 2 
        Call @MyLFOSetup
      endif
    @end 
    
    @OnMIDIReceived
      // Check for MIDI CC 01
      if MIDICtrlNumber == 1
        if MIDICtrlValue < 64
          speed = 3
        else
          speed = 5
        endif
        Call @MyLFOSetup
      endif
    @end
    
    @Description
    This script uses 2 LFOs to create a circular motion. It sends a MIDI note on for A3 if the x value is 1 and a MIDI note on for A5 if the x value is 64. The notes are sent with a velocity of 127 on MIDI channel 1. The speed is set to 3 if MIDI CC 01 value is less than 64, and 5 if it's 64 or greater. The script operates independently of the metropulse using a clock with a 50 ms interval.
    @end
    
  • wimwim
    edited August 2024

    Hi @jjpl2001 - sorry, I overlooked your earlier post. I only have time for a very quick look right now, but I can see that there are many syntax errors which you should clear up. Maybe give that a try and we can take it from there:

    • There is no == comparison operator in Mozaic. Replace all of those with =
    • StartClock should be StartTimer
    • StartTimer 50 would be an incorrect call. First you have to use SetTimerInterval 50, then StartTimer by itself.
    • @Clock should be @OnTimer
    • @OnMidiReceived isn't a Mozaic event. I think you were after @OnMidiInput, but if you use that then you need to be more checking to know if you received a midi CC or some other event. Try changing @OnMidiReceived to @OnMidiCC so you don't have to do that.
    • if MIDICtrlNumber is invalid. Should be if MIDIByte2 = 1. (The CC number is carried in Byte 2 of the a midi CC message)
    • if MIDICtrlValue is invalid. Should be if MIDIByte3 < 64. (The CC value is carried in Byte 3 of a midi CC message.)

    You should get in the habit of always checking the log. All of these errors would show up in the log. Running them down one by one, with reference to the manual to find the right syntax, will save you tons of trial and error. It kinda looks like you were trying to get ChatGPT to do this for you. That isn't likely to be fruitful with a non-mainstream language like Mozaic, at least for now.

    Anyway, maybe try cleaning up those errors and check back if you still have trouble getting it to work.

    (btw, I never heard of a "circle LFO" before. I don't think that's a thing.)

  • edited August 2024

    @wim said:
    Hi @jjpl2001 - sorry, I overlooked your earlier post. I only have time for a very quick look right now, but I can see that there are many syntax errors which you should clear up. Maybe give that a try and we can take it from there:

    • There is no == comparison operator in Mozaic. Replace all of those with =
    • StartClock should be StartTimer
    • StartTimer 50 would be an incorrect call. First you have to use SetTimerInterval 50, then StartTimer by itself.
    • @Clock should be @OnTimer
    • @OnMidiReceived isn't a Mozaic event. I think you were after @OnMidiInput, but if you use that then you need to be more checking to know if you received a midi CC or some other event. Try changing @OnMidiReceived to @OnMidiCC so you don't have to do that.
    • if MIDICtrlNumber is invalid. Should be if MIDIByte2 = 1. (The CC number is carried in Byte 2 of the a midi CC message)
    • if MIDICtrlValue is invalid. Should be if MIDIByte3 < 64. (The CC value is carried in Byte 3 of a midi CC message.)

    You should get in the habit of always checking the log. All of these errors would show up in the log. Running them down one by one, with reference to the manual to find the right syntax, will save you tons of trial and error. It kinda looks like you were trying to get ChatGPT to do this for you. That isn't likely to be fruitful with a non-mainstream language like Mozaic, at least for now.

    Anyway, maybe try cleaning up those errors and check back if you still have trouble getting it to work.

    (btw, I never heard of a "circle LFO" before. I don't think that's a thing.)

    Thank you ver much, I got it “Working”, but the thing now is that it is obvious that the Routine that is reading the LFO position not always coincide with the timer, meaning that not always trigger properly.

    If I make x=1 … elseif x=126 then the LFO position will not coincide with the moment the routine to read the position

    If I give more time to the timer routine to read the LFO position by giving a range instead of an exact value, like x<1 … elseif x>126 then it will trigger multiple notes, If increase the timer to avoid multiple notes, then it will start making some resonant movement by triggering every other note if I lower the speed.

    I wonder if there is a way to detect if the LFO is at a specific position and make an interruption to trigger the note instead of a loop to check if the LFO is at certain position. Here is my code now:

    @OnLoad
      // LFO default settings
      min = 0
      max = 127
      if (Unassigned speed)
        speed = 3 // half a Hz.
      endif 
      SetLFOType 0, {sine}
      SetLFOType 1, {cosine}
      Call @MyLFOSetup
      // set start phases for both LFOs
      ResetLFO 0
      ResetLFO 1
    
      // GUI
      LabelKnob 0, {Speed}  
    
      // Set timer interval and start the timer
      SetTimerInterval 20
      StartTimer
    @end
    
    @OnTimer
      // Main processing loop
      x = GetLFOValue 0
      y = GetLFOValue 1
      SetXYValues x, x
    
      // Check the value of x and send corresponding MIDI note on
      if x < 1
        SendMIDINoteOn 1, 40, 127 // A3
        SendMIDINoteOff 1, 40, 127 // A3
      elseif x > 126
        SendMIDINoteOn 1, 70, 127 // A5
        SendMIDINoteOff 1, 70, 127 // A5
      endif
    @end
    
    @MyLFOSetup
      SetupLFO 0, min, max, no, speed
      SetupLFO 1, min, max, no, speed
    @end
    
    @OnKnobChange
      if LastKnob = 0
        v = GetKnobValue 0 
        speed = TranslateScale v, 0, 127, 0.1, 2 
        Call @MyLFOSetup
      endif
    @end 
    
    @OnMidiCC
      // Check for MIDI CC 01
      if MIDIByte2 = 1
        if MIDIByte3 < 64
          speed = 1
        else
          speed = 3
        endif
        Call @MyLFOSetup
      endif
    @end
    
    @Description
    This script uses 2 LFOs to create a circular motion. It sends a MIDI note on for A3 if the x value is 1 and a MIDI note on for A5 if the x value is 64. The notes are sent with a velocity of 127 on MIDI channel 1. The speed is set to 3 if MIDI CC 01 value is less than 64, and 5 if it's 64 or greater. The script operates independently of the metropulse by using a timer that runs every 50 ms.
    @end
    
  • wimwim
    edited August 2024

    @jjpl2001 said:
    Thank you ver much, I got it “Working”, but the thing now is that it is obvious that the Routine that is reading the LFO position not always coincide with the timer, meaning that not always trigger properly.

    If I make x=1 … elseif x=126 then the LFO position will not coincide with the moment the routine to read the position

    If I give more time to the timer routine to read the LFO position by giving a range instead of an exact value, like x<1 … elseif x>126 then it will trigger multiple notes, If increase the timer to avoid multiple notes, then it will start making some resonant movement by triggering every other note if I lower the speed.

    That's a hard one. I think a square LFO shape would work better for you. That will cycle between two exact values. You'd have to assure that multiple notes don't fire in case that the timer fires more than once during the top or bottom of the cycle. That could be done by setting and checking Boolean variables.

    I wonder if there is a way to detect if the LFO is at a specific position and make an interruption to trigger the note instead of a loop to check if the LFO is at certain position.

    There is not a way to do that. The only thing you could do is have a very small timer checking all the time. That will run up your CPU usage though.

    I'm not quite sure what you're trying to do here. Based on what you've described, I don't see why an LFO is needed at all. Why not just set a timer that fires alternating notes each time it goes off? Then change the TimerInterval when CC 01 is received?

    btw, if you place three "back ticks" ( ``` ) on a line by themselves before and after your code when posting, the formatting will work better. Alternatively, you can highlight the whole code block, then set the paragraph type to "code". I prefer the back tick method. It's more flexible and doesn't indent your code lines like the other method does.

  • @jjpl2001, here's an example that I think probably does the same thing as your script, though without the XY pad display. I added an on/off button just because I prefer not to assume things should always be running.

    @OnLoad
      // LFO default settings
      min = 0
      max = 127
      lowNote = 69  // A3
      highNote = 93 // A5
      
      if (Unassigned init)
        init = YES
        speed = 500 // half a Hz.
        state = 0
        SetKnobValue 0, (TranslateScale speed,100,3000,0,127)
        run = YES  // change to NO to not automatically start on load
      endif
      
      // GUI
      LabelKnob 0, {Speed}
      LabelPad 0, {Start/Stop}
      LatchPad 0, run
      
      // Set timer interval and start the timer
      SetTimerInterval speed
      if run
        StartTimer
      endif
    @End
    
    @OnTimer
      // Check the value of x and send corresponding MIDI note on
      if state = 0
        SendMIDINoteOn 1, lowNote, 127 // A3
        SendMIDINoteOff 1, lowNote, 127 // A3
        state = 1
      elseif state = 1
        SendMIDINoteOn 1, highNote, 127 // A5
        SendMIDINoteOff 1, highNote, 127 // A5
        state = 0
      endif
    @End
    
    @OnKnobChange
      if LastKnob = 0
        v = GetKnobValue 0
        speed = TranslateScale v, 0, 127, 100, 2000
        SetTimerInterval speed
        ResetTimer
      endif
    @End
    
    @OnMidiCC
      // Check for MIDI CC 01
      if MIDIByte2 = 1
        if MIDIByte3 < 64
          speed = 1000
        else
          speed = 3000
        endif
        Call @MyLFOSetup
      endif
    @End
    
    @OnPadDown
      if LastPad = 0
        run = not run
        LatchPad 0,run
        if run
          StartTimer
        else
          StopTimer
        endif
      endif
    @End
    
    
    @Description
    This script sends alternating notes based on a timer that is set by the speed knob.
    @End
    
Sign In or Register to comment.