MorseSharp 3.2.0
See the version list below for details.
dotnet add package MorseSharp --version 3.2.0
NuGet\Install-Package MorseSharp -Version 3.2.0
<PackageReference Include="MorseSharp" Version="3.2.0" />
paket add MorseSharp --version 3.2.0
#r "nuget: MorseSharp, 3.2.0"
// 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
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 | 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. |
-
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.2 | 81 | 11/13/2024 | |
4.1.1 | 179 | 8/13/2024 | |
4.1.0 | 163 | 2/17/2024 | |
4.0.1 | 165 | 2/9/2024 | |
4.0.0 | 244 | 11/20/2023 | |
3.2.0 | 158 | 10/3/2023 | |
3.1.1 | 146 | 9/24/2023 | |
3.1.0 | 150 | 9/23/2023 | |
3.0.0 | 328 | 1/26/2023 | |
2.0.2 | 418 | 10/13/2022 | |
2.0.0 | 419 | 10/11/2022 | |
1.3.1 | 433 | 10/8/2022 | |
1.3.0 | 390 | 10/6/2022 | |
1.2.2 | 395 | 10/4/2022 | |
1.2.0 | 529 | 9/29/2022 | |
1.0.1 | 401 | 9/29/2022 | |
1.0.0 | 415 | 9/27/2022 |