Hugo Hacker News

Alda – Text-Based Programming Language for Music Composition

qrv3w 2021-08-16 16:12:55 +0000 UTC [ - ]

I love these text-based languages for music composition. Its something that is approaching a gap in music composition in real-life vs via computer. In real-life you can tell your bandmates to "just play a I V IV in C" and they get it. But we are still not quite at a place where we can tell a computer that exact phrase and get something useful. I love how close these text-based languages are getting though!

I've actually made my own musical language too - called miti [1], which is just one of many others including textbeat [2], foxdot [3], sonic-pi [4], chuck [5], and melrose [6]. Each has their own goals and capabilities.

- [1] https://github.com/schollz/miti

- [2] https://github.com/flipcoder/textbeat

- [3] https://foxdot.org/

- [4] https://sonic-pi.net/

- [5] https://chuck.cs.princeton.edu/

- [6] https://github.com/emicklei/melrose

smlacy 2021-08-16 16:46:46 +0000 UTC [ - ]

No list of text-based music systems is complete without the granddaddy of them all: [LilyPond](http://lilypond.org/)

Alda seems greatly inspired by the syntax of LilyPond, and in fact, I actually think the musical rendering is done via LilyPond. I'm surprised the docs don't seem to mention this heritage at all.

int_19h 2021-08-16 18:28:50 +0000 UTC [ - ]

I would argue that the granddaddy of them all is the PLAY statement in BASIC:

https://hwiegman.home.xs4all.nl/gw-man/PLAY.html

soylentcola 2021-08-16 19:26:38 +0000 UTC [ - ]

I had a lot of fun with this on my Commodore. The version of BASIC on the C=128 was surprisingly versatile. I was just a kid in elementary school, but messing with ENVELOPE and PLAY taught me the basics of attack/decay/sustain/release and other synth concepts. Very cool stuff to discover in the giant manual that came with the thing!

YossarianFrPrez 2021-08-16 18:02:03 +0000 UTC [ - ]

Indeed. And if you use Lilypond, check out Frescobaldi -- it makes typesetting and editing scores much easier, via things like syntax-staff co-highlighting.

https://www.frescobaldi.org/

sbuttgereit 2021-08-16 20:07:09 +0000 UTC [ - ]

I dunno... what about csound?

https://csound.com/

jim-jim-jim 2021-08-16 22:53:04 +0000 UTC [ - ]

Which itself is a child of an even grander daddy: https://en.wikipedia.org/wiki/MUSIC-N

You can hear some recordings presumably made with these programs on this release: https://www.discogs.com/Various-Music-From-Mathematics/relea...

Some of it is gimmicky, some still kinda rocks.

sbuttgereit 2021-08-16 23:06:36 +0000 UTC [ - ]

Thanks for the tip. I hadn't realized that csound came from a longer lineage of work.

jeofken 2021-08-16 17:42:23 +0000 UTC [ - ]

I struggle to get LilyPond running on MacOS - is it easier on Linux? It would be great for us but my mates all use Windows or MacOS, so we resort to graphical notation programs, where version control and portability is hard

klyrs 2021-08-16 19:45:26 +0000 UTC [ - ]

It's extremely easy to get it running on Linux. Many distributions have a lilypond package, which just works out of the box.

The problem I've always had with the language is that it's quite arcane and if you want to do anything weird (like, a tie to nowhere) you're either at the mercy of somebody else having solved the problem first, or failing that, a huge learning curve. It's a lot like latex in that way. That said, if you just need to do simple stuff, the language almost magically gets out of your way.

Hackbraten 2021-08-16 20:38:35 +0000 UTC [ - ]

Have you checked out the unofficial Homebrew tap `nwhetsell/lilypond` [1]?

It has a `lilypond` formula that has worked fine for me. Beware though that it installs some kind of TeX repository sized 7 GB.

[1]: https://github.com/nwhetsell/homebrew-lilypond

colomon 2021-08-17 07:54:47 +0000 UTC [ - ]

I've never noticed any difficulty getting LilyPond running on MacOS or Linux? I use it regularly on MacOS, and keep it installed on Linux for special occasions.

jeofken 2021-08-17 11:02:43 +0000 UTC [ - ]

How did you install it on MacOS?

colomon 2021-08-17 14:26:52 +0000 UTC [ - ]

Oh. I'm still using MacOS 10.14, so there's an official up-to-date version to download from the Lilypond site, and I think I'm using a two year old version of that. (I am very slow to update the OS on my main work machine, usually just ride out the major version it came with until I update to a new machine; and since I was working on a book in Lilypond, I wasn't in a hurry to update it, either.)

Sorry I can't be of more help immediately!

diskzero 2021-08-16 17:12:57 +0000 UTC [ - ]

My current favorite is OpusModus https://www.opusmodus.com. It is a commercial app, which will dissapoint some, but is worth the price to me for the level of quality and capabilities. As an added bonus, it is written in Lisp, can be extended using Lisp and uses a S-expression DSL for composition. The development environment has a REPL and a variety of interfaces for composing and exploring music.

vosper 2021-08-16 17:51:25 +0000 UTC [ - ]

