Text to Morse Code

Jan 24, 2011 at 8:37pm

Text to Morse Code

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

#54576
Jan 24, 2011 at 9:46pm

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.

#196548
Jan 24, 2011 at 11:00pm

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

#196549
Jan 24, 2011 at 11:17pm

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. –
#196550
Jan 25, 2011 at 5:20am

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.

#196551
Jan 25, 2011 at 8:38am

… or you can use [spell]
aa

#196552
Jan 25, 2011 at 11:13am

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. –
#196553
Jan 26, 2011 at 11:24pm

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

#196554

You must be logged in to reply to this topic.