2 min read

Converting a Haiku into Music using a Context Free Grammar

Converting a Haiku into Music using a Context Free Grammar

In a previous post, I discussed how I created a song from a grammar based on a verse from the Christian Bible.

In this post, I will demonstrate how I converted a Haiku into a song using a context free grammar.

Awake we can't see
Dreams are custom messages;
Nighttime is coming.

Here is the song:

Here is the Haiku expressed as the grammar that I used in my song:

########################################
Dreams_are_custom_messages
########################################
#
# by Michael Earls
# https://cerkit.com
#
# Using Mushroom Forest Pack in Reason
# https://share.reasonstudios.com/pack/347
########################################
Dreams_are_custom_messages -> Haiku
########################################

Haiku -> 5_1 7_1 5_2

5_1 -> Awake, we can't see  
7_1 -> Dreams are custom messages;
5_2 -> Nighttime is coming.


########A################################
# Word definitions 
########################################
Awake, -> 0 0
we -> 1
can't -> 2
see -> 3 
Dreams -> 4
are -> 5
custom -> 6 6
messages; -> 7 7 7
Nighttime -> 8 8
is -> 9
coming. -> 10 10

Each of the numbers represents a song section that I composed in Renoise. Each of those song sections is combined to create words and those words are combined to create the Haiku.

The first line of importance is the song name:

Dreams_are_custom_messages

This will look for the definition of that statement in the area below.

That is defined as the following:

Dreams_are_custom_messages -> Haiku

This is just a one-to-one mapping between the song name and the Haiku identifier.

Here is the Haiku

Haiku -> 5_1 7_1 5_2

The first line of the Haiku (`5_1` - 5 syllables, first instance) is as follows:

5_1 -> Awake, we can't see

You can then lookup each of the words in the line to get the song parts that are used for that line. I followed a rule that each word has as many repeated song sections as it does syllables, so a two syllable word will play the song section twice.

Awake, -> 0 0

This will play song section 0 twice (Awake is two syllables).

When the Renoam plugin Generates the song, it will generate the following song sections for the first line:

0 0 1 2 3

The rest of the Haiku is generated the same way.

I've had a lot of fun with the Renoam plugin for Renoise.

I have created a GitHub repository for my Musical Grammars.