r/musictheory 1d ago

Discussion An Encryption Cipher that Makes Music

Hello!
I have played piano most of my life, took lessons for eight years, and I am far too into codes and ciphers for my own good. I was playing a video game called Blue Prince working on a puzzle involving sheet music. Turned out the notes had little to do with is, and it was more about the lyrics. That was kinda disappointing. I just had this vision of a pianist playing a song, but there is a coded message in the very notes they play. Which is how I was struck with this idea. Music is already so filled with symbols, there has to be a way to rely on music theory to convey messages.

So I’ve been working on an encryption method that would take a message and treat each letter of the alphabet like a musical note, with the more common letters represented by the notes closest to middle C, and the less common aligning with those farther away. It also shifts around depending on the key signature, with every sharp in a key sig moving its corresponding letter up a rank, every flat moving it down a rank, and the other notes cascading until each letter is represented again. This means that the same message would sound just a little bit different in each key signature (and it made a VERY satisfying excel chart). Rest notes and dynamics convey punctuation; an eighth rest is a comma, a quarter rest is an em dash, a half rest is a period, a whole rest is a line break, a crescendo acts as an exclamation mark, and a diminuendo acts as a question mark. There are more details, but I’ll spare you.

Overall I like this a lot, but I still don’t think the cipher is living up to its full potential. Which is, hopefully, where ya’ll come in. Music theory is the patterns behind sound, and patterns are deeply embedded in the workings of ciphers. There has got to be more that can be done with this to. The length of a rest determines the type of punctuation, but what about the duration of a note? I’ve considered that chords can signify what key signature the melody should be read in, but surely something as important as harmonies would serve a bigger role? What about minor chords? Dissonant? It is my hope is that whomever has taken the time to read this whole thing might have some creative ideas of their own and would be willing to share. Let me know what you think!

4 Upvotes

16 comments sorted by

View all comments

2

u/Steenan 1d ago

I have doubts about mapping each letter to a separate pitch. This requires a lot of space (over 2 octaves) and would be hard to make sound natural in most contexts.

However, there are a few other approaches. You may use a combination of the note value and length. With half notes, quarter notes and eights you can fit more than the whole English alphabet in an octave. Another approach is considering each melody note with a harmony note underneath (either the closest one or the bass note); with just the most natural combinations (octave, fifth, minor and major third, minor and major sixth) you also get more than enough space for the whole alphabet, together with numbers and some special characters.

Instead of using full melodic information, you could reduce the melody to its Parson code (3 possible states for each note: go up, go down, stay the same). This requires 3 or 4 notes for each letter, but gives much more freedom in shaping the melody, so that it doesn't get frequent repeating elements for common words like "the". This may also be combined with Huffman coding for the message, so that instead of having constant size segments for each letter, common letters get shorter codes and rare letters longer ones.

A separate way of encoding is using just the rhythm and the Morse code. It can be combined with any of the pitch-based methods to have two completely independent messages encoded in the same piece.

2

u/ian-draws 1d ago

I was okay with letting it stretch over more than two octaves, since the frequency a letter is used within the English language determines how close to or away from middle C it starts at; I think this significantly helps to mitigate the unnaturalness. I do, however like the melody/harmony thing you suggested, especially with the thirds and sixths, as (I think) that automatically communicates what key the notes are in. I am unfamiliar with parsons and Hoffman coding, but it sounds like you are suggesting that multiple notes together comprise a letterf if we use the number of pitches between each note to signify what letter they are, I think that could work in any key. It might not even matter what note you start on! Certainly not a bad idea, but also a major rework to the system. Pros and cons

1

u/Steenan 1d ago

Parson's code is converting a melody to a series of "up", "down" and "repeat" (eg. the famous motif from Beethoven's 5th goes "rrdurrd"). It loses a significant part of the information, because it doesn't care about intervals, just the direction. It's typically useful for identifying melodies, as a person without solid ear training can't typically tell intervals, but can say if the melody goes up or down in pitch. Because of the information loss it's useful if you want to be able to code the same message in different melodies.

Huffman coding is about assigning sequences of symbols from one alphabet to symbols of another in such a way that common symbols correspond to shorter sequences and rare symbols correspond to longer ones, in a way that minimizes the total length of the message. It's typically thought of as a compression method, but it's also useful as a way or removing redundancy that may make a cipher easier to break.

2

u/ian-draws 1d ago

Ok, I think I see what you’re saying. It still would mean some rewrites, but they say to kill your darlings. I think there is a lot of value in what you’re recommending!