 Vicky Packer-Vicky, live from Congress. We have Lukas there, Lukas is back. Lukas just was here 15 minutes ago. And now he's going to talk about Lilypond. Lilypond is like latex, but for music notes. And I hope you'll have fun. Yeah. Thank you. Yeah, so I just want to talk a bit about Lilypond, which is a really cool program in my opinion to turn latex input, such as the code you can see up here, into beautifully typeset musical scores, such as down here. And that's actually the result of this code up here. So you can try to find what belongs to what or something. And yeah, it's free software, obviously. It takes latex input, which means you can put the code in a git repository and add comments and stuff. It's all very nice. The output is PDF or MIDI, if you want to listen back to it. Or you can even integrate it into latex or take info documents, such as these slides, which are created with latex beamer and Lilypond in them, which is a really funny combination and it works perfectly well. So let's just start with some of the syntax elements in a Lilypond file. It's pretty straightforward to make a note with a certain note name. You write that note name. So this is, I think, the American note names. I'm not sure if the English ones use a different one, but A, B, C, D, E, F, G, A are the note names and you write the letter and you get a note in return. And the relative mode here means that each note is going to be as close as possible to the previous one. For example, this A here at the beginning and the one at the end, that's the same input, but you can see they resulted in different notes. So this is one octave higher than the original one because that's the note that's closest to the preceding note. And to control the duration of a note, you put a number after it. For example, this is a quarter note. So you put a number four after it. This is a 16th note, so you put a 16 after it. And if it's a dotted note, such like this one, you put a literal dot after it. So there's a fair bit of ASCII art in there, which is kind of cute. And if it's more complicated, like the triplets here at the end, you write something like this backslash triplet. So that's kind of inspired by Leitech syntax, this backslashes and braces business. So this started out actually as a, I assume horrible heck to make actually Leitech produce these scores and then eventually they realize that's not going to work. We should actually write this as a dedicated program in C or C++. I don't remember which one, but the syntax kind of stayed similar at least in remembrance of that. Let's go back to a bit more syntax. If, as I said, in relative mode, the notes try to stay close together. For example, if I would just write C after this G, it would be the upper C up here because that's closer than the lower C down here. And to get the lower C, which is correct in this melody, if you can identify it, that's an Easter egg for you. I put a comma after it and to then jump back to the upper G instead of the lower one, I put an epistrofe after it, which depending on the font, in this font it works really well. It's kind of the same character, just the bottom and at the top of the line. In German, the epistrofe is also sometimes called the Hochkomma, the upper comma. So it kind of makes sense that you have these two characters to jump up and down between octaves and then you start to get a feel eventually when you need them and when you don't need them, but otherwise you can just compile your lily pond code as often as you want to see if it's right or not because it doesn't take that long. And if you need to modify the notes further, so if you have flat or sharp notes, you can teach lily pond to understand G sharp, for example, but no one will understand your score because the standard notation in lily pond is to add either an IS or an ES to the end of the note, which is exactly what these notes are called in German, which is very convenient if you're German like me. The manual says it's a Dutch notation or something, so FIS means the F sharp, but what's important is this doesn't literally mean put an F and then put a sharp right in front of it. It means logically in the music there's an F sharp, but then lily pond can look, for example, here, it just puts an F because the F sharp is already part of the key signature. This whole snippet is in B minor, so it has to have, no, it's in E minor, sorry. So it has to have an F sharp already and we don't need to put one here. On the other hand, here we have an F and in the index in the input, that's just an F, but then lily pond knows because the key signature has an F sharp. It actually needs to put a natural sign here to cancel that out. So what you put in is kind of the logical real music, so to speak, and then it's lily pond's job to figure out where do I need to put these accidentals, where I didn't need to put these natural signs, and this depends even on which century style you're trying to emulate and which instrument, like sometimes these things are in parenthesis and sometimes they're not. But in general, all of this is lily pond's job. You put in just the music and lily pond makes a beautiful score for you. That's the job at least. If that doesn't work out, you can tweak the output and here I have some a bit sillier tweaks. For example, I wanted a larger note head for some reason and the note head is a character in a special font which lily pond ships and embeds in this PDF file. And if I say I would like to add four to the font size, then I get a larger note head, at least for this one note. Or I can say I would like the color of all the note heads to be in dark red now. Or this tie, which would normally be downwards, like this one, it should now go upwards because I've overwritten it here. And I can even say, so this tie is actually a cubic bizier curve, so it's going to have four control points. And I would like to add these four pairs of offsets to the four control points to make this kind of looping shape. That's obviously very silly, but sometimes this can be useful, like if you have a score where you have a long articulation bow, I'm not sure what it's called in English actually, but this kind of thing over a long period of notes which where it makes like a Z shape or an S shape. And lily pond can't figure that out by itself. Then you can tell it, I would like the curve to look exactly like this and kind of tweak the output as much as you want. And you can actually go even further than this. Does anyone in the audience recognize this kind of syntax here? It's kind of... Yes, Lisp. It is a dialect of Lisp called scheme. So you can embed whole scheme programs in your score. So here I've said the color of each stem should be controlled by this lambda, this anonymous function, which takes a graphical object. In this case, that's going to be the stem and compare the direction of that to up. If it's up, then return red, otherwise return blue. So now I have a score where all the stems are blue if they point down and red if they point up, which is completely pointless, but it's very funny. And so you can go much further than this. Like this is some monstrosity I wrote because I wanted to have this score where you can see in the right hand, here you have the same notes twice, once in a baseline and then one octave higher and it's just always one octave higher. And for some reason, I could not be bothered to actually add the second note to each of the eight chords here, which would have taken like two minutes at most. And instead I spent like one and a half hours putting together this code, which takes an arbitrary melody and goes through it and for each note creates a copied note, which is somewhere here. Yeah, it creates a copy of the note, then sets the pitch to something else and copies some of the articulations, but not others. So this has a second tie here, but it should not have a second formata sign. And in the end you have this function and you can even put it on stack overflow or something. And that kind of represents this, what I really like about Lidipon is that it represents this whole spectrum between just simple music transcription and full blown programming. So if I get home at the end of the day and I'm really tired and don't have much mental capacity, I can just take some public domain score and transcribe it and just say, this is a D, this is an F-sharp, this is a quarter note and so on and it doesn't take much work. But if I want, if I feel up to it or if I want to have some fun, then I can also do the whole programming thing and write monsters like this and completely bend the score to my will, make it look exactly how I want to. And that's what I find really neat about Lidipon. And if you want to find out more about that, there are two manuals here. They're really well written. I basically read them front to back a while ago and they have lots of examples as well. The Lidipon snippet repository is even cooler. It is just a huge collection of tiny snippets of Lidipon code and all of them are CC0, so you can use them however you want without worrying about attribution or anything. And you can even try it out in your browser on lilybin.com without installing anything. And if you're wondering, wait, doesn't that mean I'm running arbitrary code on someone else's computer? It's not my computer. I don't know. Knock yourself out, I guess. But that's all I have already. I'm out of time, but thank you for indulging me.