MorseSharp 3.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MorseSharp --version 3.2.0
NuGet\Install-Package MorseSharp -Version 3.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MorseSharp" Version="3.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MorseSharp --version 3.2.0
#r "nuget: MorseSharp, 3.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MorseSharp as a Cake Addin
#addin nuget:?package=MorseSharp&version=3.2.0

// Install MorseSharp as a Cake Tool
#tool nuget:?package=MorseSharp&version=3.2.0

MorseSharp

Nuget GitHub release (latest SemVer)

MorseSharp is a simple lightweight .NET library to encoding/decoding up to 8 languages including kurdish and generating audio morse.

alt text

Installation

Use nuget package manager to install MorseSharp.

Install-Package MorseSharp

Usage

1. Text

You can decode/encode use MorseSharp just by instantiating TextMorseConverter class and pass 'Language' enum to specify the language.

using MorseSharp;
TextMorseConverter converter = new TextMorseConverter(Language.English);
Encoding

Calling ConvertTextToMorse method and pass the text to encode the morse:

using MorseSharp;
var morse = await converter.ConvertTextToMorse("Hello");
Decoding

Calling asynchronous methods ConvertMorseToText to decode the morse:

❗ Words must be separated by spaces, words by ( / ), Letters by space " ".

using MorseSharp;

var sentence = await converter.ConvertMorseToText(".... ...");

2. Generating audio

  1. To generate audio first you need to instantiate MorseAudioConverter, there are five overloaded constructor To configure audio options such as language and characters speed, word speed ,frequency. this WinForm example demonstrate the purpose:

MorseAudioConverter is just optimized wrapper of jstoddard's CWLibrary Library.

using MorseSharp;

MorseAudioConverter converter = new(Language.English,25,20,600);
//Or for kurdish language
//MorseAudioConverter converter = new(Language.Kurdish,25,20,600);

  1. Bytes for the generated wav audio can be recived by calling MorseAudioConverter's asynchronous ConvertMorseToAudio method:
try
{
   var morse = await converter.ConvertMorseToAudio("Hello Morse");
}
catch(Exception ex)
{
   MessageBox.Show(ex.Message);
}

3.After getting the bytes you can stream the bytes and play the sound, this example use's SoundPlayer object to play the sound:

SoundPlayer player = new();
using(Stream stream = new MemoryStream(morse))
{
   player.Stream = stream;
   player.PlayAsync();
}

Example

This piece of code encode and decode's the morse and then show it to the console:

using MorseSharp;
using MorseSharp.Converter;


TextMorseConverter Converter = new TextMorseConverter(Language.English);


string morse = string.Empty;
string text = string.Empty;

try
{
    morse = await Converter.ConvertTextToMorse("Hello World");
    text = await Converter.ConvertMorseToText(".... ..");
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

Console.WriteLine(morse);
Console.WriteLine(text);

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.1.0 112 2/17/2024
4.0.1 135 2/9/2024
4.0.0 206 11/20/2023
3.2.0 127 10/3/2023
3.1.1 121 9/24/2023
3.1.0 124 9/23/2023
3.0.0 296 1/26/2023
2.0.2 394 10/13/2022
2.0.0 385 10/11/2022
1.3.1 402 10/8/2022
1.3.0 361 10/6/2022
1.2.2 372 10/4/2022
1.2.0 499 9/29/2022
1.0.1 373 9/29/2022
1.0.0 389 9/27/2022