Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow recording IQ samples in the SigMF format #1182

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

Niautanor
Copy link
Contributor

This implements part 1 of #988. Users can choose between the old format (raw) and SigMF with a chooser in the iq tool window.

Since SigMF keeps metadata and signal data separate, the actual recording remains unchanged regardless of which format is selected (except for the file name). For this reason, .sigmf-data files are made available for playback in the iq tool as well (this does not work in the general case (yet) but .raw isn't super well defined either).

One potential improvement would be to do some refactoring to separate formats into different classes that can be interacted with during the recording. This would 1. more cleanly separate the code paths for raw and sigmf recordings and 2. allow adding more metadata during the recording (e.g. we could start a new capture object when we tune the radio to a different frequency or change the gain).

@vladisslav2011
Copy link
Contributor

Hello.
Build log:

$ make -j33
[  1%] Automatic MOC for target gqrx
[  1%] Built target gqrx_autogen
[  2%] Generating ui_audio_options.h
[  4%] Generating ui_afsk1200win.h
[  4%] Generating ui_remote_control_settings.h
[  6%] Generating ui_demod_options.h
[  8%] Generating ui_dxc_options.h
[  8%] Generating ui_nb_options.h
[  9%] Generating ui_dockbookmarks.h
[ 12%] Generating ui_dockrds.h
[ 12%] Generating qrc_icons.cpp
[ 13%] Generating ui_dockinputctl.h
[ 15%] Generating ui_ioconfig.h
[ 19%] Generating ui_mainwindow.h
[ 19%] Generating ui_iq_tool.h
[ 19%] Generating qrc_textfiles.cpp
[ 21%] Generating ui_dockrxopt.h
[ 21%] Generating ui_dockfft.h
[ 21%] Generating ui_agc_options.h
[ 23%] Generating ui_dockaudio.h
Scanning dependencies of target gqrx
[ 24%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/mainwindow.cpp.o
[ 26%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/remote_control.cpp.o
[ 28%] Building CXX object src/CMakeFiles/gqrx.dir/gqrx_autogen/mocs_compilation.cpp.o
[ 28%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/main.cpp.o
[ 29%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/filter/fir_decim.cpp.o
[ 30%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/remote_control_settings.cpp.o
[ 31%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/receiver.cpp.o
[ 32%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rds/decoder_impl.cc.o
[ 34%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/file_resources.cpp.o
[ 35%] Building C object src/CMakeFiles/gqrx.dir/dsp/afsk1200/costabf.c.o
[ 36%] Building CXX object src/CMakeFiles/gqrx.dir/applications/gqrx/recentconfig.cpp.o
[ 37%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/fm_deemph.cpp.o
[ 39%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/correct_iq_cc.cpp.o
[ 41%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/resampler_xx.cpp.o
[ 41%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/lpf.cpp.o
[ 43%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/downconverter.cpp.o
[ 43%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/afsk1200/cafsk12.cpp.o
[ 45%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_agc_xx.cpp.o
[ 47%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_demod_am.cpp.o
[ 48%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rds/parser_impl.cc.o
[ 48%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_demod_fm.cpp.o
[ 50%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_noise_blanker_cc.cpp.o
[ 51%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/agc_impl.cpp.o
[ 52%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_fft.cpp.o
[ 53%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_meter.cpp.o
[ 54%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/sniffer_f.cpp.o
[ 57%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_rds.cpp.o
[ 57%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/rx_filter.cpp.o
[ 59%] Building CXX object src/CMakeFiles/gqrx.dir/interfaces/udp_sink_f.cpp.o
[ 59%] Building CXX object src/CMakeFiles/gqrx.dir/dsp/stereo_demod.cpp.o
[ 60%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/agc_options.cpp.o
[ 62%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/afsk1200win.cpp.o
[ 63%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/audio_options.cpp.o
[ 64%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/bandplan.cpp.o
[ 65%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/bookmarks.cpp.o
[ 67%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/bookmarkstablemodel.cpp.o
[ 68%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/bookmarkstaglist.cpp.o
[ 69%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/ctk/ctkRangeSlider.cpp.o
[ 70%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/demod_options.cpp.o
[ 71%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dockaudio.cpp.o
[ 73%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dockbookmarks.cpp.o
[ 74%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dockfft.cpp.o
[ 75%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dockinputctl.cpp.o
[ 76%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dockrds.cpp.o
[ 78%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dockrxopt.cpp.o
[ 79%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dxc_options.cpp.o
[ 80%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/dxc_spots.cpp.o
[ 81%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/freqctrl.cpp.o
[ 82%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/ioconfig.cpp.o
[ 84%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/iq_tool.cpp.o
/home/vlad/warez/gqrx-my/src/applications/gqrx/mainwindow.cpp: In member function 'void MainWindow::startIqRecording(const QString&, const QString&)':
/home/vlad/warez/gqrx-my/src/applications/gqrx/mainwindow.cpp:1557:61: error: 'QFile::QFile(const QFile&)' is private within this context
     auto metaFile = QFile(filenameTemplate.arg("sigmf-meta"));
                                                             ^
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:43:0,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:48,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:46,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qsettings.h:43,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QSettings:1,
                 from /home/vlad/warez/gqrx-my/src/applications/gqrx/mainwindow.cpp:28:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qfile.h:149:5: note: declared private here
     Q_DISABLE_COPY(QFile)
     ^
/home/vlad/warez/gqrx-my/src/applications/gqrx/mainwindow.cpp:1557:61: error: use of deleted function 'QFile::QFile(const QFile&)'
     auto metaFile = QFile(filenameTemplate.arg("sigmf-meta"));
                                                             ^
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:43:0,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:48,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:46,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qsettings.h:43,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QSettings:1,
                 from /home/vlad/warez/gqrx-my/src/applications/gqrx/mainwindow.cpp:28:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qfile.h:149:5: note: declared here
     Q_DISABLE_COPY(QFile)
     ^
[ 85%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/meter.cpp.o
[ 86%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/nb_options.cpp.o
[ 87%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/plotter.cpp.o
[ 89%] Building CXX object src/CMakeFiles/gqrx.dir/qtgui/qtcolorpicker.cpp.o
[ 90%] Building CXX object src/CMakeFiles/gqrx.dir/receivers/nbrx.cpp.o
[ 91%] Building CXX object src/CMakeFiles/gqrx.dir/receivers/receiver_base.cpp.o
[ 92%] Building CXX object src/CMakeFiles/gqrx.dir/receivers/wfmrx.cpp.o
[ 93%] Building CXX object src/CMakeFiles/gqrx.dir/pulseaudio/pa_device_list.cc.o
[ 95%] Building CXX object src/CMakeFiles/gqrx.dir/pulseaudio/pa_sink.cc.o
[ 96%] Building CXX object src/CMakeFiles/gqrx.dir/pulseaudio/pa_source.cc.o
[ 97%] Building CXX object src/CMakeFiles/gqrx.dir/qrc_icons.cpp.o
[ 98%] Building CXX object src/CMakeFiles/gqrx.dir/qrc_textfiles.cpp.o
src/CMakeFiles/gqrx.dir/build.make:204: recipe for target 'src/CMakeFiles/gqrx.dir/applications/gqrx/mainwindow.cpp.o' failed
make[2]: *** [src/CMakeFiles/gqrx.dir/applications/gqrx/mainwindow.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:266: recipe for target 'src/CMakeFiles/gqrx.dir/all' failed
make[1]: *** [src/CMakeFiles/gqrx.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
make: *** [all] Error 2

@Niautanor
Copy link
Contributor Author

Huh. It built fine on my Arch machine but I just tested it again on Ubuntu and was able to reproduce that issue.

I think this might be because Arch defaults to C++17 (where X a = X() is not a copy) and Ubuntu defaults to C++14 (where it is). If that is the issue then it should be easy to fix.

Niautanor added a commit to Niautanor/gqrx that referenced this pull request Jan 16, 2023
@Niautanor
Copy link
Contributor Author

That issue should be fixed with the new commit.

@vladisslav2011
Copy link
Contributor

Confirmed. It builds and writes .sigmf-meta file.
The next step may by reading sample rate/center frequency from .sigmf-meta on file selection.

@argilo argilo added the feature label Mar 25, 2023
@argilo
Copy link
Member

argilo commented Oct 2, 2023

Thanks for this, and sorry for the long delay in looking at it. I'm starting to have a peek now. I'd love to see at least partial SigMF support in the next Gqrx release.

@Niautanor
Copy link
Contributor Author

Thank you for having a look. Let me know if there is anything else that I can do for this. I took this as far as I needed for my use case at the time but I'm happy to do more work on this if there is interest.

@argilo
Copy link
Member

argilo commented Oct 5, 2023

It might be nice to store the device name and/or device string in the core:hw field. I'm not sure it's easy to get at though, so it would be fine to leave that for a future PR.

@argilo
Copy link
Member

argilo commented Oct 6, 2023

I merged the suggestions, rebased, and updated the news & contributors list. I'll merge once CI is happy.

@argilo argilo merged commit ef84e43 into gqrx-sdr:master Oct 6, 2023
10 checks passed
@argilo
Copy link
Member

argilo commented Oct 6, 2023

A couple more things we could potentially include in sigmf-meta:

  • capture_details:gain
    • could be retrieved with receiver::get_gain_names followed by summing the values of receiver::get_gain
    • would only be correct if gain is not adjusted during the recording, but this should be the case in most recordings
  • capture_details:acquisition_bandwidth
    • could be retrieved with receiver::get_analog_bandwidth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants