Old 07-20-2021, 09:49 AM   #1
dagamusik
Human being with feelings
 
dagamusik's Avatar
 
Join Date: Aug 2020
Location: Colombia
Posts: 123
Default Have a JSFX (EQ) an a GUI ready. Who would help me to make it work?

Hello World,

I'm trying to put a EQ (Kind of a 560) based on RBJ Filter Cookbook.

Currently I have:

- EQ JSFX (working)
- GUI (nice to my standards)
- EQ + GUI (not working) I was trying to base the gfx code on the "1175 GUI" but I get not results.

Who would like to help me with the code or work together and finish the JS?

I uploaded a zip with 3 files:
  1. EQ JSFX (without GUI)
  2. GUI in .png
  3. A mess of a JSFX (where I was trying to make it work the EQ)

The sliders are coded as filled rectangles

Code:
gfx_r=gfx_g=gfx_b=gfx_a=0.8;
gfx_rect(34+(slider29)*5.41666,490,24,15);
Thanks in advance.
Attached Files
File Type: zip EQ56.zip (24.6 KB, 45 views)
dagamusik is online now   Reply With Quote
Old 07-20-2021, 06:10 PM   #2
leshachooze
Human being with feelings
 
Join Date: Aug 2015
Posts: 10
Default

So it should be something like this



Added a bunch of code, you can add the rest of the sliders by yourself - that should be edited inside of draw() function and start of @sliders block of code

And don't forget to hide the original sliders
Attached Files
File Type: zip 560.zip (337.1 KB, 41 views)
leshachooze is offline   Reply With Quote
Old 07-21-2021, 08:14 AM   #3
dagamusik
Human being with feelings
 
dagamusik's Avatar
 
Join Date: Aug 2020
Location: Colombia
Posts: 123
Default

Wow Thanks!

I came back today to check the forum and there is you message. I admit I kept trying to make it work until I was able to.

When I see your code it's amazing how many aproaches you get with the same problem to solve. I like your rounded faders.

I admit (as you would know for seeing the JS) that I'm just a musician trying to learn coding by inverse engineering. Do you have any suggestion to learn about "function" and "this." I do not get how it works well.

Check my result and I will try to optimize the code with your ideas, since it look cleaner, faster and easier.
Attached Files
File Type: zip EQ56.zip (31.2 KB, 28 views)
dagamusik is online now   Reply With Quote
Old 07-21-2021, 09:37 PM   #4
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 844
Default

"This" refers to the current object. If it helps, the following two functions have the same effect

function foo(x) instance(a) ( a = x; );
function foo(x) ( this.a = x; );

Ok, so going back to scope...

It's a form of object-oriented programming. Functions operate on a certain scope. If not attached to a specific object, the scope will be global, otherwise they will search the object's scope first before moving up to search globally.


function foo(x) instance(a,b,c) ( a = x; );

This tells the code executed within foo() that a b and c are all variables that are attached to the current object. If a variable is called within foo() that is not defined by instance() then foo() will look globally.

bar.foo(5);

Creates "bar.a" and sets it to 5.

foo(5);

Creates "a" and sets it to 5. Since no object is specified the scope is set to global.

bar1.foo(6);
bar2.foo(9);

bar1.a is now 6
bar2.a is now 9

If you look at the debug functions and look at the listed of variables created it might help illustrate the point, too.

Hope this helps a little.
SaulT is offline   Reply With Quote
Old 07-22-2021, 10:38 AM   #5
leshachooze
Human being with feelings
 
Join Date: Aug 2015
Posts: 10
Default

There's a bug with sliders in your version: clicking outside the slider after touching it still changes its value
gif:


All you nedeed to do was to create as many gui sliders as you need in this section of code:
Code:
    function draw()
    ( 
    
    gfx_set(182/255,179/255,181/255); // grey knob
    
    eq1.slider_from_slider_H( 48,   // x-position
                              83,   // y-position
                              126,  // slider width (blank)
                              18,   // slider height
                              14,   // id of slider (slider14)
                              -12,  // minval from slider14
                              12,   // maxval from slider 14
                              0,    // default value for slider
                              0.25 // step (comfortable for mouse drag value)
                              );
    eq2.slider_from_slider_H(48,129,126,18,13, -12, 12, 0, 0.25);
    eq3.slider_from_slider_H(48,174,126,18,12, -12, 12, 0, 0.25);
    eq4.slider_from_slider_H(48,218,126,18,11, -12, 12, 0, 0.25);
    // etc........
And link them back in this section:
Code:
@slider

  // link back
    eq1 = slider14;
    eq2 = slider13;
    eq3 = slider12;
    eq4 = slider11;
    eq5 = slider10;
    eq6 = slider8;
    eq7 = slider6;
    eq8 = slider5;
    eq9 = slider4;
    eq10 = slider3;
    out_sld = slider18;
    //etc...
So, here's the working version
Ctrl or shift + drag = fine tune
Alt+Click = default value
Works also with mousewheel

But I recommend not to use pngs for gui
It's better to redraw all the elements by code depending on gfx_w and gfx_h. That will be more user-friendly and will obey resizing



It will be great if you can remake some user presets from other versions of API560. They should be exported as .rpl file and stored in the same directory as the jsfx and should be named the same with .rpl at the end.
I put "vocal 1" preset from waves as an example in attachement
Attached Files
File Type: zip API 560 EQ with GUI.zip (23.3 KB, 35 views)

Last edited by leshachooze; 07-22-2021 at 11:26 AM.
leshachooze is offline   Reply With Quote
Old 07-23-2021, 08:32 PM   #6
dagamusik
Human being with feelings
 
dagamusik's Avatar
 
Join Date: Aug 2020
Location: Colombia
Posts: 123
Default

Sault

Thanks! I really appreciate the time you take to explain that!

It seems it gets clearer every time, I just need to practice to get used to it

leshachooze

I took your recommendation and translated the GUI entirely to JSFX.

Check it!

From my perspective, it's easier to design the GUI and use an image (takes less time and know more tools. This was a challenge for me.

Nice Idea to get the Preset to complete the plugin, I only have the Pink EQ from Acustica-Audio as an API reference and it doesn't have any preset.

But I'll figure something out.
Attached Files
File Type: zip API560 GFX.zip (6.9 KB, 34 views)
dagamusik is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.