@@ -221,6 +221,7 @@ def __init__(self, sounddevice_idx, channels, fs, fft_size, out_path):
221221 self .fs = fs
222222 self .fft_size = fft_size
223223 self .out_path = out_path
224+ self .f0_algorithms = ["SWIPE" , "YIN" ]
224225 self .buf_len_sec = 30.0 # sec
225226 self .spec_scale_types = ["log" , "linear" ]
226227 self .ref_freq_modes = ["fixed" , "highest" , "lowest" ]
@@ -243,7 +244,7 @@ def __init__(self, sounddevice_idx, channels, fs, fft_size, out_path):
243244 self .cur_spec_scale_type = self .spec_scale_types [0 ]
244245 self .cur_ref_freq_mode = self .ref_freq_modes [0 ]
245246 self .cur_ref_freq = 220 # Hz
246- self .cur_conf_threshold = 0.5
247+ self .cur_conf_threshold = 0.2
247248 self .cur_gradient_tol = 600 # Cents
248249 self .cur_smoothing_len = 3 # bins
249250 self .gui_refresh_ms = int (np .round (1000 / 60 )) # 60 fps
@@ -270,6 +271,7 @@ def __init__(self, sounddevice_idx, channels, fs, fft_size, out_path):
270271 fft_len = self .fft_size ,
271272 channels = self .channels ,
272273 device_no = self .sounddevice_idx ,
274+ f0_algorithm = self .f0_algorithms [0 ],
273275 out_path = out_path ,
274276 )
275277
@@ -473,6 +475,13 @@ def __init__(self, main_window: MainWindow):
473475 )
474476 layout .addWidget (self .box_show_tv , 10 , 1 , 1 , 1 )
475477
478+ layout .addWidget (qw .QLabel ("F0 Algorithm" ), 11 , 0 )
479+ self .select_algorithm = qw .QComboBox (self )
480+ self .select_algorithm .addItems (main_window .f0_algorithms )
481+ self .select_algorithm .setCurrentIndex (0 )
482+ self .select_algorithm .currentTextChanged .connect (self .on_algorithm_select )
483+ layout .addWidget (self .select_algorithm , 11 , 1 , 1 , 1 )
484+
476485 layout .addWidget (qw .QLabel ("Confidence Threshold" ), 12 , 0 )
477486 self .noise_thresh_slider = qw .QSlider ()
478487 self .noise_thresh_slider .setRange (0 , 10 )
@@ -552,6 +561,10 @@ def on_max_freq_changed(self, f):
552561 self .main_window .cur_disp_freq_lims
553562 )
554563
564+ def on_algorithm_select (self , algorithm ):
565+ """Update function for F0 algorithm on user interaction."""
566+ self .main_window .audio_processor .f0_algorithm = algorithm
567+
555568 def on_conf_threshold_changed (self , val ):
556569 """Update function for confidence threshold on user interaction."""
557570 self .noise_thresh_label .setText (str (val / 10.0 ))
0 commit comments