I am a novice and want to add a new keyboard, C3-C5, and I can’t find any other good places to learn, whether paid or free, so I had to find AI but what he provided was wrong..
AI can be very powerful but it can also be very braindead. AI is powerful brain-death.
In any case, don’t forget to read the documentation! And, read the code! Always read the code first, before you go asking AI questions, so that you know how to formulate the question properly!
What you are looking for, most likely, is to use both setAvailableRange() as well as setLowestVisibleKey(). Set the available range from C3-C5 (MIDI Note # 48 - 72), and lowest Visible Key to 48.
AI may not know enough about your question to use the “Yamaha/Scientific Pitch Notation” standard for MIDI Note numbers .. but I bet if you knew that’s what JUCE used, you’d have gotten the right answer ..
Also, keep in mind that the “cheap AI” is intentionally prompted to introduce subtle flaws in its answers, just to keep you on your toes…
You didn’t really explain what is actually going wrong with the code. There is a compilation error? The keyboard component doesn’t appear at all in the processor editor? The set MIDI note range was not what you expected?
AI is really handy complex search tool, especially Gemini flash. Although learning Juce is probably a bad way to go as it sees so many different styles that it uses to confidently say are correct together, only to apologise profusely when you point out the mistakes it made! It does correct the issues you point out, though, but I don’t think your corrections go back into the model, just the current Chat.
After a while, I realised it was better at small algorithmic functions. For example, it bashed out a line simplifying function for me in a P5 sketch to see it in action, then converted it to C++ for me really well. I already had a Ramer–Douglas–Peucker algorithm coded up, it was a test, but it gave me the same results. That was using a downloaded AI, like Qwen coder, which needed only a 24Gb of GPU ram. All done local to me, privately.
Although I’m a seasoned coder (old), I’m no Luddite. I see AI as a tool, or a dumb but enthusiastic Intern! It can be great if used sparingly. Google’s Gemini flash is the best free one I’ve used, I haven’t paid to use AI yet.
It can be a massive time drain though, when you can code up what you want quicker than explaining and debugging some AI’s idea. Probably best used in your spare time if you have any… it’s fun if you can get over your underlying unease you may have about it.
This is the guy that started me off in all things Juce: https://www.youtube.com/theaudioprogrammer
And thankfully there’s a lot of example plug-ins out there you can peruse. There are no shortcuts, unfortunately.
Last time i vibe coded a moderately sized complex software, to test the effectiveness of a model, it took me 3 days to tell the agent to fix a bug. It ended up changing lot of stuff all around, leaking responsibilities and internal details, breaking the great separation of concerns and single responsibility and open-closed patterns i had carefully applied to the software, it added duplicated code all over the place, for a staggering 5000 lines of added crap, plus now all my methods were filled with debug messages and try catch blocks. The bug was still there. Then i had enough of trying to write more details to the model without having to go and check what was wrong. In order to create the right prompt for fixing what i didn’t know i had to debug. So did that, 3 minutes after the issue was clear and instead of creating a prompt i fixed it, for real, the final commit was 3 lines of changed code and that’s it.