wcsng-sigmf
A Rust library for reading, writing, and validating SigMF (Signal Metadata Format) recordings, collections, and archives.
SigMF pairs a binary dataset of RF samples (.sigmf-data) with JSON metadata
(.sigmf-meta) that describes how the samples were captured. This crate
implements the SigMF 1.2 specification with an
emphasis on correctness and on preserving data it doesn't understand.
- Typed metadata.
global,captures, andannotationsare strongly typed. Unknown and extension fields round-trip unchanged. - Every datatype. Real and complex
f32/f64/i8/i16/i32/u8/u16/u32samples in either byte order, multi-channel datasets, and non-conforming datasets (NCD) with capture headers and trailing bytes. - Streaming I/O. Read frames by absolute sample index or iterate in fixed-size blocks without loading the whole dataset. Crop recordings while preserving sample indices.
- Archives and collections. Create and read
.sigmftar archives and.sigmf-collectionfiles, with SHA-512 integrity checks. - Safe writes. Files are written to a temporary sibling and published atomically. Existing files are never overwritten unless you ask.
- Validation. Policy-driven checks that return machine-readable issues with JSON pointers and remediation hints.
- Typed extensions. Map namespaced extension fields such as
lab:gain_dbto Rust structs with#[derive(SigmfExtension)].
Installation
The package is named wcsng-sigmf, and the library is imported as sigmf:
use Metadata;
Feature flags
| Feature | Description |
|---|---|
derive |
#[derive(SigmfExtension)] for typed metadata extensions. |
schema |
JSON Schema generation and validation for extensions. |
[]
= { = "0.1", = ["derive"] }
Usage
Read a recording
use Recording;
Write a recording
use Datatype;
use Global;
use Metadata;
use Complex;
use RecordingWriter;
use SampleValue;
use FromStr;
Archives
use Archive;
Use sigmf::ArchiveWriter to create archives.
Validation
use Metadata;
use ;
Typed extensions
With the derive feature:
use ;
use SigmfExtension;
metadata.set_global_extension?;
let receiver: LabReceiver = metadata.global_extension?;
Examples
Runnable programs are in examples/:
| Example | Description |
|---|---|
save_sigmf |
Build metadata and write a .sigmf archive. |
load_sigmf |
List the recordings in a .sigmf archive. |
load_recording |
Stream every frame of a .sigmf-meta/.sigmf-data pair. |
derive_extension |
Define, attach, and validate typed extensions (--features derive). |
Documentation
- API reference for the latest release: https://docs.rs/wcsng-sigmf
- API reference for
main: https://ucsdwcsng.github.io/oxidation/ - SigMF specification: https://sigmf.org
Build the docs locally with:
Minimum supported Rust version
Rust 1.89 or newer. Raising the MSRV is considered a minor change.
Contributing
Issues and pull requests are welcome. Before submitting, run:
See RELEASING.md for the release process.
License
Licensed under the MIT License. Developed by WCSNG at UC San Diego.