Solfa Algorithm

Have you ever imagine how would it be to write poetry and generate music?

The Solfa Cipher is a procedure to convert text into music.This was part of an activity of the Session 4 of the Digital Alchemy Course.

The algorithm used throughout this article is based on the Solfa Cipher.

Curious fact: musical cryptography is a very old technique.

How it works?

We will be transmitting a written message within sounds. For that is needed to convert text into musical notation using:

Where rows represent the duration of the note {1,2,3,4} and the columns the pitch {Do,Re,Mi,Fa,Sol,La,Si} So the relationships obtained from this table would be:

Each letter correspond to a tuple (duration, pitch). For example:

T -> (1,Do)

X -> (2,Mi)

B -> (4,La)

U -> (3,Si)

Learn by doing

Let's study this method starting from an example. Suppose we wanna encrypt the following quote:

“A sense of essence is, in essence, the essence of sense.”

Let's split the sentence into letters:

{ a,s, e, n, s, e, o, f, e, s, s, e, n, c, e, i, s, i, n, e, s, s, e, n, c, e, t, h, e, e, s, s, e, n, c, e, o, f, s, e, n, s, e }

We identify letters used: {a, s, e, n, o, f, c, i, t, h}

And map them to a tupple (pitch, time) according the table:

a -> (1,Mi) == E1

s -> (1,Fa) == F1

e -> (1,Sol)== G1

n -> (1,La) == A1

o -> (1,Si) == B1

f -> (4,Do) == C4

c -> (3,Re) == E3

t -> (1,Do) == C1

i -> (1,Re) == D1

h -> (3,Mi) == E3

For the cipher key, we are using some default values given by:

So, our sentence will be converted into:

E1 F1 G1 A1 F1 G1 B1 C4 G1 F1 F1 G1 A1 D3 G1 D1 F1 D1 A1 G1 F1 F1 G1 A1 D3 G1 C1 E3 G1 G1 F1 F1 G1 A1 D3 G1 B1 C4 F1 G1 A1 F1 G1

It looks like this (which may resemble to something more familiar to the musical world):

Understanding musical score in detail:

The tonic key used is C Major that's why it has no flats nor sharps.

But wait..


Using 4/4 meter means that the length of a single measure has duration of 4 units and each units length is given by the rhythym unit: 1/4.

Let's see our notes again and try to figure out where bars go:

The procedure will be: counting the duration of each note until we reach 4 and then draw a bar:

E1 F1 G1 A1 | ➡ So we have the first measure.

Let's keep on doing it with the following 4 notes:

F1 G1 B1 Oops~~~ we count 3 and the next (pitch, duration) is C4 which would imply adding 4 !?! But our meter was 4.

To resolve this we keep on adding notes to he measure andcounting durations as long as the counter is less than 4.

If not we fill the rest of the available units with silences completing the measure. And restart counter for next note.

F1 G1 B1 *Z1* | C4 |

And here it how it looks like.

Encrypt your text ⬇

Here there is a google collab I've been coding while I was writing this article

If you wanna try it with further customization of cipher key use this implementation. It will be the same procedure but with additional shifts for making the translations from musical notes (from the table) to a list of tuples of tones and rhythms (musical score).

this website is forked version of
⚡⚡⚡ view source