Skip to content

Commit 0cd4d74

Browse files
committed
code style
1 parent 437b839 commit 0cd4d74

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tools/create_drumgizmo_kit.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
#instruments = [["rolandsnare", ["SnareL"], [38], "", 0.03, 23]]
7171

7272
source_samples_dir_name = "source_samples" # root directory of recorded source samples
73-
fade_out_percent = 30 # % of sample at the end is faded out
74-
thresh_from_max_for_start = 20 # dB
75-
add_samples_at_start = 20 # additional samples considered at strike start (also defines the fade-in time period)
76-
min_time_next_strike_s = 0.5 # minimum time in seconds between two different strikes
73+
fade_out_percent = 30 # % of sample at the end is faded out
74+
thresh_from_max_for_start = 20 # dB
75+
add_samples_at_start = 20 # additional samples considered at strike start (also defines the fade-in time period)
76+
min_time_next_strike_s = 0.5 # minimum time in seconds between two different strikes
7777

7878
# TEST for optimizing the algorithms, only use one instrument
7979
#instruments = [instruments[9]]
@@ -126,7 +126,7 @@
126126
positions = sorted(list(dict.fromkeys(positions))) # remove duplicates and sort
127127
positions = [-1] if not positions else positions # if no positions, use -1 (i.e. no positional support)
128128

129-
# TEST for development purpose, remove later
129+
# optionally, disable positional sensing support
130130
if disable_positional_sensing_support and len(positions) > 1:
131131
positions = [0]
132132

@@ -211,7 +211,7 @@
211211
# estimate power from master channel using the maximum value
212212
sample_powers[p][i] = strike_max / 32768 / 32768 # assuming 16 bit
213213

214-
# extract sample data of current strike
214+
# optionally, shorten the samples to save some memory, i.e., modify strike_end
215215
if do_shorten_samples:
216216
x_cur_strike_master = x[strike_start[i][0]:strike_end[i][0] + 1]
217217
strike_max = np.max(x_cur_strike_master)
@@ -220,12 +220,12 @@
220220
else:
221221
mod_strike_end = strike_end[i][0]
222222

223+
# extract sample data of current strike
223224
sample_strikes[p][i] = np.zeros((mod_strike_end - strike_start[i][0] + 1, num_channels), np.int16)
224225
for c in range(0, num_channels):
225226
strike_cut_pos[strike_start[i][0]:mod_strike_end + 1].fill(True) # for debugging
226227
sample_strikes[p][i][:, c] = sample[c][strike_start[i][0]:mod_strike_end + 1]
227228

228-
229229
# audio fade-in at the beginning
230230
sample_strikes[p][i][:add_samples_at_start, c] = np.int16(sample_strikes[p][i][:add_samples_at_start, c].astype(float) * np.arange(1, add_samples_at_start + 1, 1) / add_samples_at_start)
231231

@@ -353,5 +353,3 @@
353353
ET.indent(midimap_xml, space="\t", level=0)
354354
tree_xml.write(kit_name + "/Midimap.xml", encoding="utf-8", xml_declaration="True")
355355

356-
357-

0 commit comments

Comments
 (0)