GGWavePlayerLib 1.0.1
dotnet add package GGWavePlayerLib --version 1.0.1
NuGet\Install-Package GGWavePlayerLib -Version 1.0.1
<PackageReference Include="GGWavePlayerLib" Version="1.0.1" />
<PackageVersion Include="GGWavePlayerLib" Version="1.0.1" />
<PackageReference Include="GGWavePlayerLib" />
paket add GGWavePlayerLib --version 1.0.1
#r "nuget: GGWavePlayerLib, 1.0.1"
#:package GGWavePlayerLib@1.0.1
#addin nuget:?package=GGWavePlayerLib&version=1.0.1
#tool nuget:?package=GGWavePlayerLib&version=1.0.1
GGWavePlayerLib
A simple and elegant NuGet package that provides an easy way to play and save GGWave audio by encoding text messages into sound waves, built with VB.NET but fully compatible with C# and F#.
π Description
GGWavePlayerLib encapsulates the GGWave encoding, decoding, and audio playback logic from ggwave.net, eliminating the need for boilerplate code. With just a few lines of code, you can convert text messages into audio waves and play them through speakers, save them as WAV files, or decode audio waves back into text messages.
Note: The
DecodeGGWavefunction outputs debug messages to the console when it works smoothly. This behavior comes from the underlyingggwave.netlibrary and is not part of this wrapper library.
β¨ Features
- Play GGWave Audio - Directly play encoded messages through system speakers
- Save to WAV Files - Export encoded audio to standard WAV format
- Decode GGWave Audio - Convert audio waves back into text messages (NEW in version 1.0.1)
- Multiple Sample Rates - Choose from 4 different quality levels
- Protocol Support - Support for various GGWave protocols (audible, ultrasound, dualtone, monotone, and custom)
- Encoding Options - Support for both ASCII and UTF-8 text encoding
- Simple API - Clean, intuitive interface with minimal code required
π§ Requirements
- .NET 8.0 or higher (works with C#, F# and VB.NET)
- Dependencies:
- ggwave.net v0.2.1
- NAudio v2.2.1
π¦ Installation
Install the package via command line:
dotnet add package GGWavePlayerLib
Or using .NET CLI / Package Manager Console:
Install-Package GGWavePlayerLib
π Quick Start
Playing GGWave Audio
Imports GGWavePlayerLib
' Play a simple message with default settings
GGWavePlayer.PlayGGWave("Hello world!", GGWaveRate.CDQuality)
' Play with custom protocol and UTF-8 encoding
GGWavePlayer.PlayGGWave("εδΊεοΌδΈηοΌ",
GGWaveRate.Professional, ProtocolId.AudibleNormal, useUtf8:=True)
Saving GGWave to WAV File
Imports GGWavePlayerLib
' Save a message to a WAV file
GGWavePlayer.SaveGGWave("Secret message", GGWaveRate.CDQuality, "output.wav")
' Save with custom settings
GGWavePlayer.SaveGGWave(
"Important data", GGWaveRate.Professional, "important.wav",
ProtocolId.AudibleFastest, useUtf8:=False
)
Decoding GGWave Audio
Imports GGWavePlayerLib
' Decode audio bytes back to text
Dim audioBytes As Byte() = GGWavePlayer.PlayGGWave("Hello world!", GGWaveRate.CDQuality)
Dim decodedMessage As String = GGWavePlayer.DecodeGGWave(audioBytes, GGWaveRate.CDQuality)
Console.WriteLine($"Decoded message: {decodedMessage}")
' Decode from a WAV file (requires reading the file first)
Dim wavBytes As Byte() = File.ReadAllBytes("output.wav")
Dim decodedFromFile As String = GGWavePlayer.DecodeGGWave(wavBytes, GGWaveRate.CDQuality)
Console.WriteLine($"Decoded from file: {decodedFromFile}")
π API Reference
GGWaveRate Enum
Represents the audio sample rate for GGWave encoding. Higher rates provide better audio quality but require more bandwidth.
| Value | Sample Rate | Description |
|---|---|---|
StandardLow |
22.05 kHz | Standard low quality - suitable for basic transmission |
StandardHigh |
24 kHz | Standard high quality - good balance of quality and size |
CDQuality |
44.1 kHz | CD audio quality - most common choice for general use |
Professional |
48 kHz | Professional audio standard - highest quality available |
ProtocolId Enum
Represents the protocol ID for GGWave encoding. These values are wrapped from the original ggwave.net.Native.ProtocolId enum.
Audible Protocols:
AudibleNormal- Standard audible transmission (default)AudibleFast- Faster audible transmissionAudibleFastest- Fastest audible transmission
Ultrasound Protocols:
UltrasoundNormal- Standard ultrasound transmissionUltrasoundFast- Faster ultrasound transmissionUltrasoundFastest- Fastest ultrasound transmission
Dualtone Protocols:
DualtoneNormal- Standard dual-tone transmissionDualtoneFast- Faster dual-tone transmissionDualtoneFastest- Fastest dual-tone transmission
Monotone Protocols:
MonotoneNormal- Standard monotone transmissionMonotoneFast- Faster monotone transmissionMonotoneFastest- Fastest monotone transmission
Custom Protocols:
Custom0throughCustom9- Custom protocol configurations
PlayGGWave Method
Plays the GGWave audio for the given message through the system speakers, with the audio bytes returned to the caller.
Public Function PlayGGWave(
message As String, waveRate As GGWaveRate,
Optional protocolId As ProtocolId = ProtocolId.AudibleNormal,
Optional useUtf8 As Boolean = False
) As Byte()
Parameters:
message- The text message to encode and playwaveRate- The sample rate for audio encoding (see GGWaveRate enum)protocolId- The GGWave protocol to use (default: AudibleNormal)useUtf8- Whether to use UTF-8 encoding instead of ASCII (default: False)
Returns:
Byte()- The audio bytes that were played
SaveGGWave Method
Saves the GGWave audio for the given message to a WAV file, with the audio bytes returned to the caller.
Public Function SaveGGWave(
message As String, waveRate As GGWaveRate, filePath As String,
Optional protocolId As ProtocolId = ProtocolId.AudibleNormal,
Optional useUtf8 As Boolean = False
) As Byte()
Parameters:
message- The text message to encode and savewaveRate- The sample rate for audio encoding (see GGWaveRate enum)filePath- The path where the WAV file will be savedprotocolId- The GGWave protocol to use (default: AudibleNormal)useUtf8- Whether to use UTF-8 encoding instead of ASCII (default: False)
Returns:
Byte()- The audio bytes that were saved to the file
DecodeGGWave Method
Decodes GGWave audio bytes back into a text message.
Public Function DecodeGGWave(
audioBytes As Byte(), waveRate As GGWaveRate,
Optional protocolId As ProtocolId = ProtocolId.AudibleNormal
) As String
Parameters:
audioBytes- The audio bytes to decode (from PlayGGWave, SaveGGWave, or a WAV file)waveRate- The sample rate used for the original audio encoding (see GGWaveRate enum)protocolId- The GGWave protocol used for the original encoding (default: AudibleNormal)
Returns:
String- The decoded text message
π‘ Usage Tips
Choose the Right Sample Rate:
- Use
StandardLoworStandardHighfor basic applications where file size matters - Use
CDQualityfor most general-purpose applications - Use
Professionalfor high-fidelity applications
- Use
Protocol Selection:
AudibleNormalis the default and works well for most cases- Use
FastorFastestvariants for quicker transmission - Use
Ultrasoundprotocols for applications requiring inaudible transmission - Use
DualtoneorMonotonefor specific hardware compatibility
Encoding:
- Use ASCII (
useUtf8:=False) for English text and basic characters - Use UTF-8 (
useUtf8:=True) for international characters and emojis
- Use ASCII (
Decoding Best Practices:
- When decoding, use the same sample rate and protocol that was used for encoding
- For WAV file decoding, ensure the file contains valid GGWave audio data
- The
PlayGGWaveandSaveGGWavemethods now return audio bytes for easy decoding - Decoding works with both ASCII and UTF-8 encoded messages automatically
π License
This project is licensed under the MIT License. See the LICENSE file for details.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
π Support
If you encounter any issues or have questions, please open an issue on the project repository.
π Acknowledgments
- Built on top of the excellent ggwave.net library
- Audio playback powered by NAudio
- Based on the GGWave project by Georgi Gerganov
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- ggwave.net (>= 0.2.1)
- NAudio (>= 2.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.