Learning code + music

I’ve always had a fascination with programming, however I could never really get myself to learn it b/c the books just didn’t explain to me the value of the concepts it was throwing at me to just type this and get that. For example how would say a function relate to programming a video game? So, I would go back to it from time to time, learning some here and there but not really sticking with it.

I always thought to myself if I was ever really going to get into programming it would be b/c of music. Since there are so many soft synths out there (my favorite instrument)
I never really saw myself finding a project that took me to that place.

But as of late I’ve really wanted to look into decompiling my OT’s firmware to look at it, but what language are these even programmed in, machine language, or some other low level language? So I’m curious if anyone would tell me?

From looking at the read me file for the MD’s firmware it definitely looks monstrously technical, and I am not a mathematician and though I’ve certainly gotten more of a technical mindset from beating my head against the OT for the last 2yrs I know learning to code at this level would be quite a feat. But it is definitely getting my curiosity to want to try. Thanks to anyone willing to point me in the right direction.

3 Likes

This thread may answer a lot of your questions. I would pay particular attention to @plragde’s comments about learning resources and ignore mine.

TL;DR: The OT is probably coded in C/C++ or Coldfire assembly.

Assembly is extremely easy to learn because it is structurally simple. A program is a list of instructions, and each instruction can typically take up to two inputs and produce an output. Some CPUs have more instructions than others, and some are better documented than others.

The best thing about assembly is that it maps directly onto the machine code that CPUs execute. But this makes it hard to use from a human perspective, because assembly lacks the kind of grouping and abstraction mechanisms that make life easier on humans. The next problem is that the lack of abstraction means that you need to intimately understand not only the CPU that you are coding for, but also all of the other devices hooked up to it.

If your goal is to learn assembly and you like the idea of coding games and multimedia stuff, then hacking NES games is probably a much better place to start. There is an active community, the NES itself is relatively simple and well documented, and you can start by modifying existing ROMs before you build your own from the ground up.

10 Likes

I’m afraid that if you don’t know much about programming, the firmware of a beloved device is not the place to start. I wish it were otherwise. But this is the world we live in. What’s beneath the hood is really grungy.

There are lots of ways you can get involved with coding via music: Sonic Pi, Overtone, Tidal Cycles are ones that I think are worth investigating.

6 Likes

Thanks @obscurerobot & @plragde for the responses. Yeah, I have some limited dabbling in free courses on python & html but I just didn’t even know if I should ask given the OT is still in production.

@obscurerobot - I will definitely read that thread. I figured it was potentially assembly or something like it. Very helpful to know that I would need to understand the intricacies of the CPU & other hardware involved to really be able to work with it.

@plragde -lol, when you say it’s really grungy, do you mean just that it has such a ton going on that it’s like some ridiculously technical thing that is quite complicated or just some other concept?

But yeah, I wouldn’t want to randomly poke at the code, try and flash it with an augmented firmware and fry it or brick it. Thanks for the suggestions on working with NES ROM’s. I used to use emulators, and that would be an interesting thing, say with the gameboy tracker that inspired the M8 perhaps as a starting point.

2 Likes

@Buad I took the liberty to move this discussion out of the MD alternative OS, because it is very interesting.

4 Likes

Starting with reverse engineering is not the right way, IMO.
You’d better start with open source, that makes it way easier.

I do believe starting with learning the basics is like learning ABC to learn reading/writing words then sentences before you get to real meaningful text.
I know all brains are not cabled the same, but there are so many tutorials out there that you should be able to code simple tasks and understand the basic concepts quickly enough.
Coding audio means maths, but maybe with repetition and tutorials you’ll end to get a significant comprehension of what is useful to you.

VCV Rack could be a framework to create modules, maybe something to check.

Most fun might be music live programming languages such as Chuck.

7 Likes

Hi @Buad. I’m a professional (allegedly) software developer. I’m primarily a backend web developer so I build websites, platforms, databases, system infrastructure etc. Happy to offer advice if I can.