> My current favorite is OpusModus https://www.opusmodus.com. It is a commercial app, which will dissapoint some, but is worth the price to me for the level of quality and capabilities.

Personally I love seeing this kind of niche (I assume?) commercial software. It's great that people can make a living working on this kind of thing.

diskzero 2021-08-16 21:14:10 +0000 UTC [ - ]

I hope they are managing to make a living. I have created music software over the decades, going from making a good living during the shrinkwrap software era, to not being able to support full-time development of a mobile music app. I am impressed that Finale, Sibelius and Dorico can find enough market share to fund development and be competitive.

bradrn 2021-08-17 01:34:42 +0000 UTC [ - ]

For a musical Lisp, personally I prefer extempore: https://github.com/digego/extempore

diskzero 2021-08-17 02:58:28 +0000 UTC [ - ]

Extempore is impressive for sure. They wrote a custom scheme interpreter and a REPL for VSCode. More info here: https://extemporelang.github.io/docs/overview/quickstart/

bodge5000 2021-08-16 21:04:45 +0000 UTC [ - ]

Hate to sound like a broken record here, but can opus modus handle its own sound synthesis or is it purely compositional?

Not that theres anything wrong with that, but if $400 is the price for ending my suffering, I'll pay out in a heartbeat ;)

diskzero 2021-08-16 22:19:19 +0000 UTC [ - ]

I focus on the compositional aspects of the program, but I do like to be able to audition what I am making! I can use software and hardware synthesizers to do this, but it sounds like you want something with more fundamental building blocks. OpusModus is able to integrate with Common Lisp Music (CLM) https://ccrma.stanford.edu/software/snd/snd/clm.html. Info on integration with OpusModus here: https://opusmodus.com/forums/tutorials/clm-examples/clm-inst... CLM will give you osciallators, generators, filters and more. I am not a CLM expert, but it seems to address some of what you are looking for.

bodge5000 2021-08-17 03:23:03 +0000 UTC [ - ]

Yeh that seems to be what I'm looking for, will look into this more, cheers!

bodge5000 2021-08-16 20:56:10 +0000 UTC [ - ]

Fantastic work on miti! Looks like it could be a game changer for modular systems especially, but in general just having a single "brain" control all your synths in a way thats as readable as this would be great.

Out of interest, are you aware of any language, framework or environment that includes sound synthesis as well, essentially making it an all-in-one?

I do wonder if I'm asking too much, since Supercollider already exists but I'm not much a fan of using it because of how verbose it is and I'm a little bit upset it uses its own language (so I couldn't import more generic modules), but its worth asking anyway. My current plan is to use a non-livecoding module for an existing language, since the ability to change on the fly isn't important to me

qrv3w 2021-08-17 17:35:02 +0000 UTC [ - ]

Thanks!

I think SuperCollider is the best out there. It's syntax is weird yeah but you can use OSC to talk to anything else (this could easily be added to miti as well). Really I don't think a really good all-in-one exists there are lots of things that do all, but none do all as well as something that just does one thing.

bodge5000 2021-08-18 07:18:52 +0000 UTC [ - ]

Oh sorry, I didn't mean all-in-one as in it can do everything, just that it can handle synthesis and composition. I guess "batteries included" might be a better term, what I really meant was something that needs no external sources for either sound or sequencing, you can make a track from start to end without needing to use something else.

Of course, supercollider does indeed fit this role, but as I've said I do have problems with it. Currently I'm looking at using a generic language, with some synthesis and composition modules. Suprisingly, game frameworks (e.g. Love2D) are looking promising for this, so that could be good, if a little bit overkill.

abc789654567 2021-08-17 10:48:26 +0000 UTC [ - ]

> "just play a I V IV in C" and they get it. But we are still not quite at a place where we can tell a computer that exact phrase and get something useful.

We are at this place since at least 3 decades ago. How come you never heard about Band in a box? [0]

> I love how close these text-based languages are getting though!

Comparing to what BIAB can do now after 3 decades of development all these text-based languages are sooooo amateurish and ridiculous. They are not even reinventing the wheel. I'd say they're reinventing the circle.

- [0] https://en.wikipedia.org/wiki/Band-in-a-Box

flipcoder 2021-08-19 03:50:57 +0000 UTC [ - ]

Thanks for linking to textbeat! :)

throwaway675309 2021-08-17 00:30:00 +0000 UTC [ - ]

In real-life you can tell your bandmates to "just play a I V IV in C" and they get it. But we are still not quite at a place where we can tell a computer that exact phrase and get something useful....

You can definitely do this exact thing in Band in a Box, simple as typing in the chord progression as a lead sheet.

kzrdude 2021-08-16 19:29:20 +0000 UTC [ - ]

What do you think of hookpad? It's something along those lines, too, right? Even though it's not text based, but it's easy to get a chord progression playing, which I really like.

th0ma5 2021-08-16 21:32:54 +0000 UTC [ - ]

dexterhaslem 2021-08-16 16:16:55 +0000 UTC [ - ]

what about trackers?

bodge5000 2021-08-16 21:06:58 +0000 UTC [ - ]

Trackers are a very different beast, however for my sake I've found them a good intermediary whilst your looking for the live coding language that suits you.

