Trying to make a morse code translator. How do I start?

maityog's icon

I'm trying to build a morse code translator for a small project, but I'm new to Max and I don't know where to start.
Specifically, there will be a button that will be pushed for a certain amount of time, reading as either dots or dashes in morse code, then being displayed as letters, and then print the message on screen after an enter button is pushed. Its almost like a morse code Instant Messenge. The users will have an alphabet to morse key next to them.

I know it sounds complicated, but I hope you guys can help, or at the very least offer suggestions on how I can approach something like this.

I'm currently using Max 6.1

Thanks

vichug's icon

first thing to do is to reduce your overall goal in tiny single parts. Then, start applying technical solutions you know in order to realize those parts. If there is part that you don't know how to realize, then subdivide it into even tinier parts, until the point were you can realize them. Or, if you can't do anything, identify what you need to learn in order to be able to do those things. Here :

-there must be a graphical, clic-able button
-it must send two different values, depending on the duration during which it is pressed
*so you need a way to measure that duration
*and to convert that duration into two different values
etc. etc...

how advanced are you in max ? this does not sound too complicated ; did you go through the built-in max tutorials ? there are not too many of them about the basics and interface building, and it's probably where you should start if you have no experience in max.

maityog's icon

Thanks Vichug. I'm still very new to Max, and although I have gone through most of the basic tutorials, I didn't know how difficult it may or may not be. I'm definitely going to take your advice on doing this step by step, it seems like the logical thing to do.

Mark Durham's icon

Without giving too much away - here's a few objects you may be interested in:

1. Ubutton - as it registers button up as well as button down.
2. Timer - for obvious reasons
3. > - Greater than
4. Select

Check out the help files for those if you're not familiar. They should get you to dash - dot detection. It's going to get a bit more complicated detecting individual letters and words, especially as your audience aren't trained in sending morse!

vichug's icon

aaah yiss indeed, recognizing dash or dot seems a daunting task... but you will have a first thing that will feel clonky, and improve it with time :) if you feel like it you can have clever gesture recognition algorithms involved. But that's for much later ;)

bertrandfraysse's icon

I'm pretty sure you already came across this, but in case you don't :

I created a morse code system in max a few years back, I can find it if you have problems to achieve it.

Mark Durham's icon

One possible approach for the OP (if you're still there!) is to build a patch which does the reverse - translates text into morse. I think this is easier and there would be plenty you would re-use for a morse - text device.

Looking at that chart I can also see an interesting morse driven music system ;) but that really is for another day...

Peter McCulloch's icon

I have a BEAP module that does that. I forget if I added it to Github yet.

Jan M's icon

Max also ships with a Java Class that does that: [mxj MorseGen]. It uses ms for timing, the original Morse code timing is WPM (Words Per Minute) or CPM (Characters Per Minute) but that's most likely not essential for your project.

J

Jan M's icon

In order to reliably detect Morse code input you would either need a quite trained Morser at the input or maybe simplify the the Morse code system a bit.
As already mentioned the input is a bit more tricky, as characters (and of course words) have different amount of dots and dashes. The end of a character and of a word is defined by the pause between them: The duration of a dash is three times the duration of a dot. Each dot or dash is followed by a short silence, equal to the dot duration. The letters of a word are separated by a space equal to three dots (one dash), and the words are separated by a space equal to seven dots.

You could change the detection of the end of a word/character not to be detected by timing but add to extra buttons to indicate the end of them.

To get started you could simplify it even more by working with for buttons: one for dot, one for dash plus end-of-character and end-of-word. Like this you don't have to deal with correct timing from the start. Once you have it going you can improve from there.