musikinformatik/SuperDirt

Effect "dj-filter" should be inactive when value is 0.5

jarmitage opened this issue · 7 comments

Currently # djf 0.5 is audible, ideally it would not be

SynthDef("dj-filter" ++ ~dirt.numChannels, { |out, djf|
var signal;
var lpfCutoffFreq = djf.linexp(0, 0.5, 20, 10000);
var hpfCutoffFreq = djf.linexp(0.5, 1, 20, 10000);
signal = In.ar(out, ~dirt.numChannels);
signal = RHPF.ar(
RLPF.ar(
signal,
lpfCutoffFreq
),
hpfCutoffFreq
);
ReplaceOut.ar(out, signal)
}, [\ir]).add;

This could be achieved using perhaps some kind of control structure (incorrect code below)

signal = Select.ar(djf != 0.5, [
	signal,
	RHPF.ar(
		RLPF.ar(
			signal,
			lpfCutoffFreq
		),
		hpfCutoffFreq
	)
]);

An alternative might be # djf "-1"

yaxu commented

Agreed, 0.5 should be 100% dry signal.
Hwoever when mapping a midi controller to this parameter (which is very handy to do), you might want a bigger central range that turns the effect off, as finding 0.5 in the range can be difficult. But this would be better on the tidal side?
(This control would be a bit easier in a -1 to 1 (bipolar) range, where 0 is no effect.. But somehow in tidal we've long standardised in 0-1.)

yaxu commented

This solves it on the tidal side:

import qualified Data.Map.Strict as Map

let djf :: Pattern Double -> ControlPattern
    djf pat = sew ((== 0.5) <$> pat) (pure Map.empty) (pF "djf" pat)

Great, I had tried it on Tidal side, but ran into issues where Pattern Doubles can't use ==, but you've got it there, so probably better than a SuperDirt fix! Thanks

yaxu commented

I wonder if tweaking the ranges on the SC side would be a better fix, e.g.:

 	SynthDef("dj-filter" ++ ~dirt.numChannels, { |out, djf| 
 		var signal; 
 		var lpfCutoffFreq = djf.linexp(0, 0.499, 20, 10000); 
 		var hpfCutoffFreq = djf.linexp(0.501, 1, 20, 10000); 
  
 		signal = In.ar(out, ~dirt.numChannels); 
  
 		signal = RHPF.ar( 
 			RLPF.ar( 
 				signal, 
 				lpfCutoffFreq 
 			), 

(probably only one of these ranges needs to be tweaked)

yaxu commented

If so we could have an 'djfisland' parameter that is added/subtracted from the ranges to make a bigger 'clean' area

Are there other use cases for this pattern? E.g. isn't it the same when setting reverb to 0 that it's still audible? Maybe this is a general feature for SD fx?

I wonder if tweaking the ranges on the SC side would be a better fix, e.g.:

Yes, I think that would be the best.