Do you have an idea of what you’d like to achieve? One hopefully-positive piece of advice I can offer is that the majority of people I work with are essentially self-taught. Some of them (including me) went to university to study software engineering but most (including me) were already teaching themselves and most of the academics don’t mean an awful lot. I know guys working at a very high level with no formal training.

It’s never been a better time - there are loads of great resources online including code academies and “how to build your first web site” stuff all the way through to stuff on data science and AI. If you want to build VST plugins or music software then that’s a bit more specialised but there are definitely learning materials out there. Low-level languages like C++ (99% of commercial music software built with that) are not an easy place to start but if you just want to play with a mixture of code and music for fun then you could start with either JavaScript or Python. Both languages have tools/libraries for generating sound and experimenting with music (you’ll have to do your own research, I can’t recall the specifics) and both are genuine real-world languages that are widely-used and would actually be helpful if you ever want to make a living from it.

I’m not going to lie - starting from scratch can be a frustrating process and it takes most people years to get to the level of building complex software like a VST plugin etc. That said, when you first get something simple to work or you get e.g. a web page on the screen with some interactivity, it’s very rewarding and it pushes you on.

These days there are so many frameworks (for web, audio, data science, whatever) that a lot of the most complex stuff is hidden away so it’s easier to get started. e.g. JUCE is widely used for building VST plugins.

I actually wanted to build a VST plugin (I used to work for a major VST plugin developer years ago) but I don’t have the time/energy after the web day job to keep coding in the evening as well! I made a Reason Rack extension once and it was a love/hate experience but that’s coding all over - I’ve been doing it for 15 years as a day job and some days I love it and some days I hate it.

Once you start coding for any length of time, let’s say a few hours a day for several months, you’ll either get bitten by the “bug” and push on or you’ll get bored and quit. No judgement, it’s just one of those disciplines that people either love or hate.

7 Likes

There is also something to be said about coding with other people…
While it’s a great sense of achievement to have something you’ve done from scratch, you can also feel lost and without someone else’s advice you might loose sight of your objectives…
I have found it really interesting to talk about design, concepts but also integration with people I collaborate with.
Finding the right tools to make collaboration effective was the best experience I had with coding.
And you learn so much from each other.
Finding an interesting coding community might help, same as this community helps to create music.

3 Likes

My advice is to start with creative coding languages like p5js/Processing. You can use libraries such as Tone.js for synth sounds and start by making fun little generative graphics / interactive art / mini games / sequencers to get into the mindset of writing code. There are a lot of resources online for this, such as Coding Train (Dan Shiffman) on youtube, who is one of the best teachers I’ve seen simply because of how goofy and lighthearted he is about teaching code.

Another thing you could try is getting a beginner Arduino kit and going through some basic tutorials. Translating some of the creative coding concepts to Arduino can be more effective since it’s being applied to physical electronics, which could be more engaging. It also involves learning electronics though, which is sometimes a bit like black magic :sweat_smile:

After that it becomes a bit less daunting to move on to lower level programming languages… though tbh I’m still really out of my depth when it comes to JUCE.

8 Likes

I can relate to most of the feedback allready in this (and other) threads.

But one thing is also very important. You need to like coding as such: the puzzling, the logic/maths involved, the concepts behind it all, the quirks of the languages etc.

If so, than go for it and be happy with all the bugs and struggles you have to go through. But if coding only frustrates you because your endgoal (a musical interesting piece of software/hardware) is so far away. Then think twice.

(for the record: i’m a software developer)

9 Likes

Yes indeed, it can sometimes feel like you’re in an Escape Game :wink:

5 Likes

You really hit the nail on the head there. That’s 100% the kind of advice I always try to give people who want to get into programming but I’ve never thought to put it that way.

2 Likes

The satisfaction of getting something working correctly is huge too.

