2019-06-20 08:15:47 (edited by dash 2019-06-20 08:16:41)

Hi.
Is there a morse decoder dll somewhere for free use wchich work with C#?

Mao!
--
TD programs website available under new address.
https://tdprograms.ovh/

2019-06-20 08:37:40

That depends. In what form is this morse code in? Recorded audio? Image data? Arrays?

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-06-20 10:32:44

He probably means audio as it's "recorded". That is the app we're both working on, I have found a solution however it requires me to do some crazy math to succeed. I can do that, but isn't there another way?

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-06-20 11:54:12 (edited by pauliyobo 2019-06-20 11:54:49)

you could look up the morse codes on wikipedia and create one your self. I was searching for one as well, but I figured it would have better to find the morse table. The problem is that the one I found wasn't quite understandable with a screen reader.

Paul

2019-06-20 12:07:45

Audio or text. We can convert audio to text.

Mao!
--
TD programs website available under new address.
https://tdprograms.ovh/

2019-06-20 13:02:09

I have written a Morse Text Decoder, if anyone is interested.

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-06-20 13:15:36

I'm quite interested, actually.

Paul

2019-06-20 13:19:49

Here you go.
The code is written in C#, and this is not a completely functional rpogram, as the decoder is part of something bigger.
Morse inserted to function must be space delimited

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Morse_Decoder
{
    public static class MorseMethods
    {
        public static Dictionary<string, char> morseCodeLookup = new Dictionary<string, char>()
        {
            [".-"] = 'a',
            ["-..."] = 'b',
            ["-.-."] = 'c',
            ["-.."] = 'd',
            ["."] = 'e',
            ["..-."] = 'f',
            ["--."] = 'g',
            ["...."] = 'h',
            [".."] = 'i',
            [".---"] = 'j',
            ["-.-"] = 'k',
            [".-.."] = 'l',
            ["--"] = 'm',
            ["-."] = 'n',
            ["---"] = 'o',
            [".--."] = 'p',
            ["--.-"] = 'q',
            [".-."] = 'r',
            ["..."] = 's',
            ["-"] = 't',
            ["..-"] = 'u',
            ["...-"] = 'v',
            [".--"] = 'w',
            ["-..-"] = 'x',
            ["-.--"] = 'y',
            ["--.."] = 'z',
            [".----"] = '1',
            ["..---"] = '2',
            ["...--"] = '3',
            ["....-"] = '4',
            ["....."] = '5',
            ["-...."] = '6',
            ["--..."] = '7',
            ["---.."] = '8',
            ["----."] = '9',
            ["-----"] = '0',
        };
        public static string DecodeText(string TextToDecode)
        {
            string Result = "";
            string Temp = "";
            string[] MorseTextSplit = TextToDecode.Split(' ');
            foreach (var item in MorseTextSplit)
            {
                try
                {
                    Result += morseCodeLookup[item];
                }
                catch
                {
    System.Windows.Forms.MessageBox.Show("The entered morse code cannot be recognized.", "Error",System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return "An error has occured";
                }
            }
            return Result;
        }
    }
}

If you want to contact me, do not use the forum PM. I respond once a year or two, when I need to write a PM myself. I apologize for the inconvenience.
Telegram: Nuno69a
E-Mail: nuno69a (at) gmail (dot) com

2019-06-20 13:38:58 (edited by pauliyobo 2019-06-20 13:46:41)

I see. Thanks.

Paul