Text to Morse Code

    Jan 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

    • Jan 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.
    • Jan 24 2011 | 11:00 pm
      Sorry, I understand neither Processing nor Java, can you point me in a direction.
    • Jan 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:
    • Jan 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.
      You might want to use the space chars to trigger a little pause in the audio output.
    • Jan 25 2011 | 8:38 am
      ... or you can use [spell] aa
    • Jan 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...)
    • Jan 26 2011 | 11:24 pm
      There is also some Morse Code gen routines and stuff in the 'tom-swirly-max-javascript' stuff . . .
    • Jul 05 2015 | 12:34 am
      Stefantiedje, first of all thanks for your code, I could not find any example in max 6 or 7 about morse (please let me know if I am wrong). I know it was long time ago but I am still interested on it. As it is pointed in another post the timing might have to be slightly adjusted but other than that gives a pretty good base for a text to code translator.
      However, I have one question about some object which is confusing me a bit. Why did you reverse the dots and dashes for each letter? that would read the code for each letter right to left instead of left to right but there might probably be something I am missing here..
      Thanks in advance
    • Jul 05 2015 | 5:53 am
      Juan, You are correct. Those letters which are not symmetrical in Morse are sent incorrectly by the patch. Best regards, Michael