A comprehensive, high-performance Open Sound Control (OSC) 1.1 implementation for .NET with full binary and JSON serialization support.
- Full OSC 1.1 compliance with comprehensive type support
- Dual serialization: Binary OSC protocol and JSON serialization
- Multiple transport protocols: UDP, TCP, HTTP, and Named Pipes
- Reactive Extensions integration for event-driven applications
- Thread-safe and performance-optimized
- Comprehensive test coverage (193 tests, 100% coverage)
- Edge case handling: NaN, Infinity, large data sets
- Cross-platform compatibility (.NET 6.0+)
# Core library (required)
dotnet add package eDrive.OSC
# Network transport (for UDP, TCP, HTTP)
dotnet add package eDrive.OSC.Network
# Optional: Named Pipes (Windows)
dotnet add package eDrive.OSC.Network.NamedPipes
# Optional: Reactive Extensions
dotnet add package eDrive.OSC.Reactiveusing eDrive.OSC;
using eDrive.OSC.Network.Upd;
// Create and send an OSC message
var message = new OscMessage("/synth/freq", 440.0f);
var bytes = message.ToByteArray();
// UDP Transport
using var sender = new OscOutboundUpdStream("127.0.0.1", 9000);
await sender.SendAsync(message);
// Receive messages
using var receiver = new OscInboundUdpStream(9001);
receiver.PacketReceived += (sender, packet) => {
if (packet is OscMessage msg)
Console.WriteLine($"Received: {msg.Address} with {msg.Arguments.Count} args");
};
receiver.Start();// Serialize to JSON
var message = new OscMessage("/test", 42, "hello", true);
string json = message.ToJson();
// Deserialize from JSON
var restored = OscPacket.FromJson(json);// Create a bundle with multiple messages
var bundle = new OscBundle(OscTimeTag.Now)
{
new OscMessage("/synth/freq", 440.0f),
new OscMessage("/synth/amp", 0.8f),
new OscMessage("/synth/gate", true)
};
await sender.SendAsync(bundle);graph TD
A[eDrive OSC] --> B[Core OSC Implementation]
A --> C[Binary Serialization]
A --> D[JSON Serialization]
E[eDrive OSC Interfaces] --> F[IOscInboundStream]
E --> G[IOscOutboundStream]
H[eDrive OSC Network] --> I[UDP Transport]
H --> J[TCP Transport]
H --> K[HTTP Transport]
L[eDrive OSC Network NamedPipes] --> M[Named Pipes Transport]
N[eDrive OSC Reactive] --> O[Rx NET Integration]
A --> E
H --> E
L --> E
N --> A
- Core Library (eDrive.OSC) - OSC messages, bundles, and serialization
- Interfaces (eDrive.OSC.Interfaces) - Stream interfaces and contracts
- Network Transports (eDrive.OSC.Network) - UDP, TCP, and HTTP implementations
- Named Pipes (eDrive.OSC.Network.NamedPipes) - Windows Named Pipes transport
- Reactive Extensions (eDrive.OSC.Reactive) - Rx.NET integration patterns
| OSC Type | .NET Type | Tag | Binary | JSON |
|---|---|---|---|---|
| int32 | int |
i |
β | β |
| float32 | float |
f |
β | β |
| string | string |
s |
β | β |
| blob | byte[] |
b |
β | β |
| int64 | long |
h |
β | β |
| double | double |
d |
β | β |
| timetag | OscTimeTag |
t |
β | β |
| char | char |
c |
β | β |
| color | OscColour |
r |
β | β |
| midi | OscMidiMessage |
m |
β | β |
| symbol | OscSymbol |
S |
β | β |
| true | bool |
T |
β | β |
| false | bool |
F |
β | β |
| nil | null |
N |
β | β |
| infinitum | float.PositiveInfinity |
I |
β | β |
- 100% test coverage with 193 comprehensive tests
- Thread-safe implementations across all components
- Memory efficient with minimal allocations
- Edge case handling for NaN, Infinity, and large datasets
- Cross-platform compatibility (.NET 6.0, 7.0, 8.0)
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
eDrive.OSC - High-performance Open Sound Control for .NET