I use Renoise (not free, but very cheap imo and very powerful), and have a sample pack called AWKW (I think, its something like that) which is just a load of single cycle waveforms, and I use that to build rudimentary subtractive synths.

yardshop 2021-08-17 01:44:15 +0000 UTC [ - ]

I think you must mean AKWF, Adventure Kid Wave Forms:

https://www.adventurekid.se/akrt/waveforms/adventure-kid-wav...

4000+ single-cycle wave files of all sorts of sounds from various synths and instruments and such. Lots of great noises in there!

bodge5000 2021-08-17 03:21:45 +0000 UTC [ - ]

Bingo, that's it

I've been thinking about going even simpler, and just building all my synths out of Sine, Triangle, Square and Sawtooth, but for now AKWF is working a treat

kleer001 2021-08-16 16:20:46 +0000 UTC [ - ]

What are you asking? They're a different beast.

thebricksta 2021-08-16 15:37:47 +0000 UTC [ - ]

Sorry to be a downer here, but can someone explain to me what the appeal of these projects are? In the past year or so I've seen a number of text-based music notation projects hit the front page of Hacker News and don't really understand the purpose they are trying to achieve.

If I want to transport music notation between software programs, I have MIDI for that, which does a good job of capturing all elements of a performance (keys, timing, velocity, pedals, aftertouch, etc.) These types of notation formats almost always fail to achieve MIDIs precision across all the aspects of a performance.

If I want to compose music, I need a format that makes it easy to visualize and manipulate notes in context of the other notes playing across all instruments. DAW piano rolls do a fantastic job of overlaying note information, and traditional combined scores do the same too. Again, text notation usually falls flat here - for example, if you had a large ensemble, and wanted to know which chord was being played on the 2nd beat of the 5th measure, how easily can do you do that? How do you determine if it's an open spacing or closed spacing? How do you determine the root without walking back through all the octave shifts?

bodge5000 2021-08-16 15:49:45 +0000 UTC [ - ]

Not the author, but a big fan of these kind of projects, which fall into a much larger community known as "Live Coding" (though it also applies to other creative persuits as well, music is probably the most common).

If the piano roll works for you, chances are these kinds of things won't. For me personally, the piano roll has never worked. Whilst I'm still trying to find my place within live coding, I've found trackers (especially Renoise) to be the best for me for the time being.

Where these projects really excel though is in algorithmic composition and generative music (modular synthesis is also quite well known for this), so rather than telling the computer exactly what to play and when, you define the rules and tweak them to change the results.

Of course they can also be used for a more traditional style of music as well, its simply another form of writing music for computers. Some people (most people) find the piano roll works for them, others prefer trackers and sequencers, others prefer code. Its purely preference at that point

jcpst 2021-08-16 18:21:25 +0000 UTC [ - ]

I can explain why I use tooling like this. I use Lilypond though, not Alda.

For me, it is very much just a markup for music notation that can be tracked in version control. Just like how one would write markdown and then generate html pages, I write Lilypond to generate scores.

Example workflow- I write a song, and use Ableton to capture it. I’m performing with real instruments, and creating arrangements without writing anything down.

Now I want to perform it with other musicians. I have a few options.

I can notate what I created by hand. I can use a proprietary graphical notation tool, which are expensive and generally have sub-par UX.

Or I can use a text-based system like Lilypond, and generate it. I can create reusable blocks, code snippets, look at a diff when I make changes, print the whole arrangement, print just the scores for individual instruments, adjust arrangements as easy as you adjust prose in a text editor.

And also, not have to think much about the presentation layer. Mature tools in this category like Lilypond output great looking scores.

munificent 2021-08-16 16:46:08 +0000 UTC [ - ]

> Sorry to be a downer here, but can someone explain to me what the appeal of these projects are?

I think for some people, the appeal is immediately obvious, and for others it isn't. If the appeal isn't there for you, that's OK. It just means it's probably not the right tool for you.

One of the things I find most fascinating about music-making is how varied and personal the workflows are, and how deeply those workflows affect the resulting music.

You aren't being a "downer" by not liking the sound of a tuba. It's just not your jam. But it certainly is for others and that's OK too.

swiley 2021-08-16 19:55:48 +0000 UTC [ - ]

Many of us are very fast with text editors and very expressive with algorithms but struggle with DAW interfaces. Text is just flexible enough to work as a replacement and the already existing tools to manipulate and manage it make it very attractive. Many of the things you pointed out could be handled with various editor macros or possibly even regex. In the case of programming languages, the high level information could be directly encoded by the author of the piece and the low level information could be generated dynamically.

It's a very different perspective on computer UI design and one I personally prefer, although I get why it's not for everyone.

porkloin 2021-08-16 16:15:25 +0000 UTC [ - ]

> If I want to transport music notation between software programs, I have MIDI for that, which does a good job of capturing all elements of a performance (keys, timing, velocity, pedals, aftertouch, etc.) These types of notation formats almost always fail to achieve MIDIs precision across all the aspects of a performance.

Well put. A lot of these feel like the wrong tool for the job, and I have a really hard time understanding why you'd want to track pitch data in a format like this when, as you say, DAWs exist and midi tracks can be moved around between them.