I have only written about 30-40 programs over the years that worked exactly as I wanted, but all the others were valuable learning experiences.

4 Likes

Indead!

1 Like

Learning.

You can’t learn everything all at once.

It’s best when it comes in bite size pieces, that add to the other things that you know, that goes toward a larger goal, and that give you rewards and accomplishments along the way.

Doing.

Once you have learned a certain set of things, you can attack large problems, understanding the basic pieces enough that you can then solve a larger problem by putting smaller things together.

And so on… The two go together.

So find the next thing you can get your arms around, and find tools to learn that allow you to accomplish that. That can be a challenge to do no matter how far you advance.

=-=-=-=-=

So find things that will challenge you, while still being doable. In your case it is things you can do that are musically interesting, with a plus to things that you can use for multiple challenges for a long time.

I’ll throw something out, that may fit for you, or may not.

The Blokas Midihub, has a smallish set of somewhat quirky, but entirely appropriate “instructions”, that allow you to attack and solve whole ranges of MIDI processing problems. Put it between your controllers and your synths, and have fun doing things with it.

The Midihub is not enormously expensive, and could have long term uses and payback.

It has a particular approach to problem solving, that fits with stream processing problems. Those are not too dissimilar to audio stream processing, that can be done with other tools, like Max, or Pure Data, and fit with much audio processing in general. MIDI stream processing is usually easier than audio stream processing.

There are many other possibilities. I’ll stop there, though …

Others may have other problem/solution method suggestions.

10 Likes

I like @Jukka’s idea of working with a configuration/scripting language for a particular device, rather than a general-purpose programming language or an API embedded in one. I don’t know too much about such languages, though, as I’ve tended to avoid such devices in favour of knobs, cables, and jacks. Perhaps others have suggestions along these lines.

3 Likes

I can also suggest FAUST DSP (https://faust.grame.fr/) as audio specific programming language which is IMO much easier to understand than learning C++ as a non developer.

The cool thing about FAUST is that it can generate different things, from mobile apps to web audio code to highly optimized C++ DSP code which you then can use for a more advanced JUCE project or even use in a hardware project. As I saw FAUST DSP in a Elektron job description for an Audio Software Developer job I guess this is a real thing also for commercial audio development to some extend.

The whole development of FAUST and the testing can be done in the WebIDE.

I can highly recommend the free Kadanze Course from Stanford University which is lectured by the creator of FAUST. Real-Time Audio Signal Processing in Faust - an Online Creative Coding Course at Kadenze

That course explains the programming very good with lots of examples by coding synths and effects.

I also know Tone.js which I also love to code with, but I am a web software developer so in my opinion FAUST DSP will get you quicker results with more flexibility in what you do whith your code afterwards compared to “limiting” yourself in the JavaScript/Web Audio environment.

With FAUST you can even generate Web Audio which you then can combine with Tone.js to have Synths and Sequencers in the Browser.

In the end it is a matter of what language/approach clicks for you especially if it is a hobby so it should be fun.

4 Likes

I’ve not done this, but isn’t lua scripting on norns a good thing to try ? (It IS lua, isn’t it ?). Benefits

  • It’s (arguably) real programming
  • it has a direct connection to music making
1 Like

It is worth noting that “math” means different things to different people. Most of the time “math” suggests mind-numbing arithmetic where any false step will send you back to square one.

The math that underlies computer programming derives from logic. Many people who consider themselves bad at math find programming to be fun and easy. Higher math has more in common with language and music than arithmetic, so don’t let unpleasant arithmetic block you from the joy and beauty of the numerous other branches of math.

5 Likes

You could dip your toe into max/maxforlive if you use Ableton Live. The learning curve is steep but you can get a lot of things done quickly and it’s always kinda related to music.
It also supports JavaScript and whatnot if you need more and then there’s also RNBO and CodeBox. You could spend a lifetime with it :slight_smile:

4 Likes