Music and Coding

I’m curious to know if anyone here has ever done any coding related to making music, be it scripting in a daw or synth, coding custom plugins with something like JUCE, or playing around with any languages like CSound or Supercollider.

Is anyone in the forum a hobbyist or professional coder?

On a somewhat related note, I just learned that Logic has a MIDI module called Scripter, which lets you process incoming MIDI using JavaScript. I’ve been using Logic for like 10+ years and just now found out. Learn something new every day I suppose.

2 Likes

I’m not a professional, but I taught myself to code a few years ago and use it all the time (probably on a daily basis, honestly) for music and art projects. It’s what supercharges my shit, next to modular.

I’m hitting snags in the DSP algorithm department because my math skills suck and I never went to high school (long story), but as far as scripting, logic and using libraries for the heavy algorithms go, I never really regret knuckling down and at least getting comfortable with the stuff.

There are scripting APIs everywhere, though, you just need to look harder for some. FL Studio, Renoise, Falcon, most modular systems that are worth anything and well beyond (including quite a number of DAWs like Reaper and Mixbus, or literally anything on Linux) all have stockpiles of resources you can tap into, sometimes even with IDEs that fill out 95% of the code and UI elements for you. And that’s not even to mention some of the other great coding applications for music, but I’ll stop there to avoid clogging things up. I could go on forever :smiley:

1 Like

Your enthusiasm is most welcome, and I’m sure I could go on for a long time as well.

To clarify, I’m actually a software engineer in my day job. This skill has been slowly creeping into my music production over the years, and I’ve played around with scripting in falcon, and supercollider a fair bit.

recently, I started exploring making VST’s in JUCE. Nothing crazy to show yet, still getting my bearings, but i have some ideas in my head that i want to try and make a reality.

Modular is still not something i have now, but I think that’s going to change soon. :slight_smile:

2 Likes

Hell yeah. I think I’m kind of doing this from the “help me, C++ is scary!” end – I’ve been trying to get some stuff up and running in Blue Cat’s Plug’n Script but still having a hell of a time digging through formulas and trying to actually implement them in code. Soon enough I’ll stumble upon some library and just use that.

The easiest one for me so far to actually implement is Voltage Modular’s Designer (it’s all free, don’t let them trick you), because they hand you a shitload of oscillator, filter and distortion objects to play around with right off the bat. I think I’ve made over 30 modules so far and some of them proved to be quite useful for my rigs :smiley:

I kind of want to strengthen my knowledge as a coder for this, though, just so I can tap into and convert larger libraries down to small projects (like modules). Processing libraries like Beads and Minim use UGens, where I need double data types, and converting over is where my brain shuts down. I can get some of the (Processing library) generators to work in VMD (natives work fine), but implementing the FX correctly is a bust due to my lack of knowledge. Need smarter brain :sweat_smile:

1 Like

The good thing is for learning, if you know how to prompt chat gpt, then it’ll spit out code in whatever language you want. Then you can piece it together.

3 Likes

From what I can tell so far, it only really knows publicly-available algorithms and never knows how to implement them in the way you want. I’ve tried to get it to write converters (for the purpose I mentioned) along with even basic effects (like comb filters) and it fails every time. Once me and the bot refactor it a million times, it definitely runs without errors (although it’s like trying to get a kid to write code to begin with) but the effect isn’t even close (usually it just ear-rapes the shit out of you and does nothing else).

I think there will probably come a day when that stuff actually works, but in my experience it really only works for those generic questions that everyone has answered a million times that you can basically just copy and paste from Stack overflow if you really need to. It’s probably really good for people who can’t code to begin with (although I think that’s probably a bad thing over all, but who knows), but it’s not even remotely close for DSP. Even if you literally feed it an algorithm from Beads or Minim, it’ll never be able to connect the dots.

(That is the part where I’m failing, though, so your post is still correct. I just feel that if I were a little better at algorithms in general, just going on Wikipedia would be more useful than using a bot)

The only real successes I’ve had were processing images with the Processing language. It wrote me convolution matrices, edge detection and all sorts of crazy shit in the exact way I wanted, but that’s because the information is just chilling on forums and elsewhere in massive quantities and nothing had to be converted from one guy’s data structure to the next. But even after that, I got a crippling feeling of, “I need to learn these algorithms”.

I’ve done some audio coding, though it’s tended towards standalone apps or embedded programming vs VSTs, mostly in C/C++ with a bit of ASM. I’ve looked at JUCE several times but having to jump through hoops to get it set up and learning the API has always stopped me from messing with it in lieu of just doing Windows native code (which is a stupid, horrible, terrible experience, but once you have a working API/framework you can just keep reusing it).

