Skip to content

Commit

Permalink
complex conditioning
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentherrmann committed Mar 25, 2018
1 parent 7434420 commit 0913964
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 5 additions & 3 deletions audio_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def __init__(self, *args, **kwargs):
self.conditioning_channels = conditioning_channels

print("Conditioning captures time scales ranging from " + str(self.min_conditioning_breadth) + " to " \
+ str(self.min_conditioning_breadth * self.conditioning_channels) + " seconds")
+ str(self.min_conditioning_breadth * self.conditioning_channels // 2) + " seconds")

super().__init__(*args, **kwargs)

Expand All @@ -199,8 +199,10 @@ def conditioning(self, file_index, position_in_file, item_length):
x = np.linspace(phase_start, phase_start + phase_length, num=conditioning_count)
conditioning = np.zeros((self.conditioning_channels, conditioning_count))

for c in range(self.conditioning_channels):
conditioning[c, :] = np.cos(x * ((c + 1) / self.conditioning_channels))
frequency_count = self.conditioning_channels // 2
for c in range(frequency_count):
conditioning[2 * c, :] = np.cos(x * ((c + 1) / frequency_count))
conditioning[2 * c + 1, :] = np.sin(x * ((c + 1) / frequency_count))

file_encoding = np.zeros((len(self.files), conditioning_count))
file_encoding[file_index, :] = 1.
Expand Down
4 changes: 2 additions & 2 deletions wavenet_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def __init__(self, args_dict):
self.file_encoding_layers.append(nn.Conv1d(in_channels=self.file_encoding_channels[i],
out_channels=self.file_encoding_channels[i + 1],
kernel_size=1,
bias=False))
bias=self.use_bias))

self.conditioning_layers = nn.ModuleList()
self.file_conditioning_cross_layers = nn.ModuleList()
Expand All @@ -396,7 +396,7 @@ def __init__(self, args_dict):
self.file_conditioning_cross_layers.append(nn.Conv1d(in_channels=self.file_encoding_channels[-1],
out_channels=self.conditioning_channels[i],
kernel_size=1,
bias=False))
bias=self.use_bias))

def activation_unit_init(self):
super().activation_unit_init()
Expand Down

0 comments on commit 0913964

Please sign in to comment.