Create a Poem with Max – 2

After the first poem writing, I went on to improve and augment the poem. My updated max patch can be downloaded from here.

  • I added more lines after the first version of the poem to make it more interesting.
  • I solved the initialization problem of the poem.
  • The poem is now of finite length.

Recording of the poem

Screenshot of the updated patch

Problems & Solutions

Problem 1: List initialization

Upon several rounds of testing, I confirmed that the initialization issue still arises occasionally. After going through some online forums, I learned that it might be the problem of the object “zl lookup”. When the list is very long, it is better to use a “umenu” object and set it to mode 2.

“umenu” help file writes that Scrolling mode (mode 2) can be used for gigantic lists.

Therefore, I replaced all the “zl lookup” previously used with “umenu”. This is followed by a change in word messages, as the two objects take in different structures of messages. To control the length of a umenu, a “clear” message is sent to it at the beginning of the program.

Problem 2: “pack” vs. “join”

While “pack” and “join” have similar functions, they operate differently in my case. I initially used “pack” but the program sometimes left out the last word. Below is an example of my input into the “pack” object:

  • Input 1: The
  • Input 2: futuristic
  • Input 3: sea turtle
  • Input 4: swims

This is because I used “pack s s s s”. For my input 3, it is not a single word but a phrase, which contains a space. In this case, “pack” will take it in as two strings, so the last input will not come out. One way to bypass the rule is to enclose a phrase input with a pair of double quotation marks. However, the output will also contain the quotation mark, which is undesirable.

All the quotation marks will be printed out together with the phrase inputs.

I went to the online forums again to find solutions and found that “join” may be the right object for my poem. “join” will dedicatedly connect all the inputs, regardless of whether they contain spaces or not. I replaced all the “pack”s with “join”s and the program finally output the full sentences I wanted.

Leave a Reply

Your email address will not be published. Required fields are marked *