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 Help Line

11617182022

Comments

  • @wim said:
    @jking - When you post code on the forum, try to place three "back ticks" on a line by themselves before and after the code to place it in a code block.

    I've fixed that for you in the post above, so if you the gear icon to edit the post, you can see what I mean by the three back ticks.

    Thanks for your feedback and help Wim, much appreciated 😁👍

  • @McD said:
    Adding the @End statements produces a working script that plays a C Major scale from C4 to C5
    in 16th notes.

    I haven’t checked out Meta AI yet… did you have to load it with the Mozaic manual? It would be helpful
    to see the exact prompt you fed into the Chat (I’m assuming it’s a ChatBot).

    I uploaded the syntax rules and a copy of some working code. I have tried other ai tools without much success but meta ai did seem todo a better job than most. I asked “Create a working script that generates midi notes using the iOS app Mozaic” This seems like a pretty vague prompt but Meta produced some code (although flawed!) very quickly. I don’t think it will create the quality of code that you are all capable of but perhaps with more training it might provide a good starting point that you can improve upon.

  • What version of Meta allows you to upload the syntax… I guessing you uploaded the Mozaic manual. I’d love to do some auto generation of Mozaic script to generate MIDI tools.

  • @McD said:
    What version of Meta allows you to upload the syntax… I guessing you uploaded the Mozaic manual. I’d love to do some auto generation of Mozaic script to generate MIDI tools.

    Just searched meta ai and used the one shown

  • McDMcD
    edited June 2025

    @jking said:

    @McD said:
    What version of Meta allows you to upload the syntax… I guessing you uploaded the Mozaic manual. I’d love to do some auto generation of Mozaic script to generate MIDI tools.

    Just searched meta ai and used the one shown

    Thanks… I needed to create an account to get the “+” button so I could upload the Mozaic Manual PDF.
    I then prompted for a script to play a random chords on the downbeat of each bar and it gave me
    a script with several syntax errors but pretty decent logic.

    It gave me this:

    @Downbeat
      Chord = Random(0, 127)  // Generates a random MIDI note number for the chord root
      ChordType = Random(0, 2)  // 0 = Major, 1 = Minor, 2 = Diminished
      Velocity = Random(64, 127)  // Random velocity for the chord
    
      If ChordType == 0  // Major Chord
        SendMIDI NoteOn, Chord, Velocity 
        SendMIDI NoteOn, Chord + 4, Velocity 
        SendMIDI NoteOn, Chord + 7, Velocity 
      ElseIf ChordType == 1  // Minor Chord
        SendMIDI NoteOn, Chord, Velocity 
        SendMIDI NoteOn, Chord + 3, Velocity 
        SendMIDI NoteOn, Chord + 7, Velocity 
      ElseIf ChordType == 2  // Diminished Chord
        SendMIDI NoteOn, Chord, Velocity 
        SendMIDI NoteOn, Chord + 3, Velocity 
        SendMIDI NoteOn, Chord + 6, Velocity 
      End
    
      // Turn off all notes of the chord after a short duration
      Wait 100  // Adjust the duration as needed
      SendMIDI NoteOff, Chord, 0 
      SendMIDI NoteOff, Chord + 4, 0 
      SendMIDI NoteOff, Chord + 3, 0 
      SendMIDI NoteOff, Chord + 7, 0 
      SendMIDI NoteOff, Chord + 6, 0 
    End
    

    and I debugged the errors and syntax mistakes to get a script that loads and works:

    @OnLoad
    
    @End
    
    @OnNewBar
    
      Chord = Random 32, 72  // Generates a random MIDI note number for the chord root
      Log {Chord = }, Chord
      ChordType = Random 0, 2  // 0 = Major, 1 = Minor, 2 = Diminished
      Log {ChordType = }, ChordType
      Velocity = Random(64, 127)  // Random velocity for the chord
    
      If ChordType = 0  // Major Chord
        SendMIDINoteOn, 0,Chord, Velocity 
        SendMIDINoteOn, 0,Chord + 4, Velocity 
        SendMIDINoteOn, 0,Chord + 7, Velocity
      ElseIf ChordType = 1  // Minor Chord
        SendMIDINoteOn, 0,Chord, Velocity 
        SendMIDINoteOn, 0,Chord + 3, Velocity 
        SendMIDINoteOn, 0,Chord + 7, Velocity 
      ElseIf ChordType = 2  // Diminished Chord
        SendMIDINoteOn, 0,Chord, Velocity 
        SendMIDINoteOn, 0,Chord + 3, Velocity 
        SendMIDINoteOn, 0,Chord + 6, Velocity 
      EndIf
    
      // Turn off all notes of the chord after a short duration
      // Adjust the duration as needed
      SendMIDINoteOff, 0,Chord, 0, 5000
      SendMIDINoteOff, 0,Chord + 4, 0, 5000 
      SendMIDINoteOff, 0,Chord + 3, 0, 5000
      SendMIDINoteOff, 0,Chord + 7, 0, 5000 
      SendMIDINoteOff, 0,Chord + 6, 0, 5000
    @end
    
    
  • @mcd - the forum autocomplete for @ handles borked your last line of code. That has happened to me so many times. 😂

  • @wim said:
    @mcd - the forum autocomplete for @ handles borked your last line of code. That has happened to me so many times. 😂

    Thanks… I fixed it. O’ wondering if uploading a batch of working scripts will help my Meta AI instance get the @End statements and the If I = 2
    Vs if I == 2 correct. It also adds an unneeded space if the SendMidiNoteOn and off statements.

    I’ll upload @_Ki’s example code because he might teach the model good formatting, variable name conventions and other very professional habits since he codes as a career and is a clever lad in general. I am ashamed to have anyone see my code because I write for the musical results and quit when it sounds interesting.

    I recall programmers at Sun Microsystems laughing that Bill Joy (the creator of ‘vi’ and other Berkeley Unix tools) considered his code OK when it passed ‘lint’. That means he was a bit of a slacker in the eyes of a serious pro. Go figure… he was a very bright lad too but in other dimensions than elegant coding.

    What are the odds Meta AI will get more commands right rather than serving code that isn’t syntactically correct: it won’t pass the @Brambos compiling to some internal machine version at runtime. @Brambos… there’s a clever lad, too.

    I’ll bet his code is elegant… the music they produce certainly is sublime. Salome? Wow.

  • @McD said:

    @wim said:
    @mcd - the forum autocomplete for @ handles borked your last line of code. That has happened to me so many times. 😂

    Thanks… I fixed it. O’ wondering if uploading a batch of working scripts will help my Meta AI instance get the @End statements and the If I = 2
    Vs if I == 2 correct. It also adds an unneeded space if the SendMidiNoteOn and off statements.

    I’ll upload @_Ki’s example code because he might teach the model good formatting, variable name conventions and other very professional habits since he codes as a career and is a clever lad in general. I am ashamed to have anyone see my code because I write for the musical results and quit when it sounds interesting.

    I recall programmers at Sun Microsystems laughing that Bill Joy (the creator of ‘vi’ and other Berkeley Unix tools) considered his code OK when it passed ‘lint’. That means he was a bit of a slacker in the eyes of a serious pro. Go figure… he was a very bright lad too but in other dimensions than elegant coding.

    What are the odds Meta AI will get more commands right rather than serving code that isn’t syntactically correct: it won’t pass the @Brambos compiling to some internal machine version at runtime. @Brambos… there’s a clever lad, too.

    I’ll bet his code is elegant… the music they produce certainly is sublime. Salome? Wow.

    You guys are amazing! If anyone can make the creation of code by AI a viable option then it’s you, Wim, ki etc. I look forward to seeing how it progresses 👍

  • wimwim
    edited June 2025

    Ha ha! Not me. 😂

    If coding can be thought of like cooking, I like to cook. Sure, I could order fancy takeout and it'd be easier and probably taste better too, but I wouldn't have the pleasure of the cooking itself.

    Or, to torture the analogy further, I could stand around in the kitchen and prompt a teenager that thinks he knows everything but who really only knows enough about cooking to be dangerous, and iteratively fix up his mistakes, until I finally get the meal I wanted.

    That ain't what I'm after when I crack open my Mozaic code editor.

    Y'all have fun though. 😎✌🏼
    (seriously - I mean that. I have no beef with AI as long as it doesn't end up killing us all)

    That's not to say I haven't dipped into chatGPT a few times to crack a coding logic problem hurting my brain. That has helped a few times, but probably less often than when it has been more trouble than it's worth.

  • @wim said:
    Ha ha! Not me. 😂

    If coding can be thought of like cooking, I like to cook. Sure, I could order fancy takeout and it'd be easier and probably taste better too, but I wouldn't have the pleasure of the cooking itself.

    Or, to torture the analogy further, I could stand around in the kitchen and prompt a teenager that thinks he knows everything but who really only knows enough about cooking to be dangerous, and iteratively fix up his mistakes, until I finally get the meal I wanted.

    That ain't what I'm after when I crack open my Mozaic code editor.

    Y'all have fun though. 😎✌🏼
    (seriously - I mean that. I have no beef with AI as long as it doesn't end up killing us all)

    That's not to say I haven't dipped into chatGPT a few times to crack a coding logic problem hurting my brain. That has helped a few times, but probably less often than when it has been more trouble than it's worth.

    I understand the analogy perfectly! I started to dabble with music on the iPad as a way of passing the time after I retired. I saw Mozaic and although I’d never been bothered by programming I thought it would be good to be able to create something as and when needed but I just couldn’t get into it enough. I thought (and still do) that AI might be able to provide me with a good initial framework on which to develop further but I realise I still don’t understand enough to debug the code as required. As I get older I’m losing the ability to concentrate for any length of time and lack the patience required! I’ll still dabble but don’t expect to have much success, but hey, it keeps me off the streets 😁

  • @_ki hi, I noticed that when I reopen a saved AUM session containing Mozaic with the Chance Octaver script loaded, it doesn’t recall its last state. I leave it at 100% in and Shift up 2 octaves, but when I reopen the session it is back to the default in 20% Shift +1. Is that a Mozaic thing or particular to this script and is there a way to make it recall its state properly?

  • @jking said:
    I understand the analogy perfectly! I started to dabble with music on the iPad as a way of passing the time after I retired. I saw Mozaic and although I’d never been bothered by programming I thought it would be good to be able to create something as and when needed but I just couldn’t get into it enough. I thought (and still do) that AI might be able to provide me with a good initial framework on which to develop further but I realise I still don’t understand enough to debug the code as required. As I get older I’m losing the ability to concentrate for any length of time and lack the patience required! I’ll still dabble but don’t expect to have much success, but hey, it keeps me off the streets 😁

    Besides just enjoying light coding (I always have), that's another reason I keep up with Mozaic. I feel the same tendency towards mental decline and it's a way that works for me to keep exercising my brain. It helps that I'm not goal oriented, so the finished product is rarely the main goal or I would get frustrated too.

    But sometimes you just want a cake without spending a ton of time in the kitchen. Them cake mixes taste pretty damn good and even the canned frosting isn't bad. The family doesn't care how it was made either. 😎

    btw, I'm not knocking what you didi with the AI. I was surprised that you were able to get such a nicely structured and relatively problem free program out of it. 👍🏼

  • @wim said:

    @jking said:
    I understand the analogy perfectly! I started to dabble with music on the iPad as a way of passing the time after I retired. I saw Mozaic and although I’d never been bothered by programming I thought it would be good to be able to create something as and when needed but I just couldn’t get into it enough. I thought (and still do) that AI might be able to provide me with a good initial framework on which to develop further but I realise I still don’t understand enough to debug the code as required. As I get older I’m losing the ability to concentrate for any length of time and lack the patience required! I’ll still dabble but don’t expect to have much success, but hey, it keeps me off the streets 😁

    Besides just enjoying light coding (I always have), that's another reason I keep up with Mozaic. I feel the same tendency towards mental decline and it's a way that works for me to keep exercising my brain. It helps that I'm not goal oriented, so the finished product is rarely the main goal or I would get frustrated too.

    But sometimes you just want a cake without spending a ton of time in the kitchen. Them cake mixes taste pretty damn good and even the canned frosting isn't bad. The family doesn't care how it was made either. 😎

    btw, I'm not knocking what you didi with the AI. I was surprised that you were able to get such a nicely structured and relatively problem free program out of it. 👍🏼

    It’s ok, I know that you weren’t criticising😁 I was an analyst in working life so am pretty good at defining/understanding requirements but there was always someone else to convert those requirements into code. I was pretty good with SQL but just didn’t take to coding at all! You’re right, as you get older it’s important to keep your brain active. You’re very modest, I’ve seen what you’ve produced and how much you’ve helped other people on this forum. You’re a brilliant coder and I wish that I had a small fraction of your skill. 👍

  • @jking - awww. thanks for the kind words.
    Not brilliant by any means. Just persistent and with a lot of time on my hands.

    I still love SQL. It's how I got sucked into an almost 40 year IT career - screwing around querying a customer database on a VAX 750 the size of a garbage dumpster, with a 20mb hard drive that took three people to lift. I got nothin' to SQL anymore, so here I am. 😂

  • @wim said:
    @jking - awww. thanks for the kind words.
    Not brilliant by any means. Just persistent and with a lot of time on my hands.

    I still love SQL. It's how I got sucked into an almost 40 year IT career - screwing around querying a customer database on a VAX 750 the size of a garbage dumpster, with a 20mb hard drive that took three people to lift. I got nothin' to SQL anymore, so here I am. 😂

    Just keep doing what you do, it certainly helps a lot of people 😁👍

  • OK… I imported a Mozaic script telling the AI that it was well formed Mozaic code and gave it this prompt

    “ Make me a Mozaic script for converting CC values to NoteOn values”

    It produced this script:

    @OnLoad
      // Define the CC number to listen for
      CCNumber = 1
    
      // Define the threshold value for triggering NoteOn
      Threshold = 64
    
      // Define the MIDI note number to trigger
      NoteNumber = 60
    
      // Define the MIDI velocity for the NoteOn message
      Velocity = 100
    
      // Initialize the previous CC value
      PreviousCCValue = 0
    @End
    
    @OnMidiInput
      if MIDICommand = 176 // CC message
        if MIDINumber = CCNumber
          CCValue = MIDIValue
    
          // Check if the CC value has crossed the threshold
          if CCValue >= Threshold and PreviousCCValue < Threshold
            SendMIDIOut 0x90, NoteNumber, Velocity, 0 // Trigger NoteOn
          elseif CCValue < Threshold and PreviousCCValue >= Threshold
            SendMIDIOut 0x80, NoteNumber, Velocity, 0 // Trigger NoteOff
          endif
    
          PreviousCCValue = CCValue
        endif
      endif
    @End
    

    and provided this text explanation.

    This script listens for CC messages on a specific CC number (defined by CCNumber) and triggers a NoteOn message when the CC value crosses a certain threshold (defined by Threshold). The NoteOn message is sent with a specific note number (defined by NoteNumber) and velocity (defined by Velocity).
    You can adjust the CCNumber, Threshold, NoteNumber, and Velocity variables to suit your needs.
    If you want to map different CC values to different notes, you can modify the script to use an array to map CC values to note numbers. Let me know if you need help with that!
    

    Lots of work needed to make it do what I requested but helpful at some lines I wouldn’t need to type.
    The first error is the “MIDINumber = CCNumber” that I changed to “MIDINumber = MidiByte2” and so it goes…

  • Anyone know what scripting language Mozaic is based upon?

  • wimwim
    edited June 2025

    @MrStochastic said:
    Anyone know what scripting language Mozaic is based upon?

    It isn't based on any particular scripting language. It is its own thing though it has influences from a other programing languages. I see similarities to Pascal for one.

  • I thought is was great that the first provided script made a syntax error with 2 ‘=‘s.

    If ChordType == 0
    

    then I uploaded one script without errors and asked for another solution and
    it changed an “if” statement to:

    if MIDICommand = 176
    

    Lower case “i” which is the convention in the docs but Upper Case is not treated as significant
    But that “=“ rather than “==‘ used as a comparison (a boolean test essentially) is important

    Google Gemini reports:

    Most widely used imperative and object-oriented programming languages follow the convention of using == for comparison and = for assignment. This distinction helps prevent common errors where a programmer might accidentally assign a value instead of comparing it within a conditional statement.
    Here are some prominent examples:
    Languages that use == for comparison and = for assignment:
     * C
     * C++
     * Java
     * JavaScript (with an important distinction: == for loose equality, === for strict equality that also checks type)
     * Python (Python also has := (the "walrus operator") for assignment expressions within larger expressions, but = remains the primary assignment operator)
     * C#
     * PHP (similar to JavaScript, == for loose comparison, === for strict)
     * Go
     * Rust
     * Swift
     * Ruby
     * Perl
    Languages that use a different symbol for assignment (and thus, often use = for comparison):
    Some languages, particularly older ones or those with different paradigms, have chosen alternative symbols for assignment:
     * Pascal: Uses := for assignment. This allows = to be used exclusively for comparison.
     * ALGOL: Also used := for assignment.
     * R: Uses <- and <<- for assignment (though = can also be used in some contexts, it's generally recommended to use <- for clarity and consistency).
     * Smalltalk: Uses _ for assignment.
     * APL: Uses ← for assignment.
    The choice of == for comparison and = for assignment has become a de-facto standard in a large portion of the programming world, largely due to the influence of C and its descendants.
    

    Mozaic uses = for comparison and assignment similar to BASIC which pre-dates C (which followed B at Bell Labs).

  • @wim said:

    @MrStochastic said:
    Anyone know what scripting language Mozaic is based upon?

    It isn't based on any particular scripting language. It is its own thing though it has influences from a other programing languages. I see similarities to Pascal for one.

    Hmm;

    @McD said:
    Mozaic uses = for comparison and assignment similar to BASIC which pre-dates C (which followed B at Bell Labs).

    You programming guys are way over my head but I thought I might try to coax something with ai and see how quickly I get frustrated. 🤓

  • @MrStochastic said:

    @wim said:

    @MrStochastic said:
    Anyone know what scripting language Mozaic is based upon?

    It isn't based on any particular scripting language. It is its own thing though it has influences from a other programing languages. I see similarities to Pascal for one.

    Hmm;

    @McD said:
    Mozaic uses = for comparison and assignment similar to BASIC which pre-dates C (which followed B at Bell Labs).

    You programming guys are way over my head but I thought I might try to coax something with ai and see how quickly I get frustrated. 🤓

    Honestly… it’s not ready unless you can understand the error messages and have an idea what to do replace the errors.
    But I did expect it to mature rapidly and produce a higher percentage of working code. I’m going to drop some prompts into
    the other top AI services and see how they compete against each other.

  • Google’s Gemini reports:

    I am sorry, but I cannot directly "produce Mozaic scripts from prompts." My capabilities do not extend to generating code or scripts for specific, proprietary software like Mozaic. My function is to provide information, answer questions, and generate various types of creative text formats based on the data I have been trained on.

    If you can describe what you want the Mozaic script to do in general terms, I might be able to help you by:

    • Explaining the logic: I could describe the steps or algorithms that a script would need to follow to achieve your desired outcome. This might give you a foundation to write the script yourself or to better explain your needs to someone who can write it.

    • Providing relevant information: If your Mozaic script relies on specific data processing, mathematical calculations, or logical conditions, I can help explain those concepts.

    However, I cannot write the actual Mozaic-specific syntax or functions. You would need to refer to Mozaic's documentation or consult with a Mozaic expert for that.

  • OpenAi’s reports:

    Yes, I can help you produce Mozaic scripts from prompts—but first, could you clarify which type of Mozaic you’re referring to? There are a few possibilities:
    1. Mozaic VPL (Visual Programming Language) – Often used for music, video synthesis, or interactive media.
    2. Mozaic Script (Audio-focused, like on iOS AUv3 plugins by Bram Bos) – A scripting language to build MIDI plugins.
    3. Mozaik (sometimes used in digital signage or data dashboards) – A framework for monitoring dashboards.
    4. A custom or internal tool/system named Mozaic – Proprietary or organization-specific.

    Please let me know which one you mean (and ideally the syntax or use case), and I’ll be able to generate scripts accordingly.

  • I jumped right in with this prompt:

    I would like a script that displays 22 knobs and outputs MIDI CC’s 20-41 for any turns of the 22 knobs.

    and quickly got this script as a reply:

    // Mozaic Script: CC Knob Bank (CC 20–41)
    // Author: ChatGPT
    // Description: 22 knobs that each send a corresponding MIDI CC (20–41)
    
    @OnLoad
      LoadPreset
    
    @Init
      i = 0
      while i < 22
        SetKnobLabel i, "CC " + (20 + i)
        i = i + 1
      end
    
    @KnobChange
      ccNumber = 20 + Knob
      ccValue = GetKnobValue(Knob)
      SendCC ccNumber, ccValue, 1  // Sending on MIDI Channel 1
    

    This reminds me of a joke:
    I have a quick question.
    OK. I will give you a quick answer… that’s totally wrong.

    So, I started fixing it up and created this complete and effective script:


    // Mozaic Script: CC Knob Bank (CC 20–41) // Author: ChatGPT // Description: 22 knobs that each send a corresponding MIDI CC (20–41) @OnLoad ShowLayout 1 // the Layout that displays 22 knobs Call @Init Channel = 0 @End @Init for i = 0 to 21 Log {i} LabelKnob i, {CC },i endfor @End @OnKnobChange ccNumber = 20 + LastKnob ccValue = GetKnobValue(Knob) SendMIDICC Channel, ccNumber, ccValue, 1 // Sending on MIDI Channel 1 @End
  • @McD You'd probably want to feed it the Mozaic manual and as many good scripts as you can, right? Instead of just a single script. I think Claude Sonnet is regarded as best for coding, overall, but that may have changed, and some ChatGPT models will be better than others.

  • @Gavinski said:
    @_ki hi, I noticed that when I reopen a saved AUM session containing Mozaic with the Chance Octaver script loaded, it doesn’t recall its last state.

    You are right - the if Unassigned didn‘t check for the correct variable transpose .

    I uploaded a new v1.2 to patchstorage.

  • @Gavinski said:
    @McD You'd probably want to feed it the Mozaic manual and as many good scripts as you can, right?

    It’s hard to know… the fact that Meta AI asked me which “Mozaic” I wanted indicate some awareness of the
    syntax which the manual details. I would hope that one user uploading a script would improve the model
    and we can collectively make the resulting code better with use.

    Instead of just a single script. I think Claude Sonnet is regarded as best for coding, overall, but that may have changed, and some ChatGPT models will be better than others.

    I’m paying for Google Gemini and ChatGPT since they are the big dogs of AI. I can check out Claude but I suspect it doesn’t
    have the traction with the dozens of Mozaic coders required to be worth much. Ranking computer languages would go for pages and pages without ever getting to the @Brambos creation. It’s one of the best kept secrets in Music Production. It’s also a dead language without the usual process of fixing language constraints that programmers request. Not a @Brambos problem because he put in a lot of time to give us one of those apps that just work as intended and will never be re-designed because it didn’t sell like Hot Cakes because “programming is fucking hard” just like the maths (I get a kick out of using the British plural for math).

  • McDMcD
    edited June 2025

    This is a conversation I started to evaluate Meta AI’s usefulness in Mozaic Script generation:

    Can you write a Mozaic MIDI generator that produces interesting melodies?

    Here's a basic example of a Mozaic MIDI generator script in Max/MSP (also known as Max for Live in Ableton Live). This script will generate a simple melody based on a given scale and some randomization.
    However, I can provide you with a Python example using the music21 library, which can generate MIDI files. Here's a simple script:
    Python
    import music21
    from music21 import note, stream
    import random
    
    def generate_melody(length, scale):
        melody = stream.Stream()
        for i in range(length):
            pitch = random.choice(scale)
            n = note.Note(pitch)
            n.duration.quarterLength = random.uniform(0.5, 2)
            melody.append(n)
        return melody
    
    # Define a scale (C Major in this case)
    scale = ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4']
    
    # Generate a melody of 20 notes
    melody = generate_melody(20, scale)
    
    # Write the melody to a MIDI file
    melody.write('midi', fp='melody.mid')
    
    This script generates a melody of 20 notes, with each note being a random choice from the C Major scale. The duration of each note is also randomized between 0.5 and 2 quarter notes.
    You can modify the generate_melody function to create more complex melodies, or experiment with different scales and randomization techniques.
    If you're looking for something more advanced, consider using Markov chains or other algorithmic composition techniques.
    To use this script, you'll need to have Python and the music21 library installed. You can install music21 with pip:
    Bash
    pip install music21
    

    Can you re-write that script for use with the Mozaic app on IOS?

    Mozaic is a powerful MIDI scripting app for iOS. Here's a basic example of a MIDI generator script in Mozaic:
    Code
    @OnLoad
      InitializeMIDI
      SetScale Major, 0  // C Major
      SetRootNote 60     // Middle C
      SetLength 20       // Generate 20 notes
      GenerateMelody
    @End
    
    @Script GenerateMelody
      For i = 0 to Length-1
        Note = GetRandomScaleNote
        SendMidiNoteOn 0, Note, 100
        Wait Random 120, 480  // Random duration between 0.5 and 2 beats
        SendMidiNoteOff 0, Note
      End For
    @End
    
    @OnMidiNote
      // You can add additional MIDI handling here if needed
    @End
    This script generates a melody of 20 notes, with each note being a random choice from the C Major scale. The duration of each note is also randomized between 0.5 and 2 beats.
    To use this script in Mozaic, create a new script, paste the code, and then load it into a MIDI track. You can adjust the SetScale, SetRootNote, and SetLength variables to experiment with different melodies.
    Note that Mozaic's scripting language is quite different from Python, so this script is tailored to Mozaic's specific syntax and functionality.
    If you're new to Mozaic scripting, I recommend checking out the app's documentation and example scripts to learn more about its capabilities and syntax.
    

    Can you re-write it to use the C Minor scale?

    Here's the modified Mozaic script using the C Minor scale:
    Code
    @OnLoad
      InitializeMIDI
      SetScale Minor, 0  // C Minor
      SetRootNote 60     // Middle C
      SetLength 20       // Generate 20 notes
      GenerateMelody
    @End
    
    @Script GenerateMelody
      For i = 0 to Length-1
        Note = GetRandomScaleNote
        SendMidiNoteOn 0, Note, 100
        Wait Random 120, 480  // Random duration between 0.5 and 2 beats
        SendMidiNoteOff 0, Note
      End For
    @End
    
    @OnMidiNote
      // You can add additional MIDI handling here if needed
    @End
    The only change is that SetScale now uses Minor instead of Major. This will generate notes based on the C Minor scale (C, D, Eb, F, G, Ab, Bb).
    If you want to specify a different root note for the minor scale, you can adjust the SetRootNote value. For example, to use A Minor, you would set SetRootNote to 69 (A4).
    Keep in mind that Mozaic's GetRandomScaleNote function will generate notes based on the scale degrees, so you'll get a mix of natural and flat notes (Eb, Ab, Bb) in the C Minor scale.
    

    Loading this last script generates these errors:

    [OnLoad] Syntax Error: unknown or invalid argument "GENERATEMELODY"
    [OnLoad] Syntax Error: unknown or invalid argument "SETLENGTH"
    [OnLoad] Syntax Error: unknown or invalid argument "SETSCALE"
    [OnLoad] Syntax Error: unknown or invalid argument "INITIALIZEMIDI"
    [MOZAIC] Script loaded.

    After debugging the code I ended up here with a useful random melody script:

    @OnLoad
      PresetScale {Minor} 
      SetRootNote 60     // Middle C
      Length = 20
      i = 0
      Transpose = 0
    @End
    
    @OnMidiNoteOn
        Inc i
        If i = Length
           Transpose = Random 0, 11
            i = 0   
        endif  
        Note = Random 48,72
        SendMidiNoteOn 0, Note + Transpose
        // Random 120, 480  // Random duration between 0.5 and 2 beats
        SendMidiNoteOff 0, Note + Transpose, 1000
    @End
    
    @OnMidiNoteOn
      // You can add additional MIDI handling here if needed
    @End
    

    I loaded up 2 instances in AUM and pushed the MIDI output of 2 Limbeats drummers into them…

  • wimwim
    edited June 2025

    @McD said:
    This is a conversation I started to evaluate Meta AI’s usefulness in Mozaic Script generation:

    Can you write a Mozaic MIDI generator that produces interesting melodies?

    Loading this last script generates these errors:

    [OnLoad] Syntax Error: unknown or invalid argument "GENERATEMELODY"
    [OnLoad] Syntax Error: unknown or invalid argument "SETLENGTH"
    [OnLoad] Syntax Error: unknown or invalid argument "SETSCALE"
    [OnLoad] Syntax Error: unknown or invalid argument "INITIALIZEMIDI"
    [MOZAIC] Script loaded.

    There's a helluva lot more than that wrong with them. Those last scripts are utterly worthless. At least the @jking scripts were close enough that a beginner might be able to debug them and learn from the experience. These would only set them back. They'd be far better off starting with the @brambos tutorials.

    I get what you're trying to do. I wish I had your patience and perseverance for such things. 😉
    Maybe it'll pay off at some point.

Sign In or Register to comment.