Holiday syncing :)
This commit is contained in:
@@ -7,15 +7,19 @@ from IPython import embed
|
||||
# GENERAL SETTINGS:
|
||||
target = ['Omocestus_rufipes', '*'][0]
|
||||
data_paths = search_files(target, excl='noise', dir='../data/processed/')
|
||||
noise_path = '../data/processed/white_noise_sd-1.npz'
|
||||
save_path = '../data/inv/log_hp/'
|
||||
|
||||
# ANALYSIS SETTINGS:
|
||||
add_noise = False
|
||||
add_noise = target == '*' or False
|
||||
save_snippets = target == 'Omocestus_rufipes'
|
||||
example_scales = np.array([0.1, 1, 10, 30, 100, 300])
|
||||
scales = np.geomspace(0.1, 10000, 500)
|
||||
scales = np.unique(np.concatenate((scales, example_scales)))
|
||||
|
||||
# PREPARATION:
|
||||
pure_noise = np.load(noise_path)['filt']
|
||||
|
||||
# EXECUTION:
|
||||
for data_path, name in zip(data_paths, crop_paths(data_paths)):
|
||||
print(f'Processing {name}')
|
||||
@@ -36,9 +40,8 @@ for data_path, name in zip(data_paths, crop_paths(data_paths)):
|
||||
mix = song[:, None] * scales[None, :]
|
||||
|
||||
if add_noise:
|
||||
# Add normalized envelopenoise:
|
||||
rng = np.random.default_rng()
|
||||
noise = rng.normal(scale=1, size=song.shape)
|
||||
# Add normalized noise component:
|
||||
noise = pure_noise[:song.shape[0]]
|
||||
noise /= noise[segment].std()
|
||||
mix += noise[:, None]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user