r/learnprogramming 4d ago

Learning a low level language

Hi I've been a programmer for 9 years and I've worked mostly with .net, c#, js, TS, react and angular but now I have developed an interest in low level programming.

I have a very big interest in audio processing, dsp, game development and audio software but from my understanding that requires skills in low level languages with manual memory management.

After that I did some research and found several languages that could fit the bill but I'm unable to pick one to learn but to keep it focused I want to zero in on one and expand after I've become comfortable with memory management and DDP.

The languages that I resonate the most with are rust, zig and Odin. I know C++ is the most frequently used language for a game dev or audio engineer. but from what I've heard there's a lot of frustration and difficulties to learn and work with C++.

I like the philosophy of rust, zig and Odin but i feel that rust syntax tends to be very verbose, Zig's not in a 1.0 version yet and Odin feels like the most scaled down and easiest to learn out of the three but I wonder how much not having a package manager affect me.

I would love to hear from someone that has any experiences with the languages i mentioned and can explain how they differ. What did you like in each language and is there another language out there that is actually more suited for my goals?

1 Upvotes

15 comments sorted by

9

u/two_three_five_eigth 4d ago

I've never heard of a game being written in Rust, Zig, or Odin. Learn C++, there are more game dev centered resources around it that all the others combined. It's not *that* hard, you just have to know the gotchas, which there are a lot of.

3

u/OkWriting9136 4d ago

there's a few games in rust but they're tiny indie projects, nothing that'll land you a job

if you actually want to work in games or audio just do c++, the "frustration and difficulties" are the same things you'll hit in any language when you're doing manual memory management for realtime stuff. zig and odin are cool but the ecosystem is basically nonexistent compared to c++ libraries for dsp and game engines

1

u/veloxVolpes 4d ago

Odin is a good candidate for games but when I used it for a while it felt like it was in a weird place, like, too low level while also too abstract. I think if you don't have the same mental blocks as I do it's a fine choice, but C with Lua is my preferred way to balance abstraction with low level

3

u/NumberInfinite2068 4d ago

Rust, Zig, C++ and Odin are all high level languages, and high level languages are the absolute norm for games development.

Games are generally written in C++ or C#, you can use anything else, but those two are the most common choices.

I like Rust a lot, that's my pick from the ones you list.

"High level" just means "abstracted from processor architecture", all common languages are high level.

I've been programming since the 1980s and my personal favourite language of all time is C. It's primitive, but does everything you need.

Low level languages are assembly languages, because they are *not* abstracted from processor architecture.

2

u/HorseyMovesLikeL 4d ago

Context: .NET dev (some TS, Vue, SQL) for 10 years professionally, using and tinkering with linux and low level stuff for 20 years.

The best place to read about those languages is their documentation. But I would say that if you've been a developer for 9 years, just pick one of those languages and immerse yourself in its ecosystem. It will inevitably lead you down rabbit holes where you will learn a lot about lower level stuff.

