MorseSharp 4.0.0
See the version list below for details.
dotnet add package MorseSharp --version 4.0.0
NuGet\Install-Package MorseSharp -Version 4.0.0
<PackageReference Include="MorseSharp" Version="4.0.0" />
paket add MorseSharp --version 4.0.0
#r "nuget: MorseSharp, 4.0.0"
// Install MorseSharp as a Cake Addin #addin nuget:?package=MorseSharp&version=4.0.0 // Install MorseSharp as a Cake Tool #tool nuget:?package=MorseSharp&version=4.0.0
MorseSharp
MorseSharp is a simple lightweight .NET library to encoding/decoding up to 8 languages including kurdish and generating audio morse.
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
- 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);
- Bytes for the generated wav audio can be recived by calling
MorseAudioConverter
's asynchronousConvertMorseToAudio
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
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- CommunityToolkit.HighPerformance (>= 8.2.2)
- ListPool (>= 2.3.6)
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.2 | 100 | 11/13/2024 | |
4.1.1 | 188 | 8/13/2024 | |
4.1.0 | 170 | 2/17/2024 | |
4.0.1 | 173 | 2/9/2024 | |
4.0.0 | 250 | 11/20/2023 | |
3.2.0 | 162 | 10/3/2023 | |
3.1.1 | 150 | 9/24/2023 | |
3.1.0 | 153 | 9/23/2023 | |
3.0.0 | 332 | 1/26/2023 | |
2.0.2 | 425 | 10/13/2022 | |
2.0.0 | 425 | 10/11/2022 | |
1.3.1 | 437 | 10/8/2022 | |
1.3.0 | 395 | 10/6/2022 | |
1.2.2 | 402 | 10/4/2022 | |
1.2.0 | 536 | 9/29/2022 | |
1.0.1 | 408 | 9/29/2022 | |
1.0.0 | 422 | 9/27/2022 |