sigmf / sigmf-python

Easily interact with Signal Metadata Format (SigMF) recordings.
https://sigmf.org
GNU Lesser General Public License v3.0
42 stars 16 forks source link

Support converters for Wav & ? #23

Open Teque5 opened 1 year ago

Teque5 commented 1 year ago

A long time ago we decided against doing this when the repos all lived in SigMF, but we should re-assess.

At GRCon23 we discussed adding converters for common formats (not metadata formats like issue #14) to include wav and other common time-series formats. Which formats would we like?

777arc commented 1 year ago

Yep, IQEngine was planning to add converters, so they could either live in this repo or in the IQEngine repo. It would be all python-based converters and IQEngine would provide a page where someone can upload their non-sigmf recording and it will download the sigmf-meta. Then for folks with sensitive recordings they can simply run the python converters manually.

Teque5 commented 1 year ago

In my brain this will work like this(?):

# x is abc.wav, xyz.mp3, uvw.opus, qwe.flac
import sigmf
handle = sigmf.sigmffile.fromfile(x)
# handle now has interpreted metadata from the file, and checksum etc
samples = handle.read_samples()
handle.validate() # will pass correctly
# you can write this to sigmf archive or whatever
handle.toarchive('abc.sigmf')

If this looks good I could work up a demo pretty fast. I'm still unsure if we want to house such a converter in this repo, but it won't be that much code. There may be some lookup tables or other cumbersome things needed for the converters, but it might not be too bad.

777arc commented 1 year ago

Ideally there would be a python script someone can run, providing their original format as input and it generates the SigMF files

Teque5 commented 1 year ago

Ideally there would be a python script someone can run, providing their original format as input and it generates the SigMF files

This is trivial by using the entry_points in the setup.py, but that kind of fully automated implementation would have to make some guesses that might be tricky.

Imagine if someone converts a 2-channel wav file. Do we assume this is I, Q or just a 2 channel real file. What about a 3 or 4 channel wav?

777arc commented 1 year ago

I think each converter is going to have some params