Skip to content

Commit

Permalink
add support for audio fade-in at the beginning of each PearlMMX instr…
Browse files Browse the repository at this point in the history
…ument sample
  • Loading branch information
corrados committed Oct 2, 2023
1 parent e6e3c8c commit 1db2563
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/create_drumgizmo_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
source_samples_dir_name = "source_samples" # root directory of recorded source samples
fade_out_percent = 10 # % of sample at the end is faded out
thresh_from_max_for_start = 20 # dB
add_samples_at_start = 20 # additional samples considered at strike start
add_samples_at_start = 20 # additional samples considered at strike start (also defines the fade-in time period)
min_time_next_strike_s = 0.5 # minimum time in seconds between two different strikes

# TEST for optimizing the algorithms, only use one instrument
#instruments = [instruments[7]]
#instruments = [instruments[9]]

# settings for optimized drum kit for Raspberry Pi (with limited RAM)
if raspi_optimized_drumkit:
Expand Down Expand Up @@ -207,6 +207,9 @@
strike_cut_pos[strike_start[i][0]:strike_end[i][0] + 1].fill(True) # for debugging
sample_strikes[p][i][:, c] = sample[c][strike_start[i][0]:strike_end[i][0] + 1]

# audio fade-in at the beginning
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)

# audio fade-out at the end
sample_len = len(sample_strikes[p][i][:, c])
fade_start = int(sample_len * (1 - fade_out_percent / 100))
Expand Down

0 comments on commit 1db2563

Please sign in to comment.