In cryptography, a music cipher is an algorithm for the encryption of a plaintext into musical symbols or sounds. Music-based ciphers are related to, but not the same as musical cryptograms. The latter were systems used by composers to create musical themes or motifs to represent names based on similarities between letters of the alphabet and musical note names, such as the BACH motif, whereas music ciphers were systems typically used by cryptographers to hide or encode messages for reasons of secrecy or espionage.

Types There are a variety of different types of music ciphers as distinguished by both the method of encryption and the musical symbols used. Regarding the former, most are simple substitution ciphers with a one-to-one correspondence between individual letters of the alphabet and a specific musical note. There are also historical music ciphers that utilize homophonic substitution (one-to-many), polyphonic substitution (many-to-one), compound cipher symbols, and/or cipher keys; all of which can make the enciphered message more difficult to break.Code, David Løberg. 2023. "Can musical encryption be both? A survey of music-based ciphers." Cryptologia Volume 47 - Issue 4, p.320. Regarding the type of symbol used for substitution, most music ciphers utilize the pitch of a musical note as the primary cipher symbol. Since there are fewer notes in a standard musical scale (e.g., seven for diatonic scales and twelve for chromatic scales) than there are letters of the alphabet, cryptographers would often combine the note name with additional characteristics––such as octave register, rhythmic duration, or clef––to create a complete set of cipher symbols to match every letter. However, there are some music ciphers which rely exclusively on rhythm instead of pitchFriderici, Johann Balthasar. 1665. Cryptographia, p.181. or on relative scale degree names instead of absolute pitches.Öttingen-Wallerstein, Friedrich von. c.1600. Steganographia comitis.Sudre, François. 1866. Langue Musicale Universelle.Solfa Cipher. 2013. https://solfa-co.de

Musical steganography

Music ciphers often have both cryptographic and steganographic elements. Simply put, encryption is scrambling a message so that it is unreadable; steganography is hiding a message so no one knows it is even there. Most practitioners of music ciphers believed that encrypting text into musical symbols gave it added security because, if intercepted, most people would not even suspect that the sheet music contained a message. However, as Francesco Lana de Terzi notes, this is usually not because the resulting cipher melody appears to be a normal piece of music, but rather because so few people know enough about music to realize it is not ("ma gl'intelligenti di musica sono poci").Terzi, Francesco Lana de. 1670. Prodromo, ouero, Saggio di alcune inuentione nuoue, premesso all'arte maestra A message can also be visually hidden within a page of music without actually being a music cipher. William F. Friedman embedded a secret message based on Francis Bacon's cipher into a sheet music arrangement of Stephen Foster's "My Old Kentucky Home" by visually altering the appearance of the note stems.New York Public Library, Manuscripts and Archives Division. 1916. "My Old Kentucky Home, Good Night" The New York Public Library Digital Collections. https://digitalcollections.nypl.org/items/bd9b1e30-8607-0131-ac72-58d385a7b928Sherman, William H. 2010. "How to Make Anything Signify Anything," Cabinet Issue 40, https://www.cabinetmagazine.org/issues/40/sherman.php Another steganographic strategy is to musically encrypt a plaintext, but hide the message-bearing notes within a larger musical score that requires some visual marker that distinguishes them from the meaningless null-symbol notes (e.g., the cipher melody is only in the tenor line or only the notes with stems pointing down).Thicknesse, Philip. 1772. A treatise on the art of decyphering, and of writing in cypher. With an harmonic alphabet. W. Brown.Cazden, Norman. 1961. "How to Compose Non-Music," Perspectives of New Music, Vol. 5, No. 2, 287-296

The cipher manuscript from Agostino Amadi there is a musical score in 41v with a pseudo-letter ciphered in it, which is an imaginary letter that Venice writes to Charles V. Italian historian Paolo Preto. "...The emperor sent to prince Gritti, with whom he had been familiar for a long time, a music score that looked like a madrigal....The prince summoned Willaert and the other musicians and asked them to play the melody sent to them by emperor Charles V. When Willaert and the others carefully studied the score, they were unable to play it and confessed they could not understand it."Page f40v. from The Venetian Ciphers of Agostino Amadi, The Complete Manuscript. 1588.

Diatonic substitution ciphers

Diatonic music ciphers utilize only the seven basic note names of the diatonic scale: A, B, C, D, E, F, and G. While some systems reuse the same seven pitches for multiple letters (e.g., the pitch A can represent the letters A, H, O, or V),Écorcheville, Jules. 1909. "Homage à Joseph Haydn," Revue musicale S.I.M. Société internationale de musique. Online encoder: https://wmich.edu/mus-theo/ciphers/ecorcheville.html most algorithms combine these pitches with other musical attributes to achieve a one-to-one mapping. Perhaps the earliest documented music cipher is found in a manuscript from 1432 called "The Sermon Booklets of Friar Nicholas Philip." Philip's cipher uses only five pitches, but each note can appear with one of four different rhythmic durations, thus providing twenty distinct symbols.Philip, Nicholas. 1436. "The Sermon Booklets of Friar Nicholas Philip" MS Lat. th.d.I, Bodleian Library, Oxford. Online encoder: https://wmich.edu/mus-theo/ciphers/philip.html A similar cipher appears in a 15th-century British anonymous manuscriptBernard, Francis. c.1400. Sloan MS 351, British Library. as well as in a much later treatise by Giambattista della Porta.Porta, Giambattista della. 1602. De Furtivis Literarum Notis.

