Forums > MaxMSP

Text to Morse Code

January 24, 2011 | 8:37 pm

I’ve got individual letters down using a route object then delay patterns to generate the sounds. My problem comes from trying to step through a text file letter per letter. I’m at a loss for how to do this, other than putting each letter on a separate line, which I don’t want to do.

Anyone have any solutions or help on how to step through even just a world letter for letter?

Thanks in advance


January 24, 2011 | 9:46 pm

funny – I just did this a month ago for a gig – but in Processing/Java (which is somewhat easier for text munging but poor for audio). In Max I’d send slabs of text into a JavaScript object to do string manipulation & send the individual letters out to the rest of your patch. You’ll want to strip punctuation as well.


January 24, 2011 | 11:00 pm

Sorry, I understand neither Processing nor Java, can you point me in a direction.


January 24, 2011 | 11:17 pm

Read through the text file line by line and send it through a [regexp] object as shown below. This should get you up and running in no time:

– Pasted Max Patch, click to expand. –

January 25, 2011 | 5:20 am

yeah cool. Since there’s no punctuation chars in morse code, use the following expression in the regexp object & it will just pass alphanumeric chars and spaces. Like Luke said – send it a line at a time.

([a-zA-z0-9\s])

You might want to use the space chars to trigger a little pause in the audio output.


January 25, 2011 | 8:38 am

… or you can use [spell]
aa


January 25, 2011 | 11:13 am

You won’t believe it, Max comes with a morse generator:
/Applications/Max5/Cycling ’74/java/help/MorseGen.maxhelp (on Mac, PC should be comparable)
Its a java class…
I also made one some time ago (unadapted Max 4 style, looks a bit unfinished and is, but sounds ok…)

– Pasted Max Patch, click to expand. –

January 26, 2011 | 11:24 pm

There is also some Morse Code gen routines and stuff in the ‘tom-swirly-max-javascript’ stuff . . .


Viewing 8 posts - 1 through 8 (of 8 total)