coll / text: randomly placing blanks among words

flim's icon

hi!

I want to randomly place blanks among words (eventually used as prints for an art campaign) - which, of course, would take ages if taken care of manually:

julien donkey boy
j ulien don key boy
julien donke y b oy
juli en d onkey bo y
ju lien donkey b oy
julie n don key boy

etc

my approach doesn't work out at all. any better solutions?

cheers!

-jonas

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

To fix the [pack] problem in your patch you would have to string together multiple [zl join] objects but this doesn't scale well if you want to use more and more words.

Here's an example which does some of the string processing in javascript via [jstrigger] which will work for any number of words. It will either leave the word unchanged or put in one random space, just like in your example. It would be possible to have some sort of "extra spaces per letter" setting where longer words might contain more spaces than shorter ones. I hope it helps.

Max Patch
Copy patch and select New From Clipboard in Max.

lh

flim's icon

sheesh, thanks a bunch, luke..!

haven't worked with java objects yet -only used to jam some java back when I had a website-, so your approach is fairly new to me (and exciting)..!

the last hour I worked on a quite more cumbersome way of dealing with the blanks:
..an "automation" in letting my blanks wander amongst my words from left to right, separating two letters at a time, taking care of the actual work in my initial patch

thanks for taking your time & sharing.. (concise and effective patches give me goose bumps)

all the best!

-jonas

Max Patch
Copy patch and select New From Clipboard in Max.

ritmoloco's icon

Hi,
I was thinking if this it can be possible to do it in ina sound file? Add silences in a waveform~.....

thanks

Luke Hall's icon

The Jasch object library has some great externals for modifying strings. They might be worth looking at.

lh

Tj Shredder's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Another way to do it:

flim's icon

thanks for your attempt, stefan! I wish it'd been that easy..

but what I was looking for was 1 blank per word (at most) for each cycle/bang.. so luke's version does exactly suite my purpose..

in your patch, with each bang you'll possibly find several blanks in a word

but thanks anyways..! (for I'm still curious about wether this can be achieved without java - although I have NOTHING against java..!)

all the best

-jonas

Luke Hall's icon

Download the Jasch bundle I linked to and you can use [strlen] and [strrcut] to replace the javascript bits.

Max Patch
Copy patch and select New From Clipboard in Max.

lh

seejayjames's icon

@ritmloco: silences in a waveform~ can be done with peek~, but how you determine where to put them is up to you (as is everything!)

@flim: java != javascript
so js != mxj in Max.

javascript is a confusing nickname for the language, which is an implementation of "ECMAScript", and is unrelated to Java. But everyone knows it as "Javascript", so there you go...

more info, found on the best Web-programming resource site I've ever seen:

flim's icon

alright! :)

ritmoloco's icon

Ok guys! thanks luke and seejayjames for your advice!!

flim's icon

oops. how do I cope with sentences (respectively with the usage of punctuation marks as comma)?

I've tried it with
"sentence" (message)
[tosymbol]
[sprintf symout %s]
[fromsymbol]

but only got "weird" results.

cheers!

-jonas

flim's icon

in the end I went for your version, Luke, for Jasch's [strlen] and [strrcut] generate spaces even at the beginnings and at the ends of my words (causing double spaces between words).

I'm still seeking for a solution when it comes to the usage of punctuation marks as commas etc (going for sentences).. hence I'm torn between Stefan's approach, when using quotation marks (allowing commas etc - although its adjacent letters appear sticky) and Luke's nicely working js solution (which does exactly what I asked for)..

hybrid hints appreciated..!

all the best

-jonas

Max Patch
Copy patch and select New From Clipboard in Max.

Tj Shredder's icon
Max Patch
Copy patch and select New From Clipboard in Max.

My proposal was meant as a starting point. In Max you can achieve anything you need...
Another attempt: