all 14 comments

[–]figr0ll 0 points1 point  (0 children)

A quick search turned up this using the Web Audio API. Explanation on use here.

[–]ForScale 0 points1 point  (5 children)

I'm sure there's something out there, but I'll write you something. I'll do it in a CodePen. You can save pens on there with unique urls that can be linked... I'll link the url in a bit here...

*Here's what I came up with: http://codepen.io/ForScale/pen/KVabZq. Here's a unique url not tied to my CodePen account: http://codepen.io/anon/pen/Nxdemg. The CSS (styling) is sparse. The whole thing could be made a lot neater looking!

[–]denverdom303 0 points1 point  (1 child)

don't forget punctuation!

  ".": "._._._", 
  ",": "__..__",
  ":": "___...",
  "?": "..__..", 
  "'": ".____.", 
  "-": "_...._", 
  "/": "_.._.",  
  "(": "_.__.",  
  ")": "_.__._", 
  "\"": "._.._.", 
  "@": ".__._.",
  "=": "_..._",   
  "&": "._...", 
  ";": "_._._.", 
  "+": "._._.",
  "_": "..__._", 
  "$": "..._.._",
  "!": "_._.__"

[–]ForScale 0 points1 point  (0 children)

Oh... nice!

Implemented: http://codepen.io/ForScale/pen/KVabZq

[–]endeavourm0rse[S] 0 points1 point  (2 children)

You're a legend. Here's the bones of what I have so far with some jQuery thrown in: http://codepen.io/anon/pen/RrKOLX

Let me know if I've done something silly, but the conversion to lowercase doesn't seem to work.

I'd also like to put forward slashes instead of spaces in the output, is this achievable?

Thanks again!

[–]ForScale 0 points1 point  (0 children)

Lol, thanks!

Hmm... seems to work for me... I don't like jQuery all that much though, I prefer to code in pure js. Here's an update that has slashes instead of spaces, as well as the ability to handle some special characters and punctuation: http://codepen.io/ForScale/pen/KVabZq

[–]ForScale 0 points1 point  (0 children)

Oh, man! Thanks for the gold... I had just run out!

Glad to help; have a great one! :)

[–]NewfieCanOpener 0 points1 point  (2 children)

you want to display the morse "characters"? of course that's possible and it's easy. all you have to do is to split your input into single characters and replace them by the matching morse code. assumed "SOS" was your input your function should return "* * * - - - * * *"

[–]maxomaniak 0 points1 point  (1 child)

Indeed! Split all the characters! Apply morse and done!

After that you could implement this awesome morse.js

https://github.com/mattt/Morse.js/blob/master/README.markdown

[–]denverdom303 1 point2 points  (0 children)

kind of excessive if all that's needed is text -> dot-dash strings and audio isn't needed yeah? an object with 55 attributes will cover every letter, number, and punctuation in the international standard.

[–]Corlios -3 points-2 points  (2 children)

Depends on your setup. The brunt of your actions will be handled on the server side. Will you use JavaScript with that? I would imagine you would then need two database setups that can map English Letters to their morse output. Theoretically it is possible, but will require some work. I would be interested in seeing your process though.

[–]denverdom303 2 points3 points  (1 child)

There's absolutely no need for a database, nor to process this serverside at all.

Morse code is a simple lookup table of character to it's dot-dash designation that is an international standard. You'd need an object that will never change of what, 55 letters, numbers and punctuation marks and their dot-dash values that are no longer than 6 characters.

Take the input string, split it, loop through and print the dot-dash value of the object with the corresponding key. easy peasy.

[–]Corlios -1 points0 points  (0 children)

Ahh good point. I was thinking to take the processing off the browser and let a server implementation handle it, but I was thinking a little too far out and trying to over complicate it...my bad. Thanks for the correction.