Skip to content

Commit

Permalink
fft: add the ability to change window functions for the fft.
Browse files Browse the repository at this point in the history
This allows us to see a few different aspects when looking at some of
the CW tests we are doing on the SOM.

Also make the number of samples more dynamic - so we can get more FFT
resolution.

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Aug 14, 2020
1 parent 6bdf1bb commit 230362a
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 20 deletions.
2 changes: 2 additions & 0 deletions datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct _fft_settings {
gfloat *real_source;
gfloat *imag_source;
unsigned int fft_size;
gchar *fft_win;
unsigned int fft_avg;
gfloat fft_pwr_off;
struct _fft_alg_data fft_alg_data;
Expand Down Expand Up @@ -174,6 +175,7 @@ struct _freq_spectrum_settings {
gfloat *imag_source;
gfloat *freq_axis_source;
gfloat *magn_axis_source;
gchar *fft_win;
unsigned freq_axis_size;
unsigned magn_axis_size;
unsigned fft_index;
Expand Down
60 changes: 52 additions & 8 deletions glade/oscplot.glade
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,37 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="fft_win">
<property name="can_focus">False</property>
<property name="active">2</property>
<property name="entry_text_column">0</property>
<items>
<item translatable="yes">Hanning</item>
<item translatable="yes">Boxcar</item>
<item translatable="yes">Triangular</item>
<item translatable="yes">Welch</item>
<item translatable="yes">Exact Blackman</item>
<item translatable="yes">Cosine</item>
<item translatable="yes">Hamming</item>
<item translatable="yes">3 Term Cosine</item>
<item translatable="yes">4 Term Cosine</item>
<item translatable="yes">5 Term Cosine</item>
<item translatable="yes">6 Term Cosine</item>
<item translatable="yes">7 Term Cosine</item>
<item translatable="yes">Blackman-Harris</item>
<item translatable="yes">Flat Top</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="fft_avg">
<property name="can_focus">True</property>
Expand All @@ -981,8 +1012,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
Expand All @@ -1003,8 +1034,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
Expand Down Expand Up @@ -1037,10 +1068,10 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="fft_avg_label">
<object class="GtkLabel" id="fft_win_label">
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Average:</property>
<property name="label" translatable="yes">Window:</property>
</object>
<packing>
<property name="top_attach">3</property>
Expand All @@ -1050,10 +1081,10 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="pwr_offset_label">
<object class="GtkLabel" id="fft_avg_label">
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">PWR Offset:</property>
<property name="label" translatable="yes">Average:</property>
</object>
<packing>
<property name="top_attach">4</property>
Expand All @@ -1062,6 +1093,19 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="pwr_offset_label">
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">PWR Offset:</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="sample_count">
<property name="visible">True</property>
Expand Down
Loading

0 comments on commit 230362a

Please sign in to comment.