10 ms·
Alda: A music programming language
- archimedespi 11y agoThis is awesome, I've dreamed about something like this for a long time. Cool that it's done in Clojure too :)
- vfdfv 11y agoI also think Clojure is a great fit. I've had some really good results with sample-based algorithmic composition, so I'm really looking forward to this: "In the near future, Alda’s scope will be expanded to include sounds synthesized from basic waveforms, samples loaded from sound files, and perhaps other forms of synthesis."
- klum 11y agoWonder if VST support is a possibility. Also things like automation, for changing parameters like volume over time. It's easy to see how a programming language can be a good fit for notating certain kinds of music and allowing playback of it. Seems to me like the challenge is to go beyond lining things up neatly to a grid and introducing any kind of "looseness" to the music. Edit: Then again, people do great stuff with trackers, so I'm sure a programming language can be a great fit for some kinds of music.
- vfdfv 11y agoDefinitely! Though you may already know, aligning notes to exact subdivisions of the beat is called quantization. https://en.wikipedia.org/wiki/Quantization_%28music%29 https://en.wikipedia.org/wiki/Quantization_%28music%29 Quantized music feels noticeably less organic and lively, to me at least. Audio sequencers like Linux's Hydrogen give you the capability to mess with "lead" and "lag", but it must be done individually for each note and so is fairly tedious. I've used the Python module pydub along with a random number generator to set samples slightly ajar, but, while it helps, a purely random approach doesn't capture how human performers implement lead and lag. I absolutely recommend pydub as an easy way to manipulate sound files. https://github.com/jiaaro/pydub https://github.com/jiaaro/pydub
- klum 11y agoThanks for the info, pydub looks nice! And I suppose that when you have music represented by a text file, as is the case in Alda, you can then use other programs to operate on the text file (for example, you could probably write a script to vary note/rest lenghts a bit using the quant attribute).
- seba_dos1 11y agoIs there some "IDE" for it already or is this going to be my new side project? :)
- fiatjaf 11y agoI hope there isn't.
- dmos62 11y agoAuthor mentions IDEs like Guitar Pro, etc. He referred to them as "distracting."
- seba_dos1 11y agoAnd I understand that. What I meant is something completely different - like a set of autocompletion rules for chords and scales, "debugging" abilities (like selectively playing particular voices or parts of song) and other stuff that makes programming... err, composing in Alda easier. Obviously reusing some already existing text editor, like Vim, Emacs, Sublime or Atom will be the way to go when creating such "IDE". I definitely didn't mean Guitar Pro/TuxGuitar with Alda as a backend, that would be kinda pointless.
- daveyarwood 11y agoI was about to say this, exactly! I could easily see something like this kind of functionality in the form of a Vim plugin or Emacs mode.
- coldtea 11y agoThe idea is that this doesn't have (or need) an IDE.
- mlangdon 11y agoSeems like a sublime text language syntax highlighting file would be more than adequate here.
- mapcars 11y ago
- akldjlafkjalfk 11y agolooks a little bit like lilypond
- vixen99 11y agoNot much difference insofar as you type characters into a text editor & present the result to be executed. I guess I'm missing something but I'd like to see what it does that Lilypond does not already do brilliantly especially in combination with something like Frescobaldi.
- rebootthesystem 11y agoThis is neat, of course. Yet, being classically trained myself and a software engineer, both for 30 years, I have yet to find an alternative music notation system that would make me proclaim I would use it. When I look at a traditional score I see and hear the music in my mind pretty much instantly. There is zero cognitive load, at least at the conscious level. With any kind of text-based notation you have to read text. Another point, perhaps minor, I think I can say that most of the world does not learn notes as "CDE" but rather "do" "re" "mi". That's certainly how I learned it because I did not study music in the US. Perhaps you've accounted for this? For me paper and pencil is still the best approach and the most natural experience. Notation is a powerful tool, in fact it is a tool for thought. I learned this in CS when I studied APL and used the language professionally for nearly ten years. Music very naturally lends itself to a sophisticated notation. I am not sure taking that away can ever produce a better outcome. Someone more qualified on the subject can probably explain why it is our brains have evolved to be "tuned" for notation. My hypothesis is we evolved powerful image recognition capabilities coupled with high speed classification and semantic processing. We can instantly recognize shapes (predators, something flying towards you, etc.) decide what it is, access a library giving us options and decide how to react. All of that in a very small fraction of a second. Notation benefits from us having developed such capabilities in our brains. It isn't my intent to criticize this effort. Without attempting new ideas there can never be any progress. Kudos for trying. I'll end with a question: What would you say is the use case for Alda?
- sampl 11y ago> why it is our brains have evolved to be "tuned" for notation I'm not sure they are tuned--is there any reason you say this beyond personal experience? Music notation is noriously difficult to learn for most people, and many non-classical musicians avoid it entirely. Maybe it's just self-selection. Those with a natural gift for reading are likely to become classically trained musicians, and those without it are likely to find other means of creative expression.
- gtani 11y agoi think pianists, string, woodwind and guitar players look at scores differently, they visualize them and start recruiting motor skills ahead of time. WHen i look at a Bach score as a pianist, i just kind of flow thru it, if i see it as a guitar score, i think of the simplest fingering patterns (CAGED patterns are the simplest framework), a woodwind player wants to pinpoint the large intervals and octave breaks and other difficulties where intonation and tone become tricky (whereas with somebody laying out a c++ project or studying Baby Rudin (real analysis), you can't explain it in terms of muscle memory
- phyzicist 11y agoI'd like to add to this discussion by mentioning the ChucK music programming language (http://chuck.cs.princeton.edu/ http://chuck.cs.princeton.edu/). Here is a TedX talk by the co-author, Ge Wang, talking about the joys of digital instruments (http://www.ted.com/talks/ge_wang_the_diy_orchestra_of_the_future http://www.ted.com/talks/ge_wang_the_diy_orchestra_of_the_fu...). In the talk, Ge Wang talks about leading the Stanford Laptop Orchestra, which uses ChucK to program all sorts of crazy digital instruments, and also talks about "Ocarina" iPhone instrument. Cool stuff!
- heuermh 11y ago+1 to ChucK! I have a library of ChucK code here, LiCK https://github.com/heuermh/lick https://github.com/heuermh/lick
- victor9000 11y agoDo you happen to have a demo link so we can hear what it sounds like?
- anderspitman 11y agoDisable non-error debug messages (https://github.com/alda-lang/alda#logging https://github.com/alda-lang/alda#logging): export TIMBRE_LOG_LEVEL=error alda repl
- excel2flow 11y agohttps://en.wikipedia.org/wiki/List_of_audio_programming_languages https://en.wikipedia.org/wiki/List_of_audio_programming_lang... What's the selling point of this one?
- rfotino 11y agoThis looks great, I'll definitely be doing some experimenting! Any way to save the output to an audio file when you're done rather than just hearing it through Alda?
- daveyarwood 11y agoNot yet -- I've had this feature on my mind for a long time, though. It's pretty high up on the to-do list. This is far from ideal, but as a workaround, you could set up a sound recording program like Audacity to record system audio output and play your score. Hopefully in the near future you'll be able to do something like "alda play --file my-score.alda --output my-file.wav" or something to that effect.
- zebproj 11y agoI've had a lot of experience with various musical languages (ChucK, Csound, Supercollider, Max/MSP, PD, Faust etc.) I've even designed a few music languages for myself. For what it's worth, I did go to a music school and graduated with a bachelors degree in music, with a strong focus in computer music composition. In the case of Alda, I'm a little underwhelmed. To be fair, it seems that the author of this software has done a good job meeting his goals. The syntax does look quite intuitive, basing it off of Lilypond syntax was a good choice IMO. I wouldn't call it a programming lanuage, and it can't do everything I want, but it seems to fit certain types of music quite well. Here is my big issue: >In the near future, Alda’s scope will be expanded to include sounds synthesized from basic waveforms, samples loaded from sound files, and perhaps other forms of synthesis. I don't want to say Alda sounds "bad", because soundfonts, samples, and basic waveforms have their place for certain styles of music, but it is certainly quite limiting. Considering that there are massive books written about the "perhaps other forms of synthesis", it doesn't seem like sound itself to be too big a focus. From what I'm reading, Alda is essentially a MIDI file generator. It doesn't actually produce music, rather, it sends MIDI instructions for how to play music somewhere and leaves it up some other program to make the sounds. All of the other music languages I've mentioned can actually make music internally. Have you ever considered using other music languages with Alda. Overtone is just Supercollider + Clojure, so I'm sure you do something similar. I imagine it would be pretty trivial to get Alda to write a Csound score, since it's basically just a text table. PD has libpd, which I've had limited success with. I might as well mention my project Soundpipe as a possible DSP engine as well: www.github.com/PaulBatchelor/Soundpipe.git
- mlangdon 11y agoI've done a lot with Pd and enjoyed the noise-making aspects. I find the composition orientation of Alda appealing, but I would want to be able to pipe in sound from something like a Pd. Any of the above inhabit this middle zone? I particularly like the idea of visual flow programming for synthesis and markup with control flow for composition.
- zebproj 11y agoAlda does MIDI out, so you could probably route Alda to PD (PD is really good at handling MIDI signals). While not graphical like PD, several musical languages make a distinction between the sound design (signal flow and modules) and events (notes, etc). Csound is the first to come to mind, with it's MUSIC N orchestra + score paradigm. The orchestra syntax (especially the new changes in csound6) lends itself nicely to expressive sound design. Scores, however, are tedious to write by hand. Most Csounders opt to generate these using another program (which in itself is pretty cool, IMO) ChucK does a similar thing as well, where you can write the signal chain (oscillator => filter => dac) and then you can control it using ChucK's C-like syntax. If you are interested in algorithmic composition and have a stronger background in programming, this is a pretty fun language to work in. That being said, Csound has a much better collection of sound modules. Not exactly the answer you were looking for, but I hope you can check them both out, as they offer different approaches to computer music composition.
- ant6n 11y agoThis is pretty neat. But I found it quickly getting very hard to read towards the bottom. I feel if there's a computer interpreting some sort of language, that it should have a built in notion of the circle of fifths -- why should I give the computer absolute notes, when everything in music is so relative. Maybe viewing the notes in terms of do,re,mi would make sense, within the context of being in some key; then jumping to another key (like the dominant, or the minor version of the current key). Computers make computation cheap, which means it should be easy to think in terms of abstractions (that's how musicians think about music, then unwind those abstractions into absolute notes when writing the music down). But then I look at the current syntax, how it attempts to be extremely compact, and worry that it won't be possible to extend to better abstractions very well.
- daveyarwood 11y agoI think this is a key thing to notice about Alda. It doesn't attempt to provide abstractions for things like keys, scales, or even measures and time signatures. It's more like writing Markdown: you already know what you want to write; it just gives you a way to represent it in a compact way and turn it into something you can hear back without having to reason too much about what you've written. I want Alda to be as close as possible to a sheet of staff paper that you can write notes on. MML is a very similar language in this regard. The idea is that it's up to the composer to write down the exact notes he/she wants, exactly how he/she wants them. I realize this is disappointing if you're looking for something with more abstractions, but on the bright side, I think there are some great languages out there that do exactly that. If you haven't already, have a look at Music-Suite ( http://music-suite.github.io/docs/ref http://music-suite.github.io/docs/ref ) and Overtone ( http://overtone.github.io http://overtone.github.io ), along with the Leipzig library, which adds functional programming abstractions for use with Overtone ( https://github.com/ctford/leipzig https://github.com/ctford/leipzig )
- desunit 11y agoI agree. Recently we have started the project where we are trying to allow musicians to experiment with different chords & styles (http://www.songtive.com/songs/new http://www.songtive.com/songs/new) and displaying relative chords is one of upcoming features.
- mapcars 11y agowell, no sound from scratch on linux, clojure-1.7 and icedtea jvm.
- lukebennett 11y agoI get the thinking behind this, and seems a neat little tool. However, I can't help thinking that the problem the author cites with modern GUIs being too distracting to use is more likely to be solved long term by the likes of StaffPad[0]. This allows you to physically write your notation on a blank digital canvas, meaning the only difference to writing on a blank sheet of physical paper is the tactile contrast of using a stylus rather than a pen/pencil - something that is improving all the time. [0] http://staffpad.net http://staffpad.net
- hpvic03 11y agoCan this language produce an actual grand staff notation, e.g. in a pdf format? I'd like to use to write down compositions, but it would need that feature to be useful. If I could write down compositions in Vim that would be killer.
- daveyarwood 11y agoNot yet... but it's on my to-do list. At some point, we will hopefully be able to generate LilyPond ( http://lilypond.org http://lilypond.org ) scores from Alda code.
- geoffroy 11y agoInteresting ! Not that far from the new Common Lisp based language OMN brought by Opus Modus which was released early this year http://opusmodus.com/omn.html http://opusmodus.com/omn.html
- anoncoder 11y agoGetting "Illegal Argument Exception" when running it.
- ww520 11y agoThis is pretty cool. Good work! Couple things come to mind. 1. Is there a way to play a selected segment of the music rather than the whole file? While composing, replaying a segment over and over again is quite common. Don't want to start from the beginning every single time. 2. Is there a way to produce music sheet (PDF or PNG) from the source? There would be really useful. 3. Is there a way to format the notes into measures? I know the | is optional and ignored. Can the program do reformat and automatically divides the notes into measures? 4. Emacs integration would be great. Using Emacs to edit. Do ^X^E to execute the program to play the selected segment.
- daveyarwood 11y agoThanks for the kind words! 1. I do have plans to implement start and end points for playback, either in the form of minute/second markings or the already-implemented "markers" you can place in an Alda score. I agree this is a crucial feature -- it will be very useful when working on one small part of a large score. Eventually you should be able to do something like: "alda play --file my-score.alda --start 0:30 --end chorus" 2. Not yet -- I'm hoping we'll implement a way to generate LilyPond ( http://lilypond.org http://lilypond.org ) typeset scores from Alda code. 3. My philosophy on bar lines (and the reason why Alda ignores them as if they were comments) is that they're essentially "invisible to the ears," and so they don't serve much purpose except as a way to visually organize your score file. However, in order to generate sheet music (e.g. by generating LilyPond code), we will probably end up making them significant to the parser after all. I can see how it might be useful to think of your score in terms of measures, e.g. "play a few eighth notes, then rest until the end of the measure," so I'm certainly open to the idea of implementing measures. 4. I agree, although I'm a Vim user :P
- MadcapJake 11y ago4) Just wrote https://github.com/MadcapJake/language-alda https://github.com/MadcapJake/language-alda for Atom. (Atom has the great https://github.com/atom/vim-mode https://github.com/atom/vim-mode package and for the parent, though it seems less complete, there's https://github.com/avendael/atomic-emacs https://github.com/avendael/atomic-emacs) Also in regards to the parent's interest in having a keybind to autoplay alda files, there is https://github.com/lsegal/atom-runner https://github.com/lsegal/atom-runner and with a short snippet in your config you'll have `alt-r` recognize alda files and play them! For the language-alda package, I'm working on integrating autocomplete support for instruments, markers and attributes. I think I can also add support for atom-runner directly through the language package too. Between playing around with the langauge and getting tooling support in Atom, my whole Sunday was completely swallowed up! :P
- efnx 11y agoBesides this being rad - you can see in the Alda repl screeny that the author has earthbound behind it. I love that game.
- daveyarwood 11y agoHaha, good catch! I've been madly in love with Earthbound ever since it came out. Playing it was a life-altering experience.
- efnx 11y agoMe too. Very, very good game. It's the only real RPG I connected with, and one of the few games that I hold close.
- tomcam 11y agoNew to this stuff, but doesn't abc already cover this same ground? http://abcnotation.com/ http://abcnotation.com/
- TazeTSchnitzel 11y agoI installed it, but why is my console filled with debug output?
- daveyarwood 11y agoI just deployed a new version of Alda earlier this afternoon (alda 0.4.5) -- it should update for you the next time you run Alda. This new version has better default behavior for logging, i.e. not dumping a bunch of debug logs onto your screen :)
- ademarre 11y agoCool, but the tagline is redundant and awkward: > a music programming language for musicians I would suggest dropping one of the musics: "a programming language for musicians".
- samwyse 11y agoThink that it is fine just the way it is. A "programming language for musicians" could just as easily be BASIC or something, while a "music programming language" could be aimed exclusively at computer scientists.
- gott 11y agoThis is a pretty advanced language, i like it much!!! I want to share what i was experimenting with lately... It´s a very easy language to produce music in the form binaural audio, it helps me to sleep with my insomnia. Sbagen is the name and you create .sbg files. http://uazu.net/sbagen/ http://uazu.net/sbagen/ Idoser is based on the same source Use this here to create or edit .drg files from or with .sbg files. http://binaural-spot.blogspot.de/2010/08/drg-author-installer.html http://binaural-spot.blogspot.de/2010/08/drg-author-installe... There is also an online converter for .drg files to .sbg and the .sbg files actually show you the source, you can create wav files but they are very large.. Use the .sbg files and in case you want this mobile, here is an android version that can handle these kind of files: http://www.normalesup.org/~george/comp/binaural_player/ http://www.normalesup.org/~george/comp/binaural_player/
- todd8 11y agoI'm not a musician of any kind, but I wanted to congratulate the creator of Alda. I believe that (almost) everyone on Hacker News admires and respects those who make interesting projects. We are a community of hackers that are interested in reading about projects like yours. I see you just created your HN account. Congratulations! I found a few of the comments here a bit critical of Alda, but that's just the way Hacker News works. There is such a large, diverse, intelligent, and involved community on Hacker News that there are always people that have keen insights or have already tried out related ideas resulting in useful, or not so useful, observations. Inside the most critical comments may be the best suggestions. Keep us posted on the development of Alda; here on HN, everyone is cheering you on.
- lajarre 11y agoIt's written: > o4 c++++-+-+-+ > The above is a really obtuse and unnecessary way to represent an E (a.k.a. a C-sharp-sharp-sharp-sharp-flat-sharp-flat-sharp-flat-sharp) in Alda. This is equivalent to c++++, c 4-sharps. This is NOT e, as far as I know. See https://fr.wikipedia.org/wiki/Comma_syntonique https://fr.wikipedia.org/wiki/Comma_syntonique and how semi-tones are built. I'm thus wondering how things are built behind the scenes..