Waves and Sounds

February 22, 2026

This semester, I am set to take a class on Signals Processing. Prior to the start of the semester, I became interested in how exactly notes and frequencies and waves interact, so I wanted to make a little project for myself. My goal was to recreate the national anthem of Türkiye (İstiklal Marşı) using C++.

I should mention that I had no musical background nor any technical knowledge regarding waves. I didn't know what to do. Naturally, I looked around in wikipedia in search of knowledge on how to programmatically produce notes and found the entry for the Chromatic Scale. The basic idea, as far as I understand, is that the notes on the scale are just scaled versions of the fundamental note C. For example, you can get a D by multiplying the frequency of the C note by 9/8. And on that note (hah), I want to say that the musical note systems being different is weird for an outsider. As someone very used to the "Do Re Mi..." system, transcribing notes from "C D E ..." is weird. I have no idea who came up with note systems where you cannot sound out the note by its name.

After a bit of time though, I had the scale ready:

Scale

Notice that this scale is constructed using the earlier wikipedia chromatic scale link, specifically the just intonation version. The task from here on is easy, just find notes for the anthem and write them down in code right? Great, except for the fact that I don't know how to read sheet music. No matter, I'll just find some source on the internet wrote the notes down for me in plain text. After 15 minutes, to my surprise, I found that there were none (at the time of writing this post, I have found one such resource). Surprisingly, Gemini was transcribing notes from images erronously. I was a bit stuck.

Luckily I had a friend in Discord studying at a conservatory who was kind enough to teach me how to read sheet music! It was easier than I thought, especially since my goal was just transcribing and not reading the sheet while playing. It took some trial and error to learn note length indicators and positions. After a while, I had fully transcribed the anthem. Behold, my glorious creation!

The code for the entire thing is here. You can make your own music by editing the melody section and simply running make. You can also check it out if you want to understand how the code works exactly. This was a fun little project to work on!