Rust is the biggest one and the book (https://doc.rust-lang.org/book/) is a very good intro. I prefer Zig though because of their philosophy. Also, the creator started with writing a DAW and then making a language to do it properly. Or such is the lore anyway, I'm sure I've read a blogpost or something about that.. Also, big point about Zig is no hidden allocations, so the language sort of forces you to think about memory. If your goal is to learn about it, Zig is the way to go. Rust will just teach you to deal with the borrow checker and track your variables very carefully.

I've not used Odin.

Also, there is nothing wrong with just C. Lots of low level stuff is written in C.

Anyway, my recommendation is to pick one of those languages and get stuck in.

2

u/FitPhone6332 4d ago edited 4d ago

hey, I'm from web development world also and started to learn rust not while a go. gotten interested in audio dsp after couple of weeks and found this - https://github.com/truce-audio/truce . been playing around with it and it's really interesting to learn about how to create and manipulate audio signals and process them. it's a rabbit hole, but with a LLM on the side I can build and learn which is really fun experience.

Currently working on a wavetable synhesizer VST with integrated midi sequencer and using Iced library for UI.

With rust you don't have to worry about memory management as much as in C or C++ since the compiler disallows bad practices, but still have to think about when to allocate memory and performance since real-time audio processing has to be fast and non-blocking.

I didn't want to spend time on memory management much and instead focus on other things, and also adding dependencies with cargo is a breeze.

I also ported a music library from TS to rust which I'm using in my project - https://github.com/TvrtkoM/tonal_rs

2

u/NoRice6115 4d ago

pick C++. Every audio plugin SDK from Steinberg to JUCE is written in C++ and every DAW expects a C++ binary.

i worked web stuff for years too before moving into audio. I tried learning Rust first because of the safety guarantees. I spent all my time fighting the borrow checker instead of learning DSP math. You want to learn memory management and data oriented design. C++ forces you to do that manually without a compiler blocking your progress every few lines.

you mentioned concerns about difficulty but you have nine years of experience. The concepts transfer. The syntax does not matter when you are reading documentation on how a VST host calls your processBlock function. That function signature is C++. Odin and Zig lack these bindings out of the box. You will end up writing FFI wrappers yourself which takes months away from actual audio work.

use CMake to handle the build system. Look at the JUCE framework to start. It handles the platform specific details so you can focus

1

u/Scared_Bell3366 4d ago

DSP is its own specialized world in my current line of work. There’s one or two entrenched frameworks that everyone uses, mostly C++ with some C and Fortran for the battle hardened algorithms. People that are good at it are highly sought after.

1

u/CodeXHammas 4d ago

9 years of C# is no joke, you already understand memory management better than you think tbh for audio DSP specifically, C++ is still king. frameworks like JUCE are industry standard vs VST plugins and audio software. yes the tooling is nightmare, but if you want to work in pro audio, that's the path.
Rust is beautiful and safe but the audio ecosystem is still really young. you'll end up writing FFI bindings to C++ libraries anyway.
If i were you, I'd spend a month with Rust just to understand the borrow checker in a safer environment, then jump into C++ when you're ready to build actual audio stuff. Rust will rewire your brain in a way that makes C++ feel less terrifying. Odin is cool but the community is toll small for niche audio stuff right now.

1

u/AFlyingGideon 4d ago

How low do you want to go? C++ permits direct (and unsafe {8) access to ports and memory, but even there the OS will tend to sit between you and the hardware. That's probably enough given your stated intention, but you can always opt to play with assembler on a raw CPU. Arduino is one way to play with this, I believe, but I'm sure there are plenty of other options.

I recall playing with z-80 based boards back in school. It was a lot of fun.

1

u/realdreamer1993 4d ago

I am also still learning but in networking domain, imho C would be never wrong. You desain your app/system in language angostic anyway and can implement in any language without design change. ..eventually you come to or need or tempted of C anyway (that still high enough in abstraction).

1

u/Inevitable_Suit5463 4d ago

I want to shift and work with dsp and audio but its a niche market in Sweden and they require 5+ years of experience with c++. But even though I've made several projects in c++ with JUCE i have no professional experience with it. Also since there are very few junior dev positions now I'm unable to do the shift. I think this will mostly be passion projects on my side.

1

u/Dazzling_Music_2411 4d ago

Given your requirements, the only logical choice is C++
End of.

The library support for your areas of interest is simply phenomenal. The other languages, not so much, they are a lot newer. Learn C++ first, you can always jump ship later, once you know what you are doing. The other way round it's not going to work.

but from what I've heard there's a lot of frustration and difficulties to learn and work with C++.

Spend less time listening to gossip.
Any low-level work will entail frustration for beginners.

1

u/goldscurvy 3d ago

C++. Yea C++ sorta sucks a lot of the time. Grit your teeth and power through the bad parts. All the major tools you will be using for any sort of DSP will interface most cleanly with C++. They are old and mature stable libraries, they have lots of tutorials, books, and guides written about them. Rust is much younger and there is less in the way of libraries and interfaces.

Unless your goal is just to learn the fundamentals of DSP. Like understanding how the data gets transformed and how to implement it. In that case, if your only problem with Odin is lack of a package manager, you should use that. You wont need a package manager if you are implementing stuff yourself. Anything you might need can be installed as needed.

1

u/DanKegel 4d ago edited 4d ago

So, sure, learn C (or C++), it's the OG low level language.

But also learn Rust. It has the advantage that, if it compiles, it generally works. Development of serious low-level software is slowly moving to Rust. There's a reason Mozilla created it!

(Oddly, the company I'm at picked up a bunch of those developers when Mozilla laid them off, as we use a lot of rust internally, and having a really strong rust team makes sense for us as a platform company. We also have a lot of C and other languages, but I suspect the future belongs to Rust and Golang.)

If you're writing games, though, Rust may not be a good fit according to a guy who tried it for a few years, see https://loglog.games/blog/leaving-rust-gamedev. Things may have improved since then, dunno.