xy to control 4 source levels

For general discussion related FlowStone
Post Reply
blatantleesly
Posts: 21
Joined: Wed May 20, 2015 2:46 pm

xy to control 4 source levels

Post by blatantleesly »

xY to control 4 source levels.fsm
(2.8 KiB) Downloaded 843 times


Hi Guys,
I'm having a bit of a mental melt down as I am trying to do something that seems simple but for some reason is frying my brain, I'm trying to create a control interface that controls and mixes between 4 separate audio sources. The idea is that each corner effectively selects a source but when the position of the cursor is moved it mixes evenly between them, I have a kind of working version of this but the mix is not even between the sources. If anyone could help me getting this working that would be great or suggest a better technique to do what I am trying to achieve. Here is a basic template.

Many thanks In advance.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: xy to control 4 source levels

Post by tulamide »

Here you are :)

Let's assume top-left stands for source 1, top-right for source 2, bottom-right for source 3, and bottom-left for source 4.

Since you use a rectangular pad and not a circular, the longest distance are the diagonals. So, if source 1 = level 1.0 then source 3 = level 0.0, etc. That also means, source 1 is not at level 0.0 when source 4 is at level 1.0

In the center they are evenly leveled. At a scale of 1 they sum up to a total level of 2.0 (4 times 0.5). If you prefer a lower total level, just look for this line

Code: Select all

@scale = 1.0


and change the number to whatever seems reasonable to you. (Example: @scale = 0.5 means the max level is 0.5, so they sum up to 1.0 when centered = 4 times 0.25)
Attachments
xY to control 4 source levels (tula).fsm
(3.03 KiB) Downloaded 925 times
"There lies the dog buried" (German saying translated literally)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: xy to control 4 source levels

Post by Spogg »

Hi tulamide
This looks potentially very useful for Lissajou stuff and more. Unfortunately I get an error in the Ruby Component, see below.

Ruby error in 4 channel xy controller.png
Ruby error in 4 channel xy controller.png (65.19 KiB) Viewed 13965 times


The hex code at the end of the error line changes with the x/y position on the 'joystick' but all the 4 float output values stay at 0.25.
I'm on the latest FS 3.08.1 and I wish I knew some Ruby to fix this because it looks great!
Cheers
Spogg
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: xy to control 4 source levels

Post by martinvicanek »

I got the same error. If you rename x by z (both input and code) it disappears. Ugly FS bug that is!
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: xy to control 4 source levels

Post by tulamide »

As Martin says, we just determined '@x' being the cause. It is not the automatically generated variable that belongs to the input named 'x', but seems to be overriden by something internal. It is a bug from my point of view, since this was never before an issue and only happens under 3.0.8.1 (3.0.8 also?)

Until this is fixed, avoid naming any input 'x'

EDIT: Also, if you wish to use the RubyEdit-Code without the x/y-pad, keep in mind that this was made for that special pad, which means, it will only work correctly, if the bottom/highest y refers to 0, and the top/lowest to 1. It has to be mentioned because most of Computer graphics work the other way round (top = 0, bottom = 1)
"There lies the dog buried" (German saying translated literally)
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

ab (was xy) to control 4 source levels

Post by martinvicanek »

Now that we have this sorted out let me offer a simple alternative based on bilinear interpolation.
Attachments
xY to control 4 source levels MV.fsm
(2.79 KiB) Downloaded 861 times
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: xy to control 4 source levels

Post by Spogg »

Thanks for that Martin. Works fine for me :D
Cheers
Spogg
blatantleesly
Posts: 21
Joined: Wed May 20, 2015 2:46 pm

Re: xy to control 4 source levels

Post by blatantleesly »

Thanks guys, You are lifesavers!!!!
Post Reply