Old 10-11-2018, 08:44 AM   #1
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,244
Default JS Channel selector with crossfade? Help needed!

Hello!


I have absolutely no idea about JSFX programming, so could someone help on this?
How could I make the channel selector to crossfade between one selected pair of channels and the next selected pair? Currently, it changes abruptly so there are always clicks/pops. A small crossfade of 5-10ms would solve the problem.


Thanks!

Last edited by amagalma; 10-12-2018 at 07:59 AM.
amagalma is offline   Reply With Quote
Old 10-12-2018, 08:00 AM   #2
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,244
Default

Anyone who knows about JSFX programming?
amagalma is offline   Reply With Quote
Old 10-12-2018, 10:19 AM   #3
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 263
Default

So you're looking for a channel-selector effect where it always outputs on channels 1+2, but the input can smoothly switch between 1+2, 3+4, 5+6 etc. - is that correct?

If so, that's fairly straightforward - I've attached a JSFX which seems to work, should be automatable, et cetera.

Geraint

P.S. - if you want to learn JSFX yourself, we can walk through the steps it took to create this effect, but fine if you just want the effect!

EDIT - tapered the fade to reduce click even further
Attached Files
File Type: txt smooth-channel-selector.jsfx.txt (1.6 KB, 5 views)

Last edited by geraintluff; 10-15-2018 at 01:30 AM.
geraintluff is offline   Reply With Quote
Old 10-12-2018, 04:00 PM   #4
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,244
Default

Thank you so much Geraint!


This is exactly what I was looking for!


Thank you for offering to walk me through the steps! I mostly understand how it is constructed - I didn't know that you can define functions in any @. I thought it should be only in @init. The parts that I do not get are the DSP stuff, because I have absolutely no clue in DSP programming.
I was trying to modify the stock JS channel selector, but seeing now your code, I would never make it! :P
amagalma is offline   Reply With Quote
Old 10-12-2018, 04:26 PM   #5
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 263
Default

Quote:
Originally Posted by amagalma View Post
This is exactly what I was looking for!
Excellent.

Quote:
Originally Posted by amagalma View Post
I didn't know that you can define functions in any @. I thought it should be only in @init.
If you define them in other sections they can only be used in that section (i.e. you can't define it in @block and then use it in @sample). Whatever keeps the code tidiest, really.

Quote:
Originally Posted by amagalma View Post
I was trying to modify the stock JS channel selector, but seeing now your code, I would never make it! :P
Yeah, getting smooth transitions always seems to add way more complexity than expected, and can affect performance too if you're not careful.

I didn't have a copy of REAPER to hand when I wrote this one, so I couldn't base it on the stock one. When it's something shorter like this, starting from scratch often makes things more organised anyway, though.
geraintluff is offline   Reply With Quote
Old 10-14-2018, 11:57 AM   #6
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,333
Default

Switcher 5 in my ReaPack
IXix is offline   Reply With Quote
Old 10-15-2018, 01:22 AM   #7
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 263
Default

Quote:
Originally Posted by IXix View Post
Switcher 5 in my ReaPack
Looks like it has a bunch more features.

However looking at the code, "fadegain" seems to only update in @block. Doesn't this mean the gains jump every 10ms (if using a 512-sample block at 48kHz) instead of having a smooth fade?

Doesn't this still produce clicks? I can't test this because I'm not near REAPER right now, but for the default 30ms rate, I would expect this to reduce clicks by 9dB but still be audible, particularly for low-frequency inputs. Is that what you get?

Last edited by geraintluff; 10-15-2018 at 02:02 AM.
geraintluff is offline   Reply With Quote
Old 10-15-2018, 03:03 AM   #8
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,333
Default

Quote:
Originally Posted by geraintluff View Post
looking at the code, "fadegain" seems to only update in @block....Doesn't this still produce clicks?
I guess it could click with certain source material as you suggest but I never tested it that thoroughly. You're more of a DSP guy than I am so I'll take your word for it.

It sits on the master in all my projects to switch between reference tracks and it works well enough for me in that context but YMMV, as they say on the internet.
IXix is offline   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 07:46 PM.


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