Random Poems on MAX

My first encounter experimenting in MAX and generating random poems

September 25, 2023

As someone new to MAX, I tried to relate object-oriented programming concepts to the available elements. However, I realized, MAX objects can operate under constantly changing inputs and variables.

Structure of poem

I decided to create my poem in parts, as pairs of lines. The first part would be random thoughts and feelings and the second part would either be adjectives, descriptions, or nouns. Based on the first line and how it ends, the second line would be determined. 

Where will my words live?

I needed to find objects in MAX that could store my list of words. First, is the coll object, which can store a 2D matrix of items. I can input the items or phrases that will start off my sentence into the coll object I named begin when the patch starts.

The other object is the umenu which acts as a drop-down list of items. I decided to put my descriptions and phrases in this object.

Accessing coll randomly

To access coll uniquely and randomly and in a repeating loop I used the urn object that clears out after 7 steps. It proved helpful to use the coll object since I can access the rows of items using row numbers.

Trying something new...

Next, I wanted to experiment with the zl object to see how many ways I can manipulate a list. I placed some nouns in a message and tried to output some randomly.

I also found in one of Luke’s 10 tutorials an interesting method using counter and set objects to manipulate the metro object, which I used to output a random adjective that will append or pack with the previous noun.

Conditions

The final challenge was to determine which of the second parts/lines would be triggered based on the first part. The coll row indexing helped with creating the if-else statements.

Frustrating errors

Ofcourse, out of the many frustrating bugs, the if-else statement was not working properly, outputting both the second parts that I wanted to separate. I used the toggle at first, and still cannot figure out why it didn’t work. So I tried with the set object and it worked as planned. I should probably try debugging the previous version to know what went wrong.

Final result

So the final scary looking network now looks like the this. I cleaned up the design after realizing I was using separate metro objects and connected them all to one, triggered by one toggle. 

Scope for improvement

There are some places where my lines repeat or don’t follow the intended sequence which I can fix given more time. I tried using delay objects with the metro to fix this problem but have yet to come up with a solution.