Hugo Flores Garcia commited on
Commit
e32ae3e
1 Parent(s): e2a08a9
Files changed (4) hide show
  1. .gitignore +0 -1
  2. app.py +141 -48
  3. scripts/exp/train.py +2 -1
  4. vampnet/interface.py +2 -1
.gitignore CHANGED
@@ -131,7 +131,6 @@ dmypy.json
131
  output/
132
  snapshot/
133
  *.m4a
134
- *.wav
135
  notebooks/scratch.ipynb
136
  notebooks/inspect.ipynb
137
  notebooks/effects.ipynb
 
131
  output/
132
  snapshot/
133
  *.m4a
 
134
  notebooks/scratch.ipynb
135
  notebooks/inspect.ipynb
136
  notebooks/effects.ipynb
app.py CHANGED
@@ -176,6 +176,23 @@ def save_vamp(data):
176
 
177
  with gr.Blocks() as demo:
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  with gr.Row():
180
  with gr.Column():
181
 
@@ -214,66 +231,142 @@ with gr.Blocks() as demo:
214
  # mask settings
215
  with gr.Column():
216
 
217
- periodic_p = gr.Slider(
218
- label="periodic prompt (0.0 means no prompt, 2 - lots of hints, 8 - a couple of hints, 16 - occasional hint, 32 - very occasional hint, etc)",
219
- minimum=0,
220
- maximum=128,
221
- step=1,
222
- value=3,
223
- )
224
 
225
-
226
- onset_mask_width = gr.Slider(
227
- label="onset mask width (multiplies with the periodic mask, 1 step ~= 10milliseconds) ",
228
- minimum=0,
229
- maximum=20,
230
- step=1,
231
- value=5,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  )
 
233
 
234
- beat_mask_width = gr.Slider(
235
- label="beat mask width (in milliseconds)",
236
- minimum=0,
237
- maximum=200,
238
- value=0,
239
- )
240
- beat_mask_downbeats = gr.Checkbox(
241
- label="beat mask downbeats only?",
242
- value=False
243
- )
244
-
245
-
246
- with gr.Accordion("extras ", open=False):
247
- rand_mask_intensity = gr.Slider(
248
- label="random mask intensity. (If this is less than 1, scatters prompts throughout the audio, should be between 0.9 and 1.0)",
249
- minimum=0.0,
250
- maximum=1.0,
251
- value=1.0
252
  )
253
 
254
- periodic_w = gr.Slider(
255
- label="periodic prompt width (steps, 1 step ~= 10milliseconds)",
256
- minimum=1,
 
257
  maximum=20,
258
  step=1,
259
- value=1,
260
- )
261
- n_conditioning_codebooks = gr.Number(
262
- label="number of conditioning codebooks. probably 0",
263
- value=0,
264
- precision=0,
265
  )
266
 
267
- stretch_factor = gr.Slider(
268
- label="time stretch factor",
269
  minimum=0,
270
- maximum=64,
271
- step=1,
272
- value=1,
 
 
 
273
  )
274
 
275
 
276
- with gr.Accordion("prefix/suffix hints", open=False):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  prefix_s = gr.Slider(
278
  label="prefix hint length (seconds)",
279
  minimum=0.0,
@@ -290,7 +383,7 @@ with gr.Blocks() as demo:
290
  temp = gr.Slider(
291
  label="temperature",
292
  minimum=0.0,
293
- maximum=3.0,
294
  value=0.8
295
  )
296
 
 
176
 
177
  with gr.Blocks() as demo:
178
 
179
+ with gr.Row():
180
+ with gr.Column():
181
+ gr.Markdown("# VampNet Audio Vamping")
182
+ gr.Markdown("""## Description:
183
+ This is a demo of the VampNet, a generative audio model that transforms the input audio based on the chosen settings.
184
+ You can control the extent and nature of variation with a set of manual controls and presets.
185
+ Use this interface to experiment with different mask settings and explore the audio outputs.
186
+ """)
187
+
188
+ gr.Markdown("""
189
+ ## Instructions:
190
+ 1. You can start by uploading some audio, or by loading the example audio.
191
+ 2. Choose a preset for the vamp operation, or manually adjust the controls to customize the mask settings.
192
+ 3. Click the "generate (vamp)!!!" button to apply the vamp operation. Listen to the output audio.
193
+ 4. Optionally, you can add some notes and save the result.
194
+ 5. You can also use the output as the new input and continue experimenting!
195
+ """)
196
  with gr.Row():
197
  with gr.Column():
198
 
 
231
  # mask settings
232
  with gr.Column():
233
 
 
 
 
 
 
 
 
234
 
235
+ presets = {
236
+ "unconditional": {
237
+ "periodic_p": 0,
238
+ "onset_mask_width": 0,
239
+ "beat_mask_width": 0,
240
+ "beat_mask_downbeats": False,
241
+ },
242
+ "slight periodic variation": {
243
+ "periodic_p": 5,
244
+ "onset_mask_width": 0,
245
+ "beat_mask_width": 0,
246
+ "beat_mask_downbeats": False,
247
+ },
248
+ "moderate periodic variation": {
249
+ "periodic_p": 5,
250
+ "onset_mask_width": 5,
251
+ "beat_mask_width": 0,
252
+ "beat_mask_downbeats": False,
253
+ },
254
+ "strong periodic variation": {
255
+ "periodic_p": 13,
256
+ "onset_mask_width": 5,
257
+ "beat_mask_width": 0,
258
+ "beat_mask_downbeats": False,
259
+ },
260
+ "very strong periodic variation": {
261
+ "periodic_p": 21,
262
+ "onset_mask_width": 5,
263
+ "beat_mask_width": 0,
264
+ "beat_mask_downbeats": False,
265
+ },
266
+ "beat-driven variation": {
267
+ "periodic_p": 0,
268
+ "onset_mask_width": 0,
269
+ "beat_mask_width": 50,
270
+ "beat_mask_downbeats": False,
271
+ },
272
+ "beat-driven variation (downbeats only)": {
273
+ "periodic_p": 0,
274
+ "onset_mask_width": 0,
275
+ "beat_mask_width": 50,
276
+ "beat_mask_downbeats": True,
277
+ },
278
+ "beat-driven variation (downbeats only, strong)": {
279
+ "periodic_p": 0,
280
+ "onset_mask_width": 0,
281
+ "beat_mask_width": 20,
282
+ "beat_mask_downbeats": True,
283
+ },
284
+ }
285
+
286
+ preset = gr.Dropdown(
287
+ label="preset",
288
+ choices=list(presets.keys()),
289
+ value="strong periodic variation",
290
  )
291
+ load_preset_button = gr.Button("load_preset")
292
 
293
+ with gr.Accordion("manual controls", open=True):
294
+ periodic_p = gr.Slider(
295
+ label="periodic prompt (0 - unconditional, 2 - lots of hints, 8 - a couple of hints, 16 - occasional hint, 32 - very occasional hint, etc)",
296
+ minimum=0,
297
+ maximum=128,
298
+ step=1,
299
+ value=3,
 
 
 
 
 
 
 
 
 
 
 
300
  )
301
 
302
+
303
+ onset_mask_width = gr.Slider(
304
+ label="onset mask width (multiplies with the periodic mask, 1 step ~= 10milliseconds) ",
305
+ minimum=0,
306
  maximum=20,
307
  step=1,
308
+ value=5,
 
 
 
 
 
309
  )
310
 
311
+ beat_mask_width = gr.Slider(
312
+ label="beat mask width (in milliseconds)",
313
  minimum=0,
314
+ maximum=200,
315
+ value=0,
316
+ )
317
+ beat_mask_downbeats = gr.Checkbox(
318
+ label="beat mask downbeats only?",
319
+ value=False
320
  )
321
 
322
 
323
+ with gr.Accordion("extras ", open=False):
324
+ rand_mask_intensity = gr.Slider(
325
+ label="random mask intensity. (If this is less than 1, scatters prompts throughout the audio, should be between 0.9 and 1.0)",
326
+ minimum=0.0,
327
+ maximum=1.0,
328
+ value=1.0
329
+ )
330
+
331
+ periodic_w = gr.Slider(
332
+ label="periodic prompt width (steps, 1 step ~= 10milliseconds)",
333
+ minimum=1,
334
+ maximum=20,
335
+ step=1,
336
+ value=1,
337
+ )
338
+ n_conditioning_codebooks = gr.Number(
339
+ label="number of conditioning codebooks. probably 0",
340
+ value=0,
341
+ precision=0,
342
+ )
343
+
344
+ stretch_factor = gr.Slider(
345
+ label="time stretch factor",
346
+ minimum=0,
347
+ maximum=64,
348
+ step=1,
349
+ value=1,
350
+ )
351
+
352
+ preset_outputs = {
353
+ periodic_p,
354
+ onset_mask_width,
355
+ beat_mask_width,
356
+ beat_mask_downbeats,
357
+ }
358
+
359
+ def load_preset(_preset):
360
+ return tuple(presets[_preset].values())
361
+
362
+ load_preset_button.click(
363
+ fn=load_preset,
364
+ inputs=[preset],
365
+ outputs=preset_outputs
366
+ )
367
+
368
+
369
+ with gr.Accordion("prefix/suffix prompts", open=False):
370
  prefix_s = gr.Slider(
371
  label="prefix hint length (seconds)",
372
  minimum=0.0,
 
383
  temp = gr.Slider(
384
  label="temperature",
385
  minimum=0.0,
386
+ maximum=10.0,
387
  value=0.8
388
  )
389
 
scripts/exp/train.py CHANGED
@@ -20,7 +20,8 @@ import vampnet
20
  from vampnet.modules.transformer import VampNet
21
  from vampnet.util import codebook_unflatten, codebook_flatten
22
  from vampnet import mask as pmask
23
- from dac.model.dac import DAC
 
24
 
25
 
26
  # Enable cudnn autotuner to speed up training
 
20
  from vampnet.modules.transformer import VampNet
21
  from vampnet.util import codebook_unflatten, codebook_flatten
22
  from vampnet import mask as pmask
23
+ # from dac.model.dac import DAC
24
+ from lac.model.lac import LAC as DAC
25
 
26
 
27
  # Enable cudnn autotuner to speed up training
vampnet/interface.py CHANGED
@@ -11,7 +11,8 @@ from .modules.transformer import VampNet
11
  from .beats import WaveBeat
12
  from .mask import *
13
 
14
- from dac.model.dac import DAC
 
15
 
16
 
17
  def signal_concat(
 
11
  from .beats import WaveBeat
12
  from .mask import *
13
 
14
+ # from dac.model.dac import DAC
15
+ from lac.model.lac import LAC as DAC
16
 
17
 
18
  def signal_concat(