GGWavePlayerLib 1.0.1

dotnet add package GGWavePlayerLib --version 1.0.1
                    
NuGet\Install-Package GGWavePlayerLib -Version 1.0.1
                    
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="GGWavePlayerLib" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GGWavePlayerLib" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="GGWavePlayerLib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GGWavePlayerLib --version 1.0.1
                    
#r "nuget: GGWavePlayerLib, 1.0.1"
                    
#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.
#:package GGWavePlayerLib@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GGWavePlayerLib&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=GGWavePlayerLib&version=1.0.1
                    
Install as a Cake Tool

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 DecodeGGWave function outputs debug messages to the console when it works smoothly. This behavior comes from the underlying ggwave.net library 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:

πŸ“¦ 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 transmission
  • AudibleFastest - Fastest audible transmission

Ultrasound Protocols:

  • UltrasoundNormal - Standard ultrasound transmission
  • UltrasoundFast - Faster ultrasound transmission
  • UltrasoundFastest - Fastest ultrasound transmission

Dualtone Protocols:

  • DualtoneNormal - Standard dual-tone transmission
  • DualtoneFast - Faster dual-tone transmission
  • DualtoneFastest - Fastest dual-tone transmission

Monotone Protocols:

  • MonotoneNormal - Standard monotone transmission
  • MonotoneFast - Faster monotone transmission
  • MonotoneFastest - Fastest monotone transmission

Custom Protocols:

  • Custom0 through Custom9 - 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 play
  • waveRate - 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 save
  • waveRate - The sample rate for audio encoding (see GGWaveRate enum)
  • filePath - The path where the WAV file will be saved
  • 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 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

  1. Choose the Right Sample Rate:

    • Use StandardLow or StandardHigh for basic applications where file size matters
    • Use CDQuality for most general-purpose applications
    • Use Professional for high-fidelity applications
  2. Protocol Selection:

    • AudibleNormal is the default and works well for most cases
    • Use Fast or Fastest variants for quicker transmission
    • Use Ultrasound protocols for applications requiring inaudible transmission
    • Use Dualtone or Monotone for specific hardware compatibility
  3. Encoding:

    • Use ASCII (useUtf8:=False) for English text and basic characters
    • Use UTF-8 (useUtf8:=True) for international characters and emojis
  4. 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 PlayGGWave and SaveGGWave methods 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.1 113 3/13/2026
1.0.0 109 3/11/2026