Show HN: A small, simple music theory library in C99
1–10 of 19 posts
Re: Show HN: A small, simple music theory library in C99
#2Given that it is 2026, what are some of the thoughts that go into choosing C99 vs C23, which I presume has more quality-of-life features?
Re: Show HN: A small, simple music theory library in C99
#3As someone who only has used C in conjunction with Rust... Given that it is 2026, what are some of the thoughts that go into choosing C99 vs C23, which I presume has more quality-of-life features?
Re: Show HN: A small, simple music theory library in C99
#4As someone who only has used C in conjunction with Rust... Given that it is 2026, what are some of the thoughts that go into choosing C99 vs C23, which I presume has more quality-of-life features?
Re: Show HN: A small, simple music theory library in C99
#5As someone who only has used C in conjunction with Rust... Given that it is 2026, what are some of the thoughts that go into choosing C99 vs C23, which I presume has more quality-of-life features?
I still write nearly ANSI compliant C for simple embedded things. Because somebody might need to figure out how to rebuild it in twenty years, and making that person's life harder for some syntactic sugar isn't worth it.
Even C99 can be a problem: for example, C99 designated initializers are not supported in C++. If your header needs to support C++ you can't use them (C++ forces you to initialize every field in the structure in order if you do it that way).
Re: Show HN: A small, simple music theory library in C99
#6https://github.com/thelowsunoverthemoon/mahler.c/blob/4ebfe8...
Should that type have been mah_acci instead of int? mah_acci doesn't seem to be used anywhere.
Also, have you considered using (edit) designated initializer syntax for some of the function calls that take in structs as arguments?
https://cppreference.com/w/c/language/struct_initialization....
struct mah_scale scale = mah_get_scale(
(struct mah_note) {
.tone=MAH_C,
.acci=MAH_NATURAL,
.pitch=4
},
&MAH_BLUES_SCALE, notes,
MAH_ASCEND,
NULL
);Re: Show HN: A small, simple music theory library in C99
#7Nitpicking: https://github.com/thelowsunoverthemoon/mahler.c/blob/4ebfe8... Should that type have been mah_acci instead of int? mah_acci doesn't seem to be used anywhere. Also, have you considered using (edit) designated initializer syntax for some of the function calls that take in structs as arguments? https://cppreference.com/w/c/language/struct_initialization.... struct mah_scale scale = mah_get_scale( (struct ma…
As for second, that's a good point! Would definitely make readability better, thanks.
Re: Show HN: A small, simple music theory library in C99
#8Re: Show HN: A small, simple music theory library in C99
#9What is the purpose of this and how would I use it (as someone who actually knows a lot about music theory and C programming)?
- Music theory education tools - Music generation (and the outputs could be transformed to MIDI format for example) - Piano chord finder
and similar.
Re: Show HN: A small, simple music theory library in C99
#10What is the purpose of this and how would I use it (as someone who actually knows a lot about music theory and C programming)?
Well, this library provides the core functions for classical, Western music theory (scales, keys, intervals, etc.). So any ideas that needs to understand or generate these structures could use them. Some examples off the top of my head: - Music theory education tools - Music generation (and the outputs could be transformed to MIDI format for example) - Piano chord finder and similar.
Whats the target audience? A good musician knows the scales by heart (and also how they sound/feel) and for the others it's unclear to me what they would do with music theory they don't really understand.