I saw a recent notation software product that seemed to offer a novel and concise way to code your music notation. I can't find it so I'm reaching out for your help.
There is LilyPond which does what you are looking for. It was first released on 1996, but it still gets updates.
LilyPond is a computer program and file format for music engraving. One of LilyPond's major goals is to produce scores that are engraved with traditional layout rules, reflecting the era when scores were engraved by hand.
LilyPond is cross-platform, and is available for several common operating systems; released under the terms of the GNU General Public License, LilyPond is free software.
On the Wiki page, there is a nice example with some code and the outcome, but it's too big to post here.
We have had many questions tagged lilypond in this site, so you can look through these to get a general idea.
There is also ABC Notation, which is text-based notation (not exactly coding), like:
X:1 T:Speed the Plough M:4/4 C:Trad. K:G |:GABc dedB|dedB dedB|c2ec B2dB|c2A2 A2BA| GABc dedB|dedB dedB|c2ec B2dB|A2F2 G4:| |:g2gf gdBd|g2f2 e2d2|c2ec B2dB|c2A2 A2df| g2gf g2Bd|g2f2 e2d2|c2ec B2dB|A2F2 G4:|
and gets you the result:
I have not personally used any of them yet, but there are multiple packages for typesetting music with LaTeX.
As mentioned previously, LilyPond might meet your specifications. For one thing, its input is text form, something which some people equate with "programming" (for example, the answer proposing MusicXML does not make any sense without that assumption). For another, one of its implementation languages is Scheme (more exactly, Guile), and Scheme is immediately accessible in its source files as an extension language useful for algorithmic programming. One example of mixing music and programming is in this unrelated answer to a StackExchange question.
Sorry for not linking to LilyPond and Guile, but my reputation allows only for 2 links, so I had to be selective.
Note, however, that PostScript is something of an older file format, and you may need to download an extra piece of software to view the files and/or convert them to a different format. On Mac OS, the built-in "Preview" application will do it, but I'm not sure what the equivalent software would be on a Windows or Linux system.
MusicXML, in any text editor, is my favorite way to "code" music. A tutorial can be found here. When your code is complete, you can import it into almost any music editing software such as MuseScore, Sibelius, or Noteflight.
Trinket allows you to write music with code. It's rather small at the moment but it works well for smaller projects. I haven't noticed any development though in the last few months so I'm not sure if they mean to continue it.