|
70 | 70 | #instruments = [["rolandsnare", ["SnareL"], [38], "", 0.03, 23]]
|
71 | 71 |
|
72 | 72 | 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 |
77 | 77 |
|
78 | 78 | # TEST for optimizing the algorithms, only use one instrument
|
79 | 79 | #instruments = [instruments[9]]
|
|
126 | 126 | positions = sorted(list(dict.fromkeys(positions))) # remove duplicates and sort
|
127 | 127 | positions = [-1] if not positions else positions # if no positions, use -1 (i.e. no positional support)
|
128 | 128 |
|
129 |
| - # TEST for development purpose, remove later |
| 129 | + # optionally, disable positional sensing support |
130 | 130 | if disable_positional_sensing_support and len(positions) > 1:
|
131 | 131 | positions = [0]
|
132 | 132 |
|
|
211 | 211 | # estimate power from master channel using the maximum value
|
212 | 212 | sample_powers[p][i] = strike_max / 32768 / 32768 # assuming 16 bit
|
213 | 213 |
|
214 |
| - # extract sample data of current strike |
| 214 | + # optionally, shorten the samples to save some memory, i.e., modify strike_end |
215 | 215 | if do_shorten_samples:
|
216 | 216 | x_cur_strike_master = x[strike_start[i][0]:strike_end[i][0] + 1]
|
217 | 217 | strike_max = np.max(x_cur_strike_master)
|
|
220 | 220 | else:
|
221 | 221 | mod_strike_end = strike_end[i][0]
|
222 | 222 |
|
| 223 | + # extract sample data of current strike |
223 | 224 | sample_strikes[p][i] = np.zeros((mod_strike_end - strike_start[i][0] + 1, num_channels), np.int16)
|
224 | 225 | for c in range(0, num_channels):
|
225 | 226 | strike_cut_pos[strike_start[i][0]:mod_strike_end + 1].fill(True) # for debugging
|
226 | 227 | sample_strikes[p][i][:, c] = sample[c][strike_start[i][0]:mod_strike_end + 1]
|
227 | 228 |
|
228 |
| - |
229 | 229 | # audio fade-in at the beginning
|
230 | 230 | 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)
|
231 | 231 |
|
|
353 | 353 | ET.indent(midimap_xml, space="\t", level=0)
|
354 | 354 | tree_xml.write(kit_name + "/Midimap.xml", encoding="utf-8", xml_declaration="True")
|
355 | 355 |
|
356 |
| - |
357 |
| - |
0 commit comments