Learning to code, but I ain't got wings

So as part of my job, I’m teaching myself basic C++, working through Learn the Hard Way and doing some online exercises. Ultimate goal is to be able to read + review moreso that code complicated software from scratch.

So anyway, I learn best through applying and thought hacking around in some already written open source vcv modules might be an interesting place to gone my chops.

I am interested in trying to put the Stages alt firmware into the Audible Instruments module. The firmware and module are both open source. I know most of the functionality exists in other modules, but some, like me, might want hands on experience with it before buying.

So does this seem like a doable thing? Not looking for someone to show me how to do it, more curious if any experienced devs see any “there’s no way that would work because x,y,z” that I am not aware of…

1 Like

The most fun way to learn coding is to pick and poke at code that you are interested in and then start a project that you want to accomplish. I also find that reading books or articles by the author of the language is far superior to reading just about anybody else’s writings. This was true for me with C, Python, and then the little C++ that I learned, my favorite introduction texts were written by Bjarne Stroustrup. The language authors seem to see the trees for the forests and you can get a better picture for what they care about in the language and the paradigm just seems a little clearer. K&R C was like this for me, and then some articles by Guido Van Rossum for Python that made a lot more sense and were more inspiring for me than some big fiddly tome.

I’d caution that even something like adding alternate firmware to an already existing module is quite a big goal. I’ve been hobby coding for a few years now and I find parts of the MI/AI codebase confusing - it’s been written by a very competent programmer who knows a lot of stuff that you as a beginner won’t understand.

I say this not to discourage of course, just to encourage setting several goals, with some farther in the future and others more immediate. If you try and work on a complex project right away it’s very likely that you’ll be frustrated out of the enthusiasm you’ve got right now.

I can strongly recommend starting out programming some more basic modules first to get your head around interacting with the Rack API and the basics of real-time programs. Building basic stuff like clock utilities and sequencers is how I eased my self into it.

2 Likes

Thanks for the honest advice, I think you are probably wise. I’ll start simple with some clock fun.

1 Like

I think it would be possible. The main beginner problem with C++ is pointers or indexing [] arrays and not having bounds testing. So an array of size 10 can be indexed by x and if the compiler can’t know easily that x is between 0 and 9, it will make code anyway, and some crash will happen, while not really leving you with much idea about what happened (or made the operating system complain, and so made it not happen).

That’s why you need to run under address sanitizer. It will find these array bounds issues easily, and pinpoint exactly what happened.

It might make things easier. It certainly would be easier than the following:

  1. using Java and IBM’s java to C compiler with some shim code.
  2. using PASCAL and exporting a C library with some shim code.
  3. using gdb
  4. having a feel for what such errors do and fixing it when the three platforms each have their own memory allocation peculiarities.

Of course you could go really weird with a type generic T index<T>(T* base, int index, int maxIndex); function if you wanted. I’m not sure if T index<T[<M>]>(T[<M>] base, M index); is in C++ yet!

If they removed naked pointer arithmetic, the processor TLB (translation look-aside buffer in the MMU) could skip virtual to real translation stalls under a secure language construct, but that is why Java can be faster, given the problems of it always gets compiled when run.

ok, but in the real world address sanitizer is an amazingly good program, and a very practical way to find memory issues.

I agree. ElectricFence was also something I looked into. My C is excellent, my C++ is something that happened later after I learned much text book lingo post Ada, APL/J, and I still think Forth could be good, although linking it has never really been a DSP tool developer goal. Gigabytes came and made compact threaded code sort of obsolete by competition of not so compact but more generable code.

Adding a threading cache on the out of order fetch unit was something I’ve argued on comp.arch as smaller code reduces instruction cache volume on the Harvard architecture, leaving more data fetch for less memory stalls.

Also I said on the RaspberryPi forum (educational) that a BWT transform of the compiled code (it makes the search more time linear) could be easily factored into small subroutines (common instruction sequences), and code reduced for size to try for some of this effect even from monolith code. I’m not sure the processors yet do some caching priority of future on stack instruction sequences.

The Mill processor was excellent, based on an initial idea of shrinking program code by making the target register implicit. What started the conversation. It wasn’t Intel code level compatible though, so a assembler to assembler code translator seemed a little too far. Less heat in processors by double tracking the CR time constant into double wiring. It never changes the logic of processor design, but the layout uses more metal layers but consumes less power. I said I didn’t mind its use.

In the galactic terms of billions and a hotter faster centre? Module Q might seem a little bit of a joke, but it’s not so in some sense. uncertain-geo.pdf - Google Drive kind of says it all. Mistakes but not as silly as it might first appear.

A valuable lesson right here: C++ conversations will speed towards arcane discourse on memory management and generic types when you’re still trying to figure out what a function is

乁| ・ :wavy_dash: ・ |ㄏ

2 Likes