HCoder.org
Posts in Category “Music”
-
Making lyric videos
Jan 15, 2019 onFor some time now I had wanted to find a way to create lyric videos without much effort. I really didn’t want a custom video per song, with hand-made everything. Just an easy way to call some scripts and do some tweaks by hand, and get a lyric video.
My first attempts with ImageMagick and animated GIFs didn’t quite work out because the animated GIFs, at least when converted to a video (to add the audio track) didn’t really keep the timing they were supposed to. So I was about to give up, but Luka gave me a very good idea: to make subtitles out of the lyrics, and the use
ffmpeg
to burn the subtitles into the video itself. So I got to work.Note: This whole process is absolutely for nerds, as it involves the command-line, Linux, and some hand-made scripts and tweaks in Aegisub, the subtitling program I used. If you’re looking for an easy way to do it with a graphical or web program, you’re out of luck (there might be ways, but this is certainly not it).
Preparing the subtitles
The first step is to create the subtitles for the lyrics. Astonishingly, I start with a simplified text file (in a made-up format), then convert with a hand-made script into an
.srt
file… then I convert it to the final.ass
format in Aegisub. So, yes, the lyrics go through three different formats in total.The first, made-up lyric format looks like this:
00:52,500 Another gal asked him to please everyone 00:55,000 what an impossible burden to bear 00:59,000 01:09,000 Bunch of Satan suckers 01:11,500 Selling cola products 01:14,500 Are you Christians? Please forgive me 01:17,500 If you didn't like what I said
As you can probably see, it’s a very compact format that can be written easily in a text editor. The idea is that each line stays until the next one, hence I add an empty line with a timestamp (the third line) to make the previous lyric show for 4 seconds, instead of 14. With a hand-made script I convert this format to an
.srt
file, by calling it like so:./lyrics-to-srt.sh melvin.txt >melvin.srt
Now you might be wondering: why don’t you convert them directly into the final format? The reason is that the
.ass
format is a bit more involved, and it contains formatting information, too, like the font used, font size, position of the subtitle lines, etc. It was easier for me to convert to.srt
first, do the visual stuff in Aegisub, and save the file as.ass
in Aegisub.So how does that work, exactly? Aegisub has a “Styles Manager” (available from the menu “Subtitle”) in which you can define a subtitle style. In it you define the font and other things. You define that once, and that style will be available for you in any file you open with Aegisub. So once I have the subtitles in
.srt
(a format that Aegisub can open), I open the file there, select all subtitle lines with Ctrl-A, then choose the style I want in the UI:After clicking on the style, all lines get marked as having that style, as you can see here (notice the change in the “Style” column, to the left of the lyric text itself):
Now I can choose “Save as…” and save the file as eg.
melvin.ass
.Preparing the background video
Once I get the subtitles in the appropriate format, I can make the base video (without lyrics) in Kdenlive. The process is as follows:
- I load the song with “Add Clip” on the left hand pane.
- I click “Add Title Clip” on the left hand pane, and I put whatever static text or images I want for the background, including the name of the song.
- I add both to “Audio 1” and “Video 1” respectively, and make sure that the title clip is as long as the audio track.
- I render it to an MP4 video file.
This will give me a video file that has the title of the song and whatever background I want, but no lyrics or subtitles.
Putting it all together
At this point I have two things: the final subtitles in
.ass
format, and the basic video without the lyrics. With this, I can useffmpeg
to produce a second video with the subtitles already on it, in whatever font, size, and position I chose in Aegisub. The magic command is this:ffmpeg -i background-melvin.mp4 -vf ass=melvin.ass melvin.avi
The result will be a video with the subtitles rendered on it, like the Melvin lyric video you can see on YouTube.
Conclusion
Although it does involve several steps and it’s pretty dirty, this method to create the videos is good enough for me. I wasn’t going to create that many (only four in this batch) and I’m comfortable using these tools.
It should be possible to simplify the workflow by typing the subtitles directly in Aegisub, instead of in a text file, then convert them. I might do exactly that the next time I have to make another batch of these, but this time I already had the lyrics in the first format (due to my previous attempts with ImageMagick) so I figured I’d convert them to be able to open them in Aegisub instead of typing them there again. I hope this post was useful!
-
Writing a song
Oct 13, 2018 onAbout a week ago an idea for a new song popped in my head. I started writing and came up with a verse pretty quickly, and the chorus followed shortly afterwards. As I love talking about music and creative processes and such, and I’m never sure how I write songs when people ask me about it, I decided to take notes about this last one, and explain how I did it. This is by no means the only way to do it. Or, for that matter, the only way I do it.
This should be easy to understand even if you don’t know music theory, as I don’t really use a whole lot when I write (I don’t know all that much myself, anyway). Also, I’ll try to explain the concepts I do use.
Spark
The spark for this song was a title and a topic. The title was “Who are you?” and the topic was the feeling of not knowing someone anymore after they change or we discover something about them we didn’t know.
First melody
Just minutes after the spark came, a melody popped in my head. Note that I wasn’t thinking about any scales or chords or anything like that. A melody popped in my head and I just needed to write it down before I forgot it.
The first thing I did was to figure out in which time signature the melody was (it’s in 6/8). A bit more on that below if you don’t know music theory. Once I found out it’s in 6/8, I went to http://music-explorer.org and found the notes for the melody, then wrote down the following (at the time I couldn’t notate it properly):
1 2 3 4 5 6 A E A B 1 2 3 4 5 6 1 2 3 4 5 6 B A B C 1 2 3 4 5 6 B A A E
This is a simple visual representation of the melody. The letters are notes, and the numbers are used to count the beat. This is how it sounds:
If you don’t know music theory
If you have no idea what the 6/8 above means, listen to the drums and see how you can count together with the drums, in groups of 6. You should be able to count four groups of 6, and each group should feel like a short phrase, as in it makes sense as a group. If you tried to count in, say, 4, each group of 4 would be random notes, and wouldn’t naturally follow the music.
Look at my made-up graphical representation while you listen to the music and see if you can make sense of it. See how in the last group of 6, the second and fourth notes are not aligned exactly with a number! That happens in the music, too.
Adding chords
If you don’t know music theory: what are chords?
A chord is three (or more) notes played at the same time. Often, one starts with a melody and then adds chords to it. The chords have to have common notes with the melody they accompany.
If you want to try some things, go to http://music-explorer.org, type the chord into the “Highlight chord” box, and press Enter.
If you do know music theory
For some songs I try to write more intuitively, more “from the gut”. This is one of those. In these cases I don’t try to find the key or the scale I’m using, and I don’t think of which chord is the I, or the iii, or whatever. I just try several things until I find something I like.
Adding chords to the verse
As we can see in the visual representation I made, the first notes are A, E, and B. Now, which chords contain at least some of those notes? I tried a couple, and I decided that I liked Aadd9 (which is made of the notes A, B, C#, and E). Because the second bar (the second measure for you Americans; if you don’t know music theory, I mean the second group of 6 beats) doesn’t have any notes, I kept the chord.
For the third bar I liked how Cmaj7 (which is made of the notes C, E, G, and B) sounded. That matches B and C, but not A. That’s fine. For the last bar I only matched E because I went with Cadd11 (I had the impression that I’d like the chord to be another kind of C, and I liked how Cadd11 sounded there; Cadd11 is made of the notes C, E, F, and G).
This is the end result, playing the chords once in the beginning of each bar:
Rhythm and groove
The rhythm of the guitar and the drums was just a placeholder. I wanted the rhythm to be a bit more sophisticated than that. Long story short, after playing a bit with it I ended up with this version:
If you listen closely you’ll hear that in the last bar I added a variant of the Cadd11: it’s Cadd11/E.
Adding a bass line
After I got the guitar chords, I added a bass line. For each bar we know the chord being played, and we know which notes it contains. So, the bass plays one or more notes from the chord (could be the melody, too, but I usually pick from the chord notes).
The first two bars have Aadd9, and in this case I kept it simple and only played A (the root note, ie. the one that gives the chord its name). In the third, the chord is Cmaj7 and I decided to play C, again the root. In the last, the chord is Cadd11, and I decided to play F and E (the 11th and the major 3rd respectively).
Note how the melody, guitar, and bass don’t always play at the same time. Instead, they “weave” the song together.
The chorus
For the chorus I did something similar: started with the melody, added some chords I liked (by looking at the notes in the melody), then decided the rhythm for the guitar and the drums, and finally I added a bass line. I don’t always work in this order, but it worked for me for this song.
I ended up with the chords Cm7 (comprised of C, D#, G, and A#), C#maj7 (comprised of C#, E#, G#, and C), and Am (comprised of A, C, and E).
Final version (verse + chorus)
This is not the whole song because I’m going to add something more: most likely some kind of outro, a bridge, or maybe space for a guitar solo. But the final version of verse and chorus plus the repetitions I expect to have in the final version are here:
I hope this was useful and easy enough to understand! If you have questions, you can contact me on Mastodon (estebanm@mastodon.social), where I post a song every Monday, with a short explanation of something interesting to notice when you listen to it.
-
Listening to music
Jun 25, 2018 onLast Friday I gave a talk about “Listening to music”. It all started after a conversation in which I was trying (and failing) to explain what the “progressive” label meant in “progressive rock” and “progressive metal”. I figured the only way was to show the same piece of music with simpler and more complex arrangements. This is the blog post version of that talk.
The idea of the talk was twofold: first, give a better idea of the possible differences between a straightforward rock song and a more complex rock song. Second, to show examples of musical decisions that make a song sound different, so it’s easier to spot why we like the music we like. It was never my intention to suggest that more complex music is better (everything has its uses), just to see that songs sound like they do because of a number of decisions made when writing and recording it.
Through the talk, we take the chorus of a song and rewrite it to be a simple as possible, and then we make changes until we’re back to the original.
Original version
This is the original version of the song (just the chorus, really). It’s not quite progressive rock, but it certainly has similar elements:
Now, we are going to rewrite it to sound as straightforward as possible.
Straightforward version
This is a completely rearranged version of the same chorus, in the most straightforward way that still sounded like a song someone could write:
Compared to the original, this should sound much more familiar, safe, and stable. Many things have been changed to reach this version. In the following sections we’ll undo those changes one by one and we will end up with the original version.
First change: chords
The straightforward version uses “power chords”, which are simplified chords used often in rock, punk, and metal. I prefer full chords, so the first change is just that:
The difference can be quite subtle, especially with this computer version. You can compare just the guitar in one and the other here:
OLD
NEW
Second change: bass line
If you pay attention to the song as is stands now, the bass is simply repeating the root note of each chord being played. The result is that the bass “supports” the guitar, making the sound of the chords fuller, but not much more. Instead, let’s make a more playful bass line, using some of the available notes in the chord (instead of always the root):
The only difference is the bass. Compare the old bass line to the new one:
OLD
NEW
🛈 Examples of bass line that don’t follow the guitar (in this case, not even rhythmically!): Drapery Falls by Opeth and Dry the Rain by The Beta Band (from 4:08).
Third change: rhythm
The next step is to change the rhythm. The common rhythm most pop and rock is built upon is 4/4, but I’m fond of 6/8 (a rhythm that sounds somewhat like waltz, and it’s often used in ballads). This difference is somewhat big because all instruments have to adapt:
Compare to the version in 4/4:
🛈 Example of song in 6/8: Somebody to love by Queen.
Fourth change: strumming
The first version in 6/8 has a very simple groove: it simply marks the chords being played and little else. Hence, we’ll change the guitar to have a nicer groove. The bass rhythm will be a variation on that, but while at it we’ll also changes the notes. Thus, both guitar and bass change:
OLD
NEW
OLD
NEW
Fifth change: drums and small details
In the previous version, the drums play a very straightforward 6/8 groove. I wanted something different for this song because I was going for an unstable, dark sound. So the drums had to change. This is, finally, the original version (same as at the top of this post):
OLD
NEW
🛈 Example of song with drums going against a 6/8 groove: Judith by A Perfect Circle, from 3:12 to 3:16 approx.
Apart from the drums themselves, the guitar also changes slightly in the second half of each line (between 6 and 8 seconds in). Compare the two:
OLD
NEW
🛈 Example of song with a sort of call-response between voice and guitar: Jeremy by Pearl Jam, at around 1:19.
Conclusion
As it’s hopefully clear by these examples, somewhat small changes can make a big difference in the feel of a song. When we stack several of those changes we can make a song sound very, very different.
And remember, complexity is not necessarily good! In this song I needed that unstable sound, but don’t get blinded by the fascination of complexity.