In editions of the same treatise (De Furtivis Literarum Notis), Porta also presents a simpler cipher which is much more well-known. Porta's music cipher maps the letters A through M (omitting J and K) onto a stepwise, ascending, octave-and-a-half scale of whole notes (semibreves); with the remainder of the alphabet (omitting V and W) onto a descending scale of half notes (minims).Porta Music Cipher, online encoder: https://wmich.edu/mus-theo/ciphers/porta.html Since alphabetic and scalar sequences are in such close step with each other, this is not a very strong method of encryption, nor are the melodies it produces very natural. Nevertheless, one finds slight variations of this same method employed throughout the 17th and 18th centuries by Daniel Schwenter (1602),Schwenter, Daniel. 1622. Steganologia & Steganographia Aucta. Online encoder: https://wmich.edu/mus-theo/ciphers/schwenter.html John Wilkins (1641),Wilkins, John. 1641. Mercury, or The Secret and Swift Messenger. Online encoder: https://wmich.edu/mus-theo/ciphers/wilkins.html Athanasius Kircher (1650),Kircher, Athanasius. 1650. Musurgia Universalis. Kaspar Schott (1655),Schott, Kaspar. 1655. Schola Steganographica. Philip Thicknesse (1722),Thicknesse, Philip. 1772. Online encoder: https://wmich.edu/mus-theo/ciphers/thicknesse.html and even the British Foreign Office (ca. 1750).Schooling, John Holt. 1896. “Secrets in Cipher I-IV”, Pall Mall Magazine, viii, 119-29 Online encoder: https://wmich.edu/mus-theo/ciphers/bfo.html

Chromatic substitution ciphers

Music ciphers based on the chromatic scale provide a larger pool of note names to match with letters of the alphabet. Applying sharps and flats to the seven diatonic pitches yields twenty-one unique cipher symbols. Since this is obviously still less than a standard alphabet, chromatic ciphers also require either a reduced letter set or additional features (e.g., octave register or duration). Most chromatic ciphers were developed by composers in the 20th Century when fully chromatic music itself was more common. A notable exception is a cipher attributed to the composer Michael Haydn (brother of the more famous Joseph Haydn).Rettensteiner, Werigand. 1808. Biographische Skizze von Michael Haydn. Online encoder: https://wmich.edu/mus-theo/ciphers/haydn.html Haydn's algorithm is one of the most comprehensive with symbols for thirty-one letters of the German alphabet, punctuations (using rest signs), parentheses (using clefs), and word segmentation (using bar lines). However, because many of the pitches are enharmonic equivalents, this cipher can only be transmitted as visual steganography, not via musical sound. For example, the notes C-sharp and D-flat are spelled differently, but they sound the same on a piano. As such, if one were listening to an enciphered melody, it would not be possible to hear the difference between the letters K and L. Furthermore, the purpose of this cipher was clearly not to generate musical themes that could pass for normal music. The use of such an extreme chromatic scale produces wildly dissonant, atonal melodies that would have been obviously atypical for Haydn's time.

20th-century ciphers Although chromatic ciphers did not seem to be favored by cryptographers, there are several 20th-century composers who developed systems for use in their own music: Arthur Honegger,Honegger, Arthur. 1928. Homage à Albert Roussel, H.69. Editions Salabert. Online encoder: https://wmich.edu/mus-theo/ciphers/honegger.html Maurice Duruflé,Duruflé, Maurice. 1942. Prélude et fugue sur le nom d'Alain, Op. 7. Online encoder: https://wmich.edu/mus-theo/ciphers/durufle.html Norman Cazden,Cazden, Norman. 1961. "How to Compose Non-Music," Perspectives of New Music, Vol. 5, No. 2, 287-296. Online encoder: https://wmich.edu/mus-theo/ciphers/cazden.html Olivier Messiaen,Messiaen, Olivier. 1969. Méditations sur le mystère de la Sainte Trinité. Online encoder: https://wmich.edu/mus-theo/ciphers/messiaen.html and Jacques Chailley.Chailley, Jacques. 1981. "Anagrammes Musicales Et "langages Communicables"." Revue De Musicologie 67, no. 1: 69-80. https://wmich.edu/mus-theo/ciphers/chailley.html. Similar to Haydn's cipher, most likewise match the alphabet sequentially onto a chromatic scale and rely on octave register to extend to twenty-six letters. Only Messiaen's appears to have been thoughtfully constructed to meet the composer's aesthetic goals. Although he also utilized different octave registers, the letters of the alphabet are not mapped in scalar order and also have distinct rhythmic values. Messiaen called his musical alphabet the langage communicable, and used it to embed extra-musical text throughout his organ work Méditations sur le Mystère de la Sainte Trinité.

21st-century ciphers A system that translates the Bible into music form was extensively developed by the artist John Three Sixteen in the 2020s. Each piece is originated by translating the Greek Bible letters into a musical form various musical scales. Various methodologies are used to maintain variety, the musicality of which develops from repeated phrasing from repeated or similar words.

Compound motivic ciphers

In a compound substitution cipher, each single plaintext letter is replaced by a block of multiple cipher symbols (e.g., 'a' = EN or 'b' = WJU). Similarly, there are compound music ciphers in which each letter is represented by a musical motive with two or more notes. In the case of the former, the compound symbols are to make frequency analysis more difficult; in the latter, the goal is to make the output more musical.