Skip to content

Commit c98c314

Browse files
committed
Add new features and bug fixes
- Separated ‘Headphone Compensation’ parameter into ‘Driver-to-Ear Interaction’ and ‘Loudness Compensation’ - Updated acoustic space import with additional parameters for fine tuning of time domain alignment and a seed parameter to allow for reproducible results - Added backwards compatibility for acoustic spaces generated in versions prior to 4.0.0 - Added option in advanced settings to control length of FIR compensation filters - Enhancements made to many existing acoustic spaces
1 parent c4a3300 commit c98c314

7 files changed

Lines changed: 806 additions & 591 deletions

File tree

ash_toolset/__main__.py

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,8 @@ def get_screen_size(default_width=1722, default_height=717):
721721
VALIDATION_MAP = {
722722
"acoustic_space": CN.AC_SPACE_LIST_GUI,
723723
"room_target": CN.ROOM_TARGET_LIST,
724-
"brir_hp_type": CN.HP_COMP_LIST,
724+
"brir_hp_comp": CN.HP_COMP_LIST,
725+
"brir_elf": CN.ELF_LIST,
725726
"sub_response": CN.SUB_RESPONSE_LIST_GUI,
726727
"e_apo_prevent_clip": CN.AUTO_GAIN_METHODS,
727728
"e_apo_upmix_method": CN.UPMIXING_METHODS
@@ -1149,14 +1150,22 @@ def get_screen_size(default_width=1722, default_height=717):
11491150
with dpg.tooltip("rm_target_title"):
11501151
dpg.add_text("This will influence the overall balance of low and high frequencies")
11511152
dpg.add_separator()
1152-
dpg.add_text("Headphone Compensation", tag='brir_hp_type_title')
1153-
dpg.bind_item_font(dpg.last_item(), font_b_def)
1154-
dpg.add_listbox(CN.HP_COMP_LIST, default_value=loaded_values["brir_hp_type"], num_items=5, width=345, callback=cb.select_hp_comp, tag='brir_hp_type')
1155-
with dpg.tooltip("brir_hp_type_title"):
1156-
dpg.add_text("This will compensate typical interactions between the headphone and the outer ear")
1157-
dpg.add_text("Selection should align with the listener's headphone type")
1158-
dpg.add_text("Reduce to low strength if sound localisation or timbre is compromised")
1159-
1153+
with dpg.group(horizontal=True):
1154+
with dpg.group():
1155+
dpg.add_text("Driver-to-Ear Interaction", tag='brir_hp_type_title')
1156+
dpg.bind_item_font(dpg.last_item(), font_b_def)
1157+
dpg.add_listbox(CN.HP_COMP_LIST, default_value=loaded_values["brir_hp_comp"], num_items=5, width=250, callback=cb.select_hp_comp, tag='brir_hp_comp')
1158+
with dpg.tooltip("brir_hp_type_title"):
1159+
dpg.add_text("This compensates for acoustic interaction between the headphone driver and the outer ear (pinna)")
1160+
dpg.add_text("Establishes a neutral baseline for accurate HRTF spatialization and externalization")
1161+
with dpg.group():
1162+
dpg.add_text("Loudness Compensation", tag='brir_elf_title')
1163+
dpg.bind_item_font(dpg.last_item(), font_b_def)
1164+
dpg.add_listbox(CN.ELF_LIST, default_value=loaded_values["brir_elf"], num_items=5, width=250, callback=cb.select_elf, tag='brir_elf')
1165+
with dpg.tooltip("brir_elf_title"):
1166+
dpg.add_text("This can be used to adjust tonal balance according to human equal-loudness perception")
1167+
dpg.add_text("Compensates for frequency-dependent hearing sensitivity at different listening levels")
1168+
dpg.add_text("Low frequencies are not adjusted")
11601169

11611170

11621171
with dpg.tab(label="Low-frequency Extension",tag='lfe_tab', parent="brir_tab_bar"):
@@ -2092,8 +2101,34 @@ def get_screen_size(default_width=1722, default_height=717):
20922101

20932102
dpg.add_input_int(tag="as_alignment_freq",width=120,default_value=loaded_values["as_alignment_freq"],min_value=50,max_value=150)
20942103
with dpg.tooltip("as_alignment_freq"):
2095-
dpg.add_text("Low-pass cutoff used for time-domain alignment")
2104+
dpg.add_text("Low-pass cutoff used for time-domain alignment. The frequency used to isolate low-end phase information for timing calculations")
20962105
dpg.add_text("Min: 50 Hz, Max: 150 Hz")
2106+
2107+
# ---------- Shift Range ----------
2108+
with dpg.table_row():
2109+
dpg.add_text("Min. Shift Limit")
2110+
dpg.bind_item_font(dpg.last_item(), font_b_def)
2111+
with dpg.group():
2112+
dpg.add_input_float(label="",tag="as_time_shift_min",width=120,default_value=loaded_values["as_time_shift_min"],min_value=-6.0,max_value=-1.0,format="%.2f",min_clamped=True,max_clamped=True)
2113+
with dpg.tooltip("as_time_shift_min"):
2114+
dpg.add_text("Maximum negative time shift allowed (in half-cycles) to achieve phase alignment")
2115+
2116+
with dpg.table_row():
2117+
dpg.add_text("Max. Shift Limit")
2118+
dpg.bind_item_font(dpg.last_item(), font_b_def)
2119+
with dpg.group():
2120+
dpg.add_input_float(label="",tag="as_time_shift_max",width=120,default_value=loaded_values["as_time_shift_max"],min_value=0.0,max_value=6.0,format="%.2f",min_clamped=True,max_clamped=True)
2121+
with dpg.tooltip("as_time_shift_max"):
2122+
dpg.add_text("Maximum positive time shift allowed (in half-cycles) to achieve phase alignment")
2123+
2124+
with dpg.table_row():
2125+
dpg.add_text("Search Offset (Samples)")
2126+
dpg.bind_item_font(dpg.last_item(), font_b_def)
2127+
2128+
dpg.add_input_int(tag="as_peak_search_offset",width=120,default_value=loaded_values["as_peak_search_offset"],min_value=0,max_value=1000)
2129+
with dpg.tooltip("as_peak_search_offset"):
2130+
dpg.add_text("Starting sample for the alignment window")
2131+
dpg.add_text("Enforces a minimum delay by skipping early samples, forcing the global maxima to occur later in the IR")
20972132

20982133
# ---------- Desired Grid Directions ----------
20992134
with dpg.table_row():
@@ -2139,6 +2174,17 @@ def get_screen_size(default_width=1722, default_height=717):
21392174
with dpg.tooltip("as_spatial_exp_method"):
21402175
dpg.add_text("Expands sparse datasets and increases the spatial resolution and density of the spherical array")
21412176
dpg.add_text("Note: Does not apply to binaural inputs.")
2177+
2178+
# ---------- Randomization Seed ----------
2179+
with dpg.table_row():
2180+
dpg.add_text("Randomization Seed")
2181+
dpg.bind_item_font(dpg.last_item(), font_b_def)
2182+
dpg.add_input_int(tag="as_random_seed",width=120,default_value=loaded_values.get("as_random_seed", 1),min_value=0,max_value=999999,min_clamped=True,max_clamped=True)
2183+
with dpg.tooltip("as_random_seed"):
2184+
dpg.add_text("Sets the seed for the random number generator.")
2185+
dpg.add_text("0: Non-deterministic (New random result every render). 1+: Fixed seed (Reproducible results for the same value).")
2186+
dpg.add_text("Ensures that pitch shifting and binaural transformations are reproducible across different renders.")
2187+
dpg.add_text("Change this value to get a different 'flavor' of spatial distribution.")
21422188

21432189
# ---------- Pitch Shift Range ----------
21442190
with dpg.table_row():
@@ -2171,6 +2217,13 @@ def get_screen_size(default_width=1722, default_height=717):
21712217
dpg.add_text("Corrects decay curve after dataset expansion. Restores direct-to-reverberation ratios to original ratios.")
21722218
dpg.add_text("Note: Does not apply to binaural inputs.")
21732219

2220+
with dpg.table_row():
2221+
dpg.add_text("Decay Correction Strength")
2222+
dpg.bind_item_font(dpg.last_item(), font_b_def)
2223+
dpg.add_input_float(label="",tag="as_drr_corr_strength",width=120,default_value=loaded_values["as_drr_corr_strength"],min_value=0.2,max_value=10.0,format="%.2f",min_clamped=True,max_clamped=True,)
2224+
with dpg.tooltip("as_drr_corr_strength"):
2225+
dpg.add_text("Adjust strength of Decay Curve Correction. Set to 1.0 for dynamic calculation. Typical range: 3.0-4.0")
2226+
21742227
# ---------- User selected listener ----------
21752228
with dpg.table_row():
21762229

@@ -2475,6 +2528,14 @@ def get_screen_size(default_width=1722, default_height=717):
24752528
dpg.add_table_column(label="Value", init_width_or_weight=200)
24762529

24772530
# ---------- Misc Parameters ----------
2531+
with dpg.table_row():
2532+
dpg.add_text("General")
2533+
dpg.add_text("FIR Length (samples)")
2534+
dpg.add_input_int(label="",width=190, tag='gen_fir_length', min_value=256, max_value=8192, default_value=loaded_values["gen_fir_length"],min_clamped=True, max_clamped=True)
2535+
with dpg.tooltip("gen_fir_length"):
2536+
dpg.add_text("Defines the length of compensation filters in samples (before resampling)")
2537+
dpg.add_text("Increasing length improves frequency resolution and accuracy of the minimum-phase filter, especially at low frequencies, but also increases computation time")
2538+
24782539
with dpg.table_row():
24792540
dpg.add_text("HRTFs")
24802541
dpg.add_text("Force Left/Right Symmetry")
@@ -2511,7 +2572,19 @@ def get_screen_size(default_width=1722, default_height=717):
25112572
dpg.add_text("Typically results in smoother low frequencies in the integrated binaural simulation")
25122573
dpg.add_text("Applies to the direct sound. Reverberation is not modified")
25132574

2514-
2575+
with dpg.table_row():
2576+
dpg.add_text("HRTFs")
2577+
dpg.add_text("Suppression Cutoff Frequency (Hz)")
2578+
dpg.add_input_int(label="",width=190, tag='hrtf_suppression_fc', min_value=20, max_value=200, default_value=loaded_values["hrtf_suppression_fc"],min_clamped=True, max_clamped=True)
2579+
with dpg.tooltip("hrtf_suppression_fc"):
2580+
dpg.add_text("Sets the frequency below which energy is reduced in the direct sound.")
2581+
2582+
with dpg.table_row():
2583+
dpg.add_text("HRTFs")
2584+
dpg.add_text("Zero-Phase Suppression Filters")
2585+
dpg.add_checkbox(label="Enable", default_value=loaded_values["hrtf_suppression_zero_phase"],tag="hrtf_suppression_zero_phase", callback=cb.update_brir_param)
2586+
with dpg.tooltip("hrtf_suppression_zero_phase"):
2587+
dpg.add_text("Enables forward-backward filtering to keep the low-end aligned in time with the rest of the audio")
25152588

25162589
with dpg.table_row():
25172590
dpg.add_text("Binaural Sim.")
@@ -2566,10 +2639,11 @@ def get_screen_size(default_width=1722, default_height=717):
25662639

25672640
with dpg.table_row():
25682641
dpg.add_text("LF Extension")
2569-
dpg.add_text("Forward-Backward Filtering")
2642+
dpg.add_text("Zero-Phase Extension Filters")
25702643
dpg.add_checkbox(label="Enable", default_value = loaded_values["fb_filtering"], tag='fb_filtering', callback=cb.update_brir_param)
25712644
with dpg.tooltip("fb_filtering"):
2572-
dpg.add_text("This will eliminate the delays introduced by the filters when extending the low frequencies, however can introduce edge artefacts in some cases")
2645+
dpg.add_text("Enables forward-backward filtering to keep the low-end aligned in time with the rest of the audio")
2646+
dpg.add_text("This will eliminate the delays in the low-end introduced by the filters when extending the low frequencies, however can introduce edge artefacts in some cases")
25732647

25742648

25752649
with dpg.table_row():

0 commit comments

Comments
 (0)