The only time these types of projects make more sense to me is when they present opportunities for discoverability or non-linear sequencing that can result in new or interesting ideas. For example, the Orca Sequencer used in this demo vide](https://www.youtube.com/watch?v=Pe8wE0sx31Q) is an example of a tool that folks use as a synth-agnostic sequencer that takes advantage of a non-linear format to create music that you might not in a DAW/piano roll. Or at the very least, makes you take a wholly different route to get there.

Projects like Alda, however, make less sense to me since they are squarely pointed at linear-workflow music tracking, which is such a saturated space that it's hard to come in with a new format that doesn't just feel like a more painful way to do what a DAW can let you do.

randomswede 2021-08-17 06:33:45 +0000 UTC [ - ]

For me the (more hypothetical than real) appeal is that if I actually get around to play with Markov chains and music, having an output target that is text-based (and well-documented) is a WHOLE lot easier than having an output that is one of "I programatically drive a mouse to click around" or "an undocumented binary format".

But, then, I also do close to 100% of my 3D-modelling in what looks like code.

For me, the question isn't "why do people like text-based description languages" it is "why do people dislike them".

And I guess the answer is "it doesn't matter, we are all different, and at the end of the day, what works for me may not work for you, and vice versa".

Heck, I even use both vi and emacs.

TheOtherHobbes 2021-08-16 19:27:11 +0000 UTC [ - ]

These projects appeal to those who think everything should look/work like simple code - basically hobby coding/tinkering with a bit of a musical excuse.

It's such a busy space, partly because these projects rarely bring anything new to the table. And if they do you end up with something that takes a long time to learn and has almost as much complexity as a real instrument.

So it's rare for either approach to get traction without some kind of championing by academia or industry.

prvc 2021-08-16 15:47:35 +0000 UTC [ - ]

>If I want to transport music notation between software programs, I have MIDI for that, which does a good job of capturing all elements of a performance (keys, timing, velocity, pedals, aftertouch, etc.) These types of notation formats almost always fail to achieve MIDIs precision across all the aspects of a performance.

Music notation works at a higher level of abstraction than that, and is intended to be intelligible by humans first and foremost.

jcelerier 2021-08-16 16:40:07 +0000 UTC [ - ]

> Music notation works at a higher level of abstraction than that, and is intended to be intelligible by humans first and foremost.

there's an entire generation of people who mainly compose through ableton live's piano roll though

thebricksta 2021-08-16 21:02:26 +0000 UTC [ - ]

I misunderstood the point of this comment before, thinking you were arguing that MIDI fails because it is not, itself, a clear human-legible format like text-notation languages being discussed are.

I understand now that you likely meant that MIDI does not capture the score itself, so it does not work as a notation file format, whereas these text-notation languages do describe the score.

thebricksta 2021-08-16 16:07:02 +0000 UTC [ - ]

Alright, it was wrong of me to call MIDI a notation format, since it's not.

MIDI is a protocol meant to be able to capture the performance of music, and much of the performance isn't human-intelligible data, so MIDI doesn't work as notation.

However, the case I was making is that MIDI can capture all the data present in a score already and transport between applications. No, you would never read MIDI itself from a file and try to play it on a piano, but I also doubt you could easily read Alda straight from a text file without rendering it either.

voakbasda 2021-08-16 17:01:08 +0000 UTC [ - ]

MIDI can capture the meaningful information about a performance of a work. It cannot work back from that and present the original sheet music. The performance is, by definition, only one possible interpretive expression of the written music. As such, MIDI cannot possibly transport all of the information of a piece of music that I score using classical notation without losing some of the specific information.

thebricksta 2021-08-16 17:23:18 +0000 UTC [ - ]

Yes that's a good point, something I was thinking about too after that post:

MIDI cannot work its way back to the original score itself, but it can capture a perfect performance of the score and allow that performance to be notated in another scoring program. That doesn't quite get you back to the original score however.

So now I suppose I can see some value in trying to develop more score representation formats with more compatibility - it'd be cool to be able to write a proper score then drag-and-drop it like MIDI into a DAW. Yes, that's usually possible through MIDI export, but it'd be neat if that was a first-class feature and we all passed around scores on the web instead of MIDI files.

EDIT: On further thinking, passing scores around wouldn't really be sufficient either, as oftentimes you do want a copy of an exact performance with humanized timings. I suppose you really would need to embrace both formats, or create some sort of hybrid that can capture elements of either/both freely.

mnhn 2021-08-16 19:29:43 +0000 UTC [ - ]

This is a really nice and subtle point. A score, expressive as they can be, is still a text to be performed. No one performance is the text, and the text is not a performance. There is a whole person performing the work whose identity, personality, history, sensibility and present state of mind all feed into any specific performance.

yomly 2021-08-17 07:28:30 +0000 UTC [ - ]

To draw an analogy - we are more than happy passing around the works of Shakespeare in its textual form. But as we know, a good performance can bring so much more than is encoded in the text at face value.

Music is really just a non-verbal language. If you become fluent in the language, you can appreciate music in its textual form just like you can appreciate Shakespeare for its literary value.

To my mind, this is why notational representations still persist, even in the age of media recordings. That higher level of abstraction still carries plenty of value and its compactness (over performance) is convenient to creators and academics who wish to reference them with fast read access.

2021-08-16 16:18:26 +0000 UTC [ - ]

jhbadger 2021-08-16 16:53:24 +0000 UTC [ - ]

"If I want to compose music, I need a format that makes it easy to visualize and manipulate notes in context of the other notes playing across all instruments."

Most composers compose using a piano. Orchestration is something that generally happens later, after the song has already been worked out on one instrument.

niek_pas 2021-08-16 17:28:30 +0000 UTC [ - ]

I’m pretty skeptical of this statement, do you have a source I could check out?

thebricksta 2021-08-16 17:48:05 +0000 UTC [ - ]

I think the truth of that statement very much depends on the genre, workflow, and age of the composer.

Yes, some older composers cut their teeth with pianos, staff-paper and pencils and established workflows based strictly on getting the whole song on paper before the orchestration/arrangement, and still work that way today.

However, I'd argue the vast majority of younger composers and people who write in more electronic-influenced genres definitely do not follow that workflow. It'd be very hard to write an entire pop/rap/dance track that relies heavily on the drum and bass interplay by first writing it all out on piano.

bsder 2021-08-16 20:58:41 +0000 UTC [ - ]

Practically every single DAW setup has a piano keyboard sitting in front of it. As a guitarist, I have had to learn to be at least competent on keys to communicate with people using DAWs. That's a pretty strong counterargument.

I think the only real argument would be whether most people compose with piano or guitar--and piano outnumbers guitar by a lot last I checked.

Everything else is in the noise.

beardyw 2021-08-16 17:44:31 +0000 UTC [ - ]

Me too. My brother in law would sit writing music on manuscript for hours. Very occasionally he would get up, go plink plonk .. mm .. plunk on a piano, and sit down to carry on writing.

techbio 2021-08-16 17:43:47 +0000 UTC [ - ]

I'm just going to concur with GP: as someone who has looked for advice for songwriting on guitar, the writers I look up to almost always wrote with a piano. If your quibble is with "most", and your musical tastes are somewhere within EDM (mine are not), might be a perception bias towards laptop electronica.

cloverich 2021-08-16 18:01:40 +0000 UTC [ - ]

i don’t know the breakdown but a lot of musicians in general do this, even some producers. For my genres more often with an acoustic guitar and vocalist (usually same person) ; interestingly at least one does this when the final song(s) don’t even include a guitar. I have very limited exposure to this but it makes sense.

https://woodandsteel.taylorguitars.com/issue/2021-issue-1/fe...

abcc8 2021-08-16 18:29:20 +0000 UTC [ - ]

To put it another way, do you think that the harmonies and flourishes are written before the chord progression and the melodies?

jancsika 2021-08-16 21:25:48 +0000 UTC [ - ]

> Most composers compose using a piano.

Most of the time mountaineers use a mountaineering jacket to run errands in town when it's raining.

I'm not sure that measuring "most" has much explanatory power in either case.

nemetroid 2021-08-16 21:19:37 +0000 UTC [ - ]

Lilypond is quite good for transcribing music. It's compact and quick to write, so you can get the job done quickly, and the layout engine is actually good out of the box.

However, I once tried a (small) composition project in Lilypond, and it really slowed to a crawl when I started to make major changes to what I'd already written. The ability to "refactor" is just so much easier in a visual editor like Musescore or Sibelius.

Perhaps for more experienced composers, with less of a need for complete redos, tools like these are better at "getting out of your way".

Kluny 2021-08-16 16:26:04 +0000 UTC [ - ]

For me, I think this is one of the coolest projects I've seen in a long time, and definitely the first musical programming language I've ever seen. I was a musician in high school and haven't picked up an instrument for a long time, but I still remember how sheet music works. As a drummer, I was never much good at reading notation or playing other instruments, so this would be a really accessible way for me to write music and see what it sounds like, as well as debugging it the way I would with code.

jeofken 2021-08-16 17:44:55 +0000 UTC [ - ]

There is also the popular ABC music notation language, but it seems to be less comprehensive than OP

eurasiantiger 2021-08-16 16:29:59 +0000 UTC [ - ]

How about just using C?

https://youtube.com/watch?v=tCRPUv8V22o

Maybe /s, maybe not…

coliveira 2021-08-16 15:51:27 +0000 UTC [ - ]

What I think this is trying to do is to put music composition at the reach of people who are used to REPLs and programming languages in general. But I agree with you that it is questionable if any of that makes any sense, since we already have fairly sophisticated software to compose music using notations that are much easier to handle (traditional staff, piano and guitar interfaces).

pinkybanana 2021-08-16 17:50:50 +0000 UTC [ - ]

Dude, to me it sounds like you are missing the point of music, which is that there isn't a point. It is just to experiment and do whatever feels good for you, which can be quite different things for different people.

fouc 2021-08-16 15:54:22 +0000 UTC [ - ]

You're making me wonder if there's any drawbacks to ABC format which seems fairly compatible with MIDI? (via abc2midi & midi2abc commands)

colomon 2021-08-17 08:33:11 +0000 UTC [ - ]

ABC is very well optimized for single voice traditional instrumental music. In that domain (and with a bit of experience at it), it's very easy to write and read ABC:

  T:The Three Smokestacks
  M:4/4
  L:1/8
  C:Solomon Foster
  R:Reel
  K:G
  EF|G2BG FGAF|GBdg ecAF|G2BG FGAF|GEFD EDEF|
  G2BG FGAF|GBdg ecAF|G2BG FGAF|GEFD EDEF||
  GBdg e2ef|gefd edBA|GBdg e2ef|gefd e2dB|
  GBdg e2ef|gefd edBA|Beed efgf|ecAF GFEF|
The header L: field defines the default length of a note. In the body of the tune, uppercase letters A-G are notes in the octave that starts with middle C, lowercase letters a-g are notes in the octave above that. A number following a note name is a multiplier for the note length. Bar lines are pipes.

The drawback to ABC is as you wander away from that original use case, it gets harder and harder to use. Here's snippet of an arrangement of Sleigh Ride I was working on a few years ago:

  z +mf+ (+accent+e .^d/) z/ z|(+accent+e .d/) z/ z +p+ .^F/.=G/||[K:G bass octave=-1] +crescendo(+ .A .A .A .A|.A .A .A .A|+f+ +crescendo)+ +accent+ d zz +sfz+ G|
Studying it again, I can mostly figure out what it is trying to do -- z is a rest, things surrounded in +s are extra commands, so +p+ and +f+ are dynamics, +accent+ puts an accent over the next note, etc. It's still pretty easy to understand, but I'd have a hell of a time playing the music from that notation. And I coded up that ABC, if someone else had done it there's a decent chance I'd have to stop and look up some of their notation in the ABC standard.

bjourne 2021-08-17 00:47:51 +0000 UTC [ - ]

The main drawback of ABC notation is that it doesn't capture polyphonic music well but by the looks of it, Alda's notation doesn't either. You can write polyphonic music in ABC but it is clumsy. Another drawback is that the ABC language has warts and has accumulated some cruft. Which is to be expected since the notation was invented in the 1980's and have been incrementally improved since. The main advantage of ABC is that tens of thousands of songs have been notated in the format and that it is well-supported by lots of programs.

testermelon 2021-08-17 02:19:10 +0000 UTC [ - ]

> The main drawback of ABC notation is that it doesn't capture polyphonic music well but by the looks of it, Alda's notation doesn't either.

Do you happen to know any good textual notation for polyphonic composition?

bjourne 2021-08-17 16:41:09 +0000 UTC [ - ]

Due to the nature of the data, it is very hard to create good textual representations. The most practical I have seen are piano rolls and MIDI event notation.

thebricksta 2021-08-16 16:14:12 +0000 UTC [ - ]

I've played with ABC / ABC.js to render sheet music in the browser before and I like it for transporting notation; but I don't think it fulfills the same use-case that Alda is attempting to hit.

667j76534v 2021-08-16 15:58:10 +0000 UTC [ - ]

For nerds who are dogshit at making music, but want to adapt the existing tools and theory to something they know. Its esoteric and never practical for anyone that wants to create music.

hdjjhhvvhga 2021-08-16 15:09:25 +0000 UTC [ - ]

For anyone curious what it actually sounds like when played by a musician, see https://youtu.be/7nbBSwopG-E?t=969 and https://youtu.be/7nbBSwopG-E?t=1033

rglover 2021-08-16 15:43:01 +0000 UTC [ - ]

Fun to watch, thanks for sharing.

PaulDavisThe1st 2021-08-16 16:09:15 +0000 UTC [ - ]

Without commenting on Alda specifically, people should understand that it's just one member of this list of highly overlapping (but also interestingly distinct) tools:

https://github.com/toplap/awesome-livecoding

"All things live coding : A curated list of live coding languages and tools"

kennywinker 2021-08-16 15:06:40 +0000 UTC [ - ]

This looks useful and fun, but without programmatic ways of specifying notes (i.e. ‘$v1 = $v2 + 12’) it’s not much of a “programming language” and mostly just a “text based notation system”.

Willamin 2021-08-16 15:18:54 +0000 UTC [ - ]

Looks like a previous version was mostly a Clojure DSL, but the latest major version no longer is. There are variables and other useful features we know from other programming languages that aren't mentioned on the landing page.

Of course there are also varying definitions of what a programming language is. For instance, I consider CSS to be a programming language, but I know many people disagree with that position (and that's okay). I personally don't think that a "programming language" must be a general-purpose, turing-complete language. Alda seems to be a non-general purpose, turing-incomplete language. At this point though, we're maybe getting into semantics a bit.

Syntax change: https://github.com/alda-lang/alda/blob/master/doc/alda-2-mig...

Jorengarenar 2021-08-16 15:47:19 +0000 UTC [ - ]

>For instance, I consider CSS to be a programming language

Out of curiosity, on what basis do consider CSS to be a programming language? And does it applies to versions prior to CSS3 too?

SamBam 2021-08-16 16:11:51 +0000 UTC [ - ]

This is what I've wondered about -- with this and with the other few "music programming languages" on HN in the past year.

They almost always seem to be simply "music notation", not music programming. At the end of the day, it's not that different from sheet music, just written slightly differently.

If I wanted to actually program music based on this, could I? Could I write a loop that plays random notes on the pentatonic scale? Or that systematically plays through every scale, without writing out all the notes by hand?

kennywinker 2021-08-16 18:57:33 +0000 UTC [ - ]

It sounds like there’s a layer built on top of this to write clojure that interacts with alda, and you definitely could with that. There are also a bunch of other options. Orca (a visual sound programming language) and sonic pi would be where i would start for two very different approaches to the concept.

wizzwizz4 2021-08-16 15:12:41 +0000 UTC [ - ]

joshuaissac 2021-08-16 15:18:07 +0000 UTC [ - ]

That seems to be for repeating things, but kennywinker is asking about shifting a note's pitch.

hippari 2021-08-16 15:35:22 +0000 UTC [ - ]

See https://www.youtube.com/watch?v=2L7edwef-5k Scheme seems like a much more powerful language for music composition, with the ability to deal with fractions and making your own tuning system.

Mizza 2021-08-16 16:06:06 +0000 UTC [ - ]

I ended up creating a lighter version of this for one my projects, https://github.com/Miserlou/chords2midi

I think that something that Alda looks like it lacks right now is doing things around intervals rather than notes, as transpositions and key changes will be very tedious without embedded knowledge of intervals.

My project is based around a Python library called Mingus, which I think gives you most of what you'd ever need to build a music programming project.

https://bspaans.github.io/python-mingus/

schot 2021-08-16 15:16:52 +0000 UTC [ - ]

How does this compare to LilyPond? I'm surprised it isn't mentioned at all, since from a first glance the notation looks very similar.

[0]: http://lilypond.org/

rekado 2021-08-16 16:12:27 +0000 UTC [ - ]

I actually used LilyPond for composition. It's a little less convenient because MIDI output is rather limited. But it gets the job done:

https://guix.gnu.org/en/blog/2020/music-production-on-guix-s...

tartoran 2021-08-16 15:32:34 +0000 UTC [ - ]

"LilyPond is a music engraving program", great for writing sheet music. This seems to be a music composition tool, eg you can use the repl to tweak your performance

nemetroid 2021-08-16 20:59:36 +0000 UTC [ - ]

I didn't see anything in the tutorial that LilyPond doesn't also do (and in a similar way).

ARandomerDude 2021-08-16 15:29:54 +0000 UTC [ - ]

I don't see support for adding lyrics in Alda unless I'm missing it.

incanus77 2021-08-16 16:05:24 +0000 UTC [ - ]

This is neat. It’s basically a REPL for 80s BASIC-style Music Markup Language (MML), almost identical syntactically.

lioeters 2021-08-16 18:54:30 +0000 UTC [ - ]

Thanks for this reference, it led me down a curious tangent.

It might not be the same thing - this one is XML-based, rather than "BASIC-style" - but I found an example of what Music Markup Language looks like, with Chopin's Trois Nocturne:

https://steyn.pro/mml/examples/chopin.html

For more links: https://en.wikipedia.org/wiki/Music_Markup_Language

montag 2021-08-16 19:52:30 +0000 UTC [ - ]

Oh...no...this MML is XML-based markup (read: not practical for use by humans), not the same as Music Macro Language.

lioeters 2021-08-16 20:04:56 +0000 UTC [ - ]

Hahah, I see, thank you for the correction.

https://en.wikipedia.org/wiki/Music_Macro_Language#Modern_MM...

montag 2021-08-16 19:37:05 +0000 UTC [ - ]

Indeed, MML is mentioned here: https://blog.djy.io/alda-a-manifesto-and-gentle-introduction...

This is another interactive MML project worth checking out: https://github.com/superctr/mmlgui

edit: unfortunately, we need to clarify...we're talking about Music Macro Language

jononor 2021-08-16 15:39:10 +0000 UTC [ - ]

Alda looks pretty neat. Manipulating it with a rewriting system (ala Lindenmayer) or a generative text model (hello GPT3) could be fun!

nielsbot 2021-08-16 18:18:56 +0000 UTC [ - ]

I used to use GWBASIC to make music on the PC. I immediately thought the same thing.

xrd 2021-08-16 17:25:34 +0000 UTC [ - ]

I'm glad to see more of these things. It's like a different take on Orca (https://github.com/hundredrabbits/Orca/) or SonicPi (https://sonic-pi.net/).

All of these are super fun.

But, it feels like we are missing an amazing EDITOR to go with these LANGUAGES.

For example, when "live coding" music I've not yet seen a great editor that could simulate what options there are for the next measure.

I can do this with two turntables and a mixer. When I used to DJ, I can put a record on the other deck, listen to the beat, mix and match it, adjust the treble/bass, even the tempo and merge it in WITHOUT anyone hearing those experiments. I was always worried about timing it correctly, and when you shift to the other deck, sometimes is was great and sometimes is was terrible, which is what you get out of live music.

I wish there were good editors that would permit me to enter in the chords and notes I want (like all these tools do), and at the same time, give me a window into insights like "adding this next chord progression would take it into a more jazzy realm" or "if you spread these notes over two measures and drop them an octave it will get really interesting." I suppose it is a lot to ask a computer to make those qualitative analyses of the music, but it seems like at least it could gather up some options. Computers are good at pattern matching.

And, I've also yet to see these editors offering a way to collaborate, either in person, or over the internet. With a shared language and networks, we can do this. Timing is the biggest thing, but music has a consistent tempo (so your collaboration might not arrive in this measure, but we could guarantee it enters the composition on the next measure at the exact right time).

I remember a FOSCON with _why (the lucky stiff). He came with a band to FreeGeek in Portland, and did this interactive music thing, where he put up a ruby program that all the attendees to the event could attach to with their own IRB session. And, then people could collaborate on the performance with him. It didn't go well. A veteran Perl programmer said "it was like watching a train wreck" (Perl people were pretty jealous of Ruby at that moment). It didn't go well, indeed, but it was so a fascinating idea to try and I wish there were more examples of this kind of thing. That would be such a great way to teach music.

jeofken 2021-08-16 17:31:23 +0000 UTC [ - ]

Very cool! I’ve been an ABC user for years, but always missed being able to make full scores with multiple instruments or a whole orchestra. This is what I’ve been looking for

iamcreasy 2021-08-16 19:22:06 +0000 UTC [ - ]

Does anyone know any good resource on learning music theory using tools like this?

smoldesu 2021-08-16 15:13:07 +0000 UTC [ - ]

I actually quite like this. Current text notation in trackers is pretty painful to manipulate, and I've often found myself wanting for a plaintext language to use instead, specifically for writing niche or otherwise difficult portions programatically. The syntax in this language seems to be exactly what I'm looking for!

warmfuzzykitten 2021-08-17 05:41:13 +0000 UTC [ - ]

MacOS won't let me run alda by default, and I'm not sure they're wrong. There is an open source alda project, but these are binaries downloaded from alda.io. Who vouches for them?

quaintdev 2021-08-17 04:31:11 +0000 UTC [ - ]

Amazing. I wish they included mini player alongside each snippet. Another thing they could do is build a playground kinda thing like Go. Not sure if that's possible in this case.

kebman 2021-08-17 08:09:01 +0000 UTC [ - ]

I have a feeling that learning a text-based tool like this, will give you greater control and flexibility over your work than NoteScore or Sibelius. Anyone tried both?

henearkr 2021-08-16 16:21:02 +0000 UTC [ - ]

I have written a small wrapper in bash for lilypond, just to get the same result, a command-line REPL, that compiles and plays instantly. But in lilypond instead of Alda.

tenaciousDaniel 2021-08-16 17:07:26 +0000 UTC [ - ]

Love these little DSL experiments. The more the merrier

bodge5000 2021-08-16 15:51:57 +0000 UTC [ - ]

I'm yet to look deeply into Alda, is anyone aware of what it provides in the way of sound design (if anything at all)?

Igelau 2021-08-16 17:08:09 +0000 UTC [ - ]

It looks like the answer is "no", with the addendum that waveform synthesis has been on the TODO list for a while: https://github.com/alda-lang/alda/blob/master/doc/list-of-in...

bodge5000 2021-08-16 20:27:28 +0000 UTC [ - ]

That's a bit of a shame, the search continues then

Cheers for finding out for me regardless

2021-08-16 16:47:14 +0000 UTC [ - ]

vldmrs 2021-08-16 20:45:44 +0000 UTC [ - ]

I was surprised not to find any demo of the Alda generated music on their website.

flenserboy 2021-08-16 17:18:56 +0000 UTC [ - ]

I like it. Some eventual way to translate it to XeLaTeX or the like would also be nice.

rawling 2021-08-16 23:03:50 +0000 UTC [ - ]

> An interesting thing to note here is the >. This is Alda syntax for “go up to the next octave.”

Whyyy?

You are going up an octave. The notes/pitch/frequency are going up. The subsequent c is higher than the preceding b. Why the hell do you notate that "b > c", not "b < c"?

rawling 2021-08-17 15:01:10 +0000 UTC [ - ]

Maybe because you physically move >that way> on a piano keyboard?

empressplay 2021-08-16 17:49:26 +0000 UTC [ - ]

Programming Language = repeat 4 [repeat 4 [playnotes (word "L repabove 1 "A repcount "B repcount "C repcount + 1 "R repabove 1)]]

Labo333 2021-08-16 16:43:40 +0000 UTC [ - ]

This is music notation, not composition!

Igelau 2021-08-16 17:10:20 +0000 UTC [ - ]

This is the car, not the driving.

sadsatan 2021-08-16 18:28:15 +0000 UTC [ - ]

absoLUTELy

hikerclimber1 2021-08-16 17:59:29 +0000 UTC [ - ]

Hopefully inflation in us reaches a billion percent

sadsatan 2021-08-16 18:29:43 +0000 UTC [ - ]

absoLUtEly this immediately screams HEY FUCK WITH ME PLEASE FOR HOURS ON END SO YOU DONT GET ANYTHING DONE

snambi 2021-08-16 16:29:53 +0000 UTC [ - ]

Does it support karnatic music notations "Sa, Ri, Ga, Ma, Pa, Da, Ni"?

Usually written as S,R,G,M,P,D. Makes it easy for Karnatic/Tamil musicians.