I have a feeling that just using the VST3 SDK would be about like working with platform audio - framework out your own API/boilerplate over the SDK API and then just keep reusing it. It looks like JUCE does all that for you, as well as providing an IMGUI interface over it to easily tweak numbers. If you’re not wanting to build out the VST3 abstraction, JUCE is probably the simplest way to get up and running.

I’ve found Desmos | Graphing Calculator to be super handy for visualizing what a given algorithm is doing and how changing the formula alters the output. It’s not going to fully replace understanding the math behind it, but might help you intuit what’s going on. I actually have a background in mathematics, but my last harmonic analysis class was over 20 years ago so sometimes it’s easier to just watch the pretty lines move around than try to parse a crazy formula for things I barely remember :smile:

3 Likes

Wow, I change my opinion about Chat GPT. Or maybe it has gotten better?

I was writing a gigantic script for Processing and basically got it to collaborate (nearly in real-time) with my format while allowing it to interject all of the linear algebra I don’t understand to make filters and shit work.

Technically it’s no different from using a library that doesn’t exist and is tailored to the project, so that part is actually pretty cool. I know it’s probably just plagiarizing Pillow or something and converting it to Java, but it’s crazy how accurate it has gotten very recently.

Still makes me want to learn more DSP specifically, but it’s cool to borrow some sorcery until then

1 Like

Yeah, it has gotten better, although it’s been pretty good for a while now.

I use GTP in the form of co-pilot all of the time in my professional work and in personal scripts. It’s not always 100% accurate, but a lot of the time it will do most of the legwork for you.

It’s not a complete replacement however, as it will often times have limited knowledge of specific libraries, depending on what you’re working in, although this is mostly the case with my professional work since a lot of that is proprietary, so I still have to know pretty much everything.

That being said, it easily generates large chunks of code that usually get you 90% of the way there. Fundamental and intermediate programming concepts in general it has no problem generating, and as long as it has knowledge of a specific library it does a pretty good job. Although there are more than a few instances when i’ve asked it for help on something more complex and it tries to tell me to use a function that doesn’t exist on a particular class or something like that.

I’ll be like “Yo, you told me to use this function, but it doesn’t exist on this thing”

And it will apologize for the error and promptly proceed to give me an even more incorrect answer. It repeats this until it’s eventually like, “I don’t know what you’re talking about, try looking in the documentation” lol

I have a love hate with AI at this point, but for coding purposes, it’s pretty slick and a huge time saver.

2 Likes

It’s funny when it is like “I’m so sorry, you are right, I made mistake XYZ. Here is the corrected code:…” and it has either exactly the same problem without any change, or it is a previous version that has another problem already identified earlier. Or when you give it a short text and tell it to make it simpler/better/whatever, and it gives you the exact same unchanged text and after prompting to list the changes it made, it gives you a list of changes that make no sense whatsoever and are not in the text…
It’s a great help though for all kinds of tasks from coding to text generation, proof-reading or translating… I’m looking forward to our AI overlords <3 :smile:

3 Likes

Rather than write a ranting screed about LLMs and modern software, I’ll just say: I’ve had a lot more misses than hits with it. Like the kid that took your lunch money, it’s just a product of its environment.

2 Likes

I’d be interested in hearing a good rant about LLMs, lol.

Matthew Broderick in shambles.

2 Likes

You want a screed? I’ll screed ya up good.

LLMs are bad not because of what they are, but because they’re the canary in the coalmine for modern society/capitalism/programming practices/old man shakes fist at cloud. My rant has more to do with the latter than LLMs themselves.

If I want C, Gippty gives me C++ because you can hurt yourself with raw pointers. Its ASM is almost unusable in anything memory constrained. It can’t cycle-optimize in any language if you had a gun to its CPU. It apparently doesn’t know how SIMD works. I’ve never see an algorithm from it that I didn’t have to rewrite or couldn’t have just googled for. Outside of boilerplate or the trivial case I’ve never gotten anything from it that I couldn’t have just written myself in less time than it took to prompt and then fix what it spit out. The senior DBAs at work all say that its SQL is terrifying unoptimized and would cost a golden parachute to run at scale.

Why? Because it doesn’t understand programming, it doesn’t know what code means or what it does. It’s trained on an internet full of bad advice from people that aren’t good programmers - stackoverflow, reddit, someone’s uncle’s blog. It does not problem solve, it just kluges other people’s solutions. It can’t reason about anything, it only synthesizes and regurgitates the freely available mediocrity that’s out there.

LLMs exhibit the same problems that any ‘engineer’ at a place with ping pong tables and kale wraps exhibits - they’re based on a culture where programming is a commodity and not an art or a science. It’s minimum viable product and time to market, and almost without exception it’s an embarrassing mess of slow, janky, overdone but underperforming shit. We’ve gone from putting people on the moon in ~145k LoC to websites and programs that take 30 seconds to load on hardware that’s literally 8-10 orders of magnitude more powerful. (technically not an apples-to-apples comparison, but it does underscore the scope of the issue.) And the modern world has decided that’s okay, so it keeps happening.

We’re in a Catch-22 of fancy bloated cloud-based webapps so companies complain that their hosting costs are high so you have to have ad revenue so you inject ads that further bloats the system and now you have an ecosystem where everything just gets worse and slower because you literally have to pay for your bloat. There are obvious parallels to corporations and stock markets here, which make me equally apoplectic but are left to an exercise for the reader.

You want to see the clown car driving into the dumpster fire? Node. They took the dumbest, most ass-backwards, underperformant, lower common denominator language ever conceived of and decided “sure, we can run that server-side!”, Talk about asking if we could without asking if we should.

Why did Node catch on? Because half-baked programmers from 6 week boot camps could use it. These are people that got told that the whole world is going digital and if you don’t want to wash dishes the rest of your life, you’ll plop down a bunch of money and ‘learn’ to code. Which is like saying I can teach you to make IDM tracks in 6 weeks for a bucket of cash. And some of them got jobs doing boilerplate scutwork because you’re already okay with slow, janky code and just need it to get done in time for that product launch or the Series A meeting next week.

And now the rubber meets the road - we’ve got a workforce of junior programmers that didn’t get into it because they loved it and found it fascinating and wanted to improve the world, they did it because it beats washing dishes. And you’ve got a brand new tool that can do the same thing at basically no cost - who’s the first out the door on the back of our AI overlords?

On the flip side of the coin you have collegiate programs, and honestly if it’s that or boot camps, I’d take the boot camp. College is way more expensive and it teaches you some of the most outdated concepts ever, because the people teaching you either never left the academic system or haven’t programmed professionally since COBOL was new and hot. So you get to learn C++ with SOLID and Java and UML and a bunch of other stuff that in practice just makes software slow and terrible because these guys don’t have to have performant code, that’s for you to figure out later, they just want to make sure you can count in binary. But now you can use polymorphism in a sentence, so that’s probably worth $70k, right?

Every company knows that the boot camp guys weren’t going to be the top of the heap, they were just warm bodies. But that guy’s got a degree from Purdue! Lets let him work on something important with his zero experience and outdated ideas and he’ll fit in great with the rest of the dudes that have been coasting since making senior and that’s why it takes 30 seconds before I can start typing in Excel, because fuck you Microsoft. And those shitty standards become ‘best practice’ in the workforce because they learned it in school and never bothered to question whether it was actually a good idea.

LLMs are a product of all this. The decline and commodification of software trends right along with the rise of the internet. Anything you can shove into an LLMs black box of a head is somewhere on the continuum of “about to get bad” right up to “we run Javascript on the server”. I just assume they’re going to be bad because they had a shitty teacher - us, from about 2010 to present day. I’ve never seen anything come out of them I’ve truly been impressed with and I think they gloss over important details for less experienced programmers about how code runs at a basic level which just continues to lower the bar. As the quote goes, “if AI made you a 10x programmer, you were probably working on a 0.1x problem”. And sometimes I am, but often I’m not so I don’t see the larger value, for me or for the world.

tl;dr - LLMs don’t make coders better at programming, they just easily enable crappy code to continue, and the world needs less of that.

Thanks for coming to my TURD Talk.

Q&A
Am I painting with too broad a brush? Sure. There’s plenty of great programmers out there under the age of 50, and some of them even came from boot camps. All it takes it loving it and diving into the details and understanding how things work under the hood and not settling for making something that barely functions but making something good and performant and worth the double-click. Plenty of folks out there that fit the bill, but we need more.

Am I gatekeeping? You’re damn right I am. Technology is something that should be gatekept because the quality of it actually has an impact on people’s lives, both personally day-to-day and in aggregate. And it’s something that’s measurable, quantifiable, and it’s easy to hold up a program and say “this is objectively better than this” and I think that’s important for humanity going forward if we’re going to dump all our chips in the post-capitalism tech bucket. We get it wrong at our own peril.

Am I serious about all this or just tongue-in-cheek because it beats actually doing work on a Wednesday? lil’ A, lil’ B :smiley:

3 Likes

Hahahaha! That one got me good. The first job (in industry) i ever had was at a place with the “startup-culture” vibe just like that. That place was a fucking train wreck, and I jumped ship about a year before they went under for good. What a nightmare.

Still parsing the rest of your post, but had to call out that fuckin’ bit because it made me laugh.

I play around with max for live’s javascipt stuff at times. a lot of what i’ve done has mostly been with the probability of a note playing in ableton live.

also this may freak people out, but i just changed careers into Prompt Engineering. So i spend every day at work dealing with LLMs.

2 Likes