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.

Training ChatGPT to write Mozaic code

heshes
edited December 2023 in General App Discussion

I've just started training a custom GPT to do Mozaic programming. It's pretty cool, doesn't involve any programming or, really, any in depth knowledge of training or data mining. In some ways it seems similar to training a real person (but I'm pretty sure GPT catches on more quickly than most).

If you have GPT-4 subscription ($20/month) you can create custom GPTs. The chat in the link below was generated after about 5 minutes of work, basically just creating the GPT and going to configuration section and uploading the Mozaic manual. Other than the manual and the sample code in it, the custom GPT has not been exposed to any Mozaic scripts at all. (I did waste some time trying to train the custom GPT in a different way -- exclusively through chat -- but once I found the spot to upload resources in the config tab that was obviously preferable. )

Here's link to chat where I'm giving arbitrary filtering task to code, and seeing if my GPT understands different ways of doing it.

https://chat.openai.com/share/13d577df-5413-46c8-b154-782b908b6dac

Once I've trained it more I think I can click a button to publish the Mozaic Midi GPT onto the web, so anyone with a GPT-4 subscription can access and use it. I'm not sure how much training it will take, pretty sure it would be useful to someone who knows what they're doing right now. One thing to do is to establish some kind of default program structure for it, e.g., so it assumes that all messages are to be passed through unless told otherwise. Also, right now its responses include quite a bit of explaining, and welll commented code. Can be adjusted to give more terse responses or code-only responses, if desired.

Comments

  • Please feed it code from patchstorage if you can. @_ki and @wim write scripts worth modeling for good habits.

  • @McD said:
    Please feed it code from patchstorage if you can. @_ki and @wim write scripts worth modeling for good habits.

    I'd include scripts from others, too.

  • Absolutely brilliant example of the power of GPT and custom GPTs. Most people still have no idea how insane all of this is. (also spooky at times. I just had it translate a few texts for the App Store, and it just randomly appended an image of a futuristic city, and when I asked it why it did that, it said something like "ah not sure was probably an internal error, sorry about that" 🥴)

  • heshes
    edited December 2023

    I just added on to the previous chat to start to see how much my GPT knew about Mozaic's UI layouts. It's impressive what this thing can do, all with no specific training other than "reading" the Mozaic manual.

    The Mozaic custom GPT appears to understand the different layouts, without telling it anything it understands the difference between pressing and latching a pad, and when I gave it task that required latching it automatically switched to using an array to keep track of which pads are latched. Maybe even more impressive is that it saw how to do the same thing without an array when I pointed out that it could use Mozaic's built-in LatchPad and PadState functions. (I think I do see an error in version where it had array, where it had array initialize outside of '@OnLoad' event, and didn't include an 'endfor' for the 'for' block, but it seems to have corrected these errors when it switched to use Mozaic's latch functions.)

    I haven't checked the code, but at least from cursory check it looks correct. The section asking it about layouts and pads starts about halfway down this current link:

    https://chat.openai.com/share/13d577df-5413-46c8-b154-782b908b6dac

    Also, just noticed that the GPT has been using a 'var' keyword in lines where variable is assigned an initial value. This isn't used in Mozaic, so will train not to do that. . . .

  • Ah, the benefit of a clear, well written manual. More kudos for Bram :-)
    I've only uploaded 3 scripts to patch storage but am happy for them to be used for training.
    I wonder if it will figure out the issues folks had recently with variable scoping?
    And I wonder if we'll alter the way we produce manuals and code manually to make it easier for the AIs to consume. Already seeing this with all those guides available to help 'ask the right question'.

  • edited December 2023

    This is such a cool idea…and the StreamByter one as well.

    If you’re looking for further languages that would be useful, consider Scripter for Logic Pro. I don’t personally use it, but I bet a few people here do. And you’d find a broader audience on the internet as a whole.

    Or maybe Lua…seems that several programs or apps use that for scripting possibilities.

  • wimwim
    edited December 2023

    While I recognize the coolness factor and usefulness potential, personally having ChatGPT write code for me has no attraction. I write Mozaic and Streambyter scripts solely to exercise my mind. I need to keep my mind exercised now that I'm no longer working and bending my brain 10+ hours per day, and I enjoy the challenge.

    I'm the same about music. Using AI to create music, or even using fully generative apps, isn't satisfying to me in the least. Well, maybe to listen to, but I'd have none of the joy of creation and of playing. Wiring up a generative patch from components in miRack or other modular environments can be fun though. There's some participation in terms of ingenuity and creativity involved in that.

    I don't mean this as negative regarding the effort. In fact I think it's interesting and must be a fun intellectual challenge in its own rite. I'll be interested to see the code it produces! But as far as using it to do coding in Mozaic myself, I'd never touch it.

  • heshes
    edited December 2023

    @wim said:
    While I recognize the coolness factor and usefulness potential, personally having ChatGPT write code for me has no attraction. I write Mozaic and Streambyter scripts solely to exercise my mind. I need to keep my mind exercised now that I'm no longer working and bending my brain 10+ hours per day, and I enjoy the challenge. [
    [. . .]
    I don't mean this as negative regarding the effort. In fact I think it's interesting and must be a fun intellectual challenge in its own rite. I'll be interested to see the code it produces! But as far as using it to do coding in Mozaic myself, I'd never touch it.

    Yes, I think I'm mostly investigating this because it's fun. Not much need for writing Mozaic or Streambyter scripts, but other people might find it useful. Or, even more, a good learning tool. By default GPT as coding tool always wants to offer an explanation of what it's doing, in addition to providing commented code. This can be turned off (just tell it not to do this), but for someone who's learning things it provides a big benefit.

    There are several reasons I think a tool like this could be of some use to someone like you, though. Here are some thoughts on this:

    -- Boilerplate code is a drag to write. And to edit. It's no fun when you know exactly what needs to be done, but it requires lots of repetitive code. In case like this, it makes sense to use AI-generated code, at least if it's quick and easy enough to invoke the AI and have it spit out the code. I'm thinking especially of verbose constructs like, e.g., (if I recall correctly) _ki's methods of string handling for pad labels. This involves verbose, repetitive code that can be difficult to change. One way to write and/or edit this kind of code can be to write macros in a capable text editor. An alternative way is simply to tell a Mozaic-aware GPT to make the desired changes.

    -- A closely related point is for code refactoring. Often as you're writing a script you notice that it would work better if it was logically rearranged. Or you want to do search and replace changing a variable name. Or if certain code makes more sense broken out into a separate function. This can create busywork transforming the code into the desired new form. It can be faster and potentially less error-prone to have an AI assistant do the refactoring for you. The AI itself might not have given you the idea for the refactoring, but once you have the idea yourself you can easily get it done by directing the AI to do it. The creative, insightful part is the idea for how to refactor things. Actually rearranging the code is mostly busywork.

    -- Another point is also perhaps related, but at the most overarching level. Writing a program is often more about imagining the desired behavior than writing the code that can accomplish it. Describing the desired behavior can be the main part of things; once that's done correctly, the code can almost write itself. AI is certainly not at the point of writing a complex script from scratch. For example, you can't just say, "Write me a script that recognizes and displays chords that a user is playing on a keyboard." This would not generate a good result. Instead, you need to carefully think of what specs the script will need to have, how it will be organized, and then start writing it. The writing it out part isn't necessarily the interesting part. The interesting part is figuring out, understanding, and describing all the parts of how the program will work. If you know how to do something, maybe you've done something similar many times before, the coding part might actually be drudgery. In case like this using an AI code generator to write the code can be helpful. Describing the problem and how you want the AI to approach it is actually the creative part.

    -- Which leads to the idea that describing the problem and what you want the AI to do could actually be seen as the creative,fun part of coding. As an added fun element, you might interact with a GPT through the voice interface. See how quickly and concisely you can describe the problem as you speak, coaxing the AI into generating an acceptable solution.

  • Great points all, and thanks for taking the time to go into such detail. 😎

    But honestly, I enjoy doing all the things proposed to be done by ChatGPT above. Having AI do those things would rob me of satisfaction. I don't see tedium in any of it. I also need to intimately understand every bit of code I publish. Refactoring would be totally counterproductive because I would then have to go back and understand, validate, and evaluate every change.

    I get it for people in a rush, or to be more productive, or for people who don't know how to code, or as a learn by example process toward writing better code. It's just not for me.

    On the other hand, there have been a few times when I was stuck or just couldn't get my brain going on a particular problem, and yes I did ask ChatGPT for help. Kinda felt I cheated myself a little afterward though, to be honest.

    Don't get me wrong. I think it's great what you're doing and understand why the process is fun for you. 👍🏼

  • @wim said:
    Great points all, and thanks for taking the time to go into such detail. 😎

    But honestly, I enjoy doing all the things proposed to be done by ChatGPT above. Having AI do those things would rob me of satisfaction. I don't see tedium in any of it. I also need to intimately understand every bit of code I publish. Refactoring would be totally counterproductive because I would then have to go back and understand, validate, and evaluate every change.

    I get it for people in a rush, or to be more productive, or for people who don't know how to code, or as a learn by example process toward writing better code. It's just not for me.

    On the other hand, there have been a few times when I was stuck or just couldn't get my brain going on a particular problem, and yes I did ask ChatGPT for help. Kinda felt I cheated myself a little afterward though, to be honest.

    Don't get me wrong. I think it's great what you're doing and understand why the process is fun for you. 👍🏼

    Just think of ChatGPT (or any so-called "A.I." service) as another programmer who happens to work in the same neighborhood. ;)

  • wimwim
    edited December 2023

    @NeuM said:
    Just think of ChatGPT (or any so-called "A.I." service) as another programmer who happens to work in the same neighborhood. ;)

    That explains a lot. I do just about anything I can to avoid interacting with my neighbors. Don't even know most of them. 😉

  • Never imagined ChatGPT could be as good as it is for multidisciplinary self education - can throw almost anything at it and get a response worth considering

  • heshes
    edited December 2023

    @wim said:
    I also need to intimately understand every bit of code I publish. Refactoring would be totally counterproductive because I would then have to go back and understand, validate, and evaluate every change.

    This sounds strange to me. Are you sure you'e using 'refactoring' in the usual way? It's something I'm sure you do, and it's a practice that is critical to writing good code. In its essence it has nothing to do with automation or AI (though automation and AI can help with it). Martin Fowler's book from the 1990's, 'Refactoring: Improving the Design of Existing Code', is one of the classics of programming literature, a book that IMO every programmer should be familiar with.

    In fact, one of the keys to effective refactoring is learning how to do it without needing to evaluate or validate every little edit. You learn how to transform your code into a better design, in ways that you can be confident won't change the operation of the code.

    Refactoring in fact requires an enhanced understanding, dare I say that if you feel like you can't refactor it then you probably don't understand your code well enough. Like I said, though, I expect you already do some of it, you just don't call it 'refactoring'.

  • wimwim
    edited December 2023

    @hes said:

    @wim said:
    I also need to intimately understand every bit of code I publish. Refactoring would be totally counterproductive because I would then have to go back and understand, validate, and evaluate every change.

    This sounds strange to me. Are you sure you'e using 'refactoring' in the usual way? It's something I'm sure you do, and it's a practice that is critical to writing good code. In its essence it has nothing to do with automation or AI (though automation and AI can help with it). Martin Fowler's book from the 1990's, 'Refactoring: Improving the Design of Existing Code', is one of the classics of programming literature, a book that IMO every programmer should be familiar with.

    In fact, one of the keys to effective refactoring is learning how to do it without needing to evaluate or validate every little edit. You learn how to transform your code into a better design, in ways that you can be confident won't change the operation of the code.

    Refactoring in fact requires an enhanced understanding, dare I say that if you feel like you can't refactor it then you probably don't understand your code well enough. Like I said, though, I expect you already do some of it, you just don't call it 'refactoring'.

    What I meant would be more clear if I had said "Having ChatGPT refactor my code would be counter productive..."

    I wasn't saying refactoring isn't necessary. I was saying it would be counter-productive to have ChatGPT do it because then I would have to be sure to understand everything that it did and all the potential impacts of that. I simply would never trust it. Doing such tasks myself, I understand what I'm doing every step of the way and don't have to reverse engineer "someone else's" changes.

    Even if it did a better job than me and it wasn't difficult to understand the changes, it would feel less satisfying than doing it myself. Refactoring and optimizing code to polish it up it is one of my most favorite and most satisfying parts of the development process. It's like you already know the meal you prepared is fabulous, now you get serve it up to your guests. I'm not up for letting a robot do that for me.

    Don't take me wrong. I realize most people could enjoy the code assist. I'm not like most people. That's more than enough about oddball little me though.

  • edited December 2023

    Great idea @hes. This is a great use of GPT, and I have used it similarly for Python. Will definitely check this out.

    P.S. I wish every AI related topic wouldn't get poo-pooed on. These tools have their uses, and everything has pro/cons. It would be nice if someone shares something using AI, it doesn't get dinged for being a hack or whatever. /Endrant

  • Oh cool, I’m going to see if it will refactor the mess i of my Dixie sequencer!

  • wimwim
    edited December 2023

    @auxmux said:
    Great idea @hes. This is a great use of GPT, and I have used it similarly for Python. Will definitely check this out.

    P.S. I wish every AI related topic wouldn't get poo-pooed on. These tools have their uses, and everything has pro/cons. It would be nice if someone shares something using AI, it doesn't get dinged for being a hack or whatever. /Endrant

    If you're referring to my posts then you grossly mischaracterize my intent. I'm not poo-pooing on anything! I've been very clear that I think it's a great effort. If you're gonna say that expressing one's personal preference, while being careful to frame it as only that, then ... never mind ... not gonna say what I'm thinking right now.

    (and btw, it would have been a "one and done" post but the OP engaged on the topic so I needed to respond. I wasn't trying to belabor the point.)

  • I’ve been thinking about this since Chat GPT came online. I assumed one could train it on the language, and get some results, but never tried. I don’t have the subscription, I try to use free Ai tools, but this is really cool.

    Yea it would be a good idea to feed it some of the best scripts on Patchstorage as a base. It would also be awesome if you decided to share some of the better results on Patchstorage so we can use them in Mozaic.

    Cool stuff @hes

  • @SevenSystems said:
    Absolutely brilliant example of the power of GPT and custom GPTs. Most people still have no idea how insane all of this is. (also spooky at times. I just had it translate a few texts for the App Store, and it just randomly appended an image of a futuristic city, and when I asked it why it did that, it said something like "ah not sure was probably an internal error, sorry about that" 🥴)

    I’m constantly surprised when I mention it to friends and family and they have no idea of how great it can be, most never even tried it or barely are aware it’s a free resource.

Sign In or Register to comment.