Spaces:
Running
Running
Commit
·
9c9d4eb
1
Parent(s):
e8b53cc
feat: add RMS averaging coefficient slider and update compressor plot handling
Browse files
app.py
CHANGED
|
@@ -522,6 +522,13 @@ with gr.Blocks() as demo:
|
|
| 522 |
interactive=True,
|
| 523 |
label="Exp. Threshold (dB)",
|
| 524 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
with gr.Column():
|
| 526 |
comp_plot = gr.Plot(
|
| 527 |
plot_comp(fx), label="Compressor Curve", elem_id="comp-plot"
|
|
@@ -624,19 +631,22 @@ with gr.Blocks() as demo:
|
|
| 624 |
make_up,
|
| 625 |
exp_ratio,
|
| 626 |
exp_th,
|
|
|
|
| 627 |
attack_time,
|
| 628 |
release_time,
|
| 629 |
]
|
| 630 |
-
cmp_update_funcs = [update_param] *
|
| 631 |
cmp_attr_names = [
|
| 632 |
"cmp_th",
|
| 633 |
"cmp_ratio",
|
| 634 |
"make_up",
|
| 635 |
"exp_ratio",
|
| 636 |
"exp_th",
|
|
|
|
| 637 |
"at",
|
| 638 |
"rt",
|
| 639 |
]
|
|
|
|
| 640 |
|
| 641 |
delay_sliders = [delay_time, feedback, delay_lp_freq, delay_gain, odd_pan, even_pan]
|
| 642 |
delay_update_funcs = (
|
|
@@ -698,7 +708,9 @@ with gr.Blocks() as demo:
|
|
| 698 |
outputs=[z, fx_params, json_output, peq_plot] + update_pc_outputs,
|
| 699 |
)
|
| 700 |
|
| 701 |
-
for f, s, attr_name in zip(
|
|
|
|
|
|
|
| 702 |
s.input(
|
| 703 |
chain_functions(
|
| 704 |
lambda x, s, e_pc_i, *all_s: (
|
|
@@ -713,12 +725,15 @@ with gr.Blocks() as demo:
|
|
| 713 |
),
|
| 714 |
lambda _, fx, e_pc_i: (fx2x(fx), fx, e_pc_i),
|
| 715 |
lambda x, fx, e_pc_i: (x2z(x), x, fx, e_pc_i),
|
| 716 |
-
lambda z, x, fx, e_pc_i: [z, x]
|
| 717 |
-
+ [model2json(fx)
|
|
|
|
| 718 |
+ update_pc(z, e_pc_i),
|
| 719 |
),
|
| 720 |
inputs=[fx_params, s, extra_pc_dropdown] + all_effect_sliders,
|
| 721 |
-
outputs=[z, fx_params, json_output
|
|
|
|
|
|
|
| 722 |
)
|
| 723 |
|
| 724 |
for f, s, attr_name, update_plot in zip(
|
|
|
|
| 522 |
interactive=True,
|
| 523 |
label="Exp. Threshold (dB)",
|
| 524 |
)
|
| 525 |
+
avg_coef = gr.Slider(
|
| 526 |
+
minimum=0,
|
| 527 |
+
maximum=1,
|
| 528 |
+
value=comp.params.avg_coef.item(),
|
| 529 |
+
interactive=True,
|
| 530 |
+
label="RMS Averaging Coefficient",
|
| 531 |
+
)
|
| 532 |
with gr.Column():
|
| 533 |
comp_plot = gr.Plot(
|
| 534 |
plot_comp(fx), label="Compressor Curve", elem_id="comp-plot"
|
|
|
|
| 631 |
make_up,
|
| 632 |
exp_ratio,
|
| 633 |
exp_th,
|
| 634 |
+
avg_coef,
|
| 635 |
attack_time,
|
| 636 |
release_time,
|
| 637 |
]
|
| 638 |
+
cmp_update_funcs = [update_param] * 6 + [update_atrt] * 2
|
| 639 |
cmp_attr_names = [
|
| 640 |
"cmp_th",
|
| 641 |
"cmp_ratio",
|
| 642 |
"make_up",
|
| 643 |
"exp_ratio",
|
| 644 |
"exp_th",
|
| 645 |
+
"avg_coef",
|
| 646 |
"at",
|
| 647 |
"rt",
|
| 648 |
]
|
| 649 |
+
cmp_update_plot_flag = [True] * 5 + [False] * 3
|
| 650 |
|
| 651 |
delay_sliders = [delay_time, feedback, delay_lp_freq, delay_gain, odd_pan, even_pan]
|
| 652 |
delay_update_funcs = (
|
|
|
|
| 708 |
outputs=[z, fx_params, json_output, peq_plot] + update_pc_outputs,
|
| 709 |
)
|
| 710 |
|
| 711 |
+
for f, s, attr_name, update_plot in zip(
|
| 712 |
+
cmp_update_funcs, cmp_sliders, cmp_attr_names, cmp_update_plot_flag
|
| 713 |
+
):
|
| 714 |
s.input(
|
| 715 |
chain_functions(
|
| 716 |
lambda x, s, e_pc_i, *all_s: (
|
|
|
|
| 725 |
),
|
| 726 |
lambda _, fx, e_pc_i: (fx2x(fx), fx, e_pc_i),
|
| 727 |
lambda x, fx, e_pc_i: (x2z(x), x, fx, e_pc_i),
|
| 728 |
+
lambda z, x, fx, e_pc_i, update_plot=update_plot: [z, x]
|
| 729 |
+
+ [model2json(fx)]
|
| 730 |
+
+ ([plot_comp(fx)] if update_plot else [])
|
| 731 |
+ update_pc(z, e_pc_i),
|
| 732 |
),
|
| 733 |
inputs=[fx_params, s, extra_pc_dropdown] + all_effect_sliders,
|
| 734 |
+
outputs=[z, fx_params, json_output]
|
| 735 |
+
+ ([comp_plot] if update_plot else [])
|
| 736 |
+
+ update_pc_outputs,
|
| 737 |
)
|
| 738 |
|
| 739 |
for f, s, attr_name, update_plot in zip(
|