5
17
Fork
You've already forked EQUIS
5

Overdrive/clipping distortion to give EQUIS some character #15

Open
opened 2023年10月14日 00:25:48 +02:00 by obsoleszenz · 1 comment

Many mixers have an saturation/clipping character when the signal is >0db. This would be nice for EQUIS too, especially as the hardclip we currently use is not pleasant.

just some faust code dump:

import("stdfaust.lib");
superpow(p) = _ <: abs, ma.signum : pow(p), _ : *;
overdrive_inner(expo, treshold, cap, x) = pow((abs(x) - offset), expo) : ma.tanh : pow(1/expo) : (_*cap) : *(ma.signum(x))
with {
 offset = overdrive_offset(expo, treshold, cap);
};
overdrive_offset(expo, treshold, cap) = (
 treshold - (
 pow(
 ma.atanh(
 pow(
 (treshold/cap),
 expo
 )
 ),
 (1 / expo)
 )
 )
);
debug(e) = _ <: attach(_, e);
overdrive(expo, treshold, cap, x) = x , overdrive_inner(expo, treshold, cap, x) : select2(abs(x) > treshold);
dbmeter = _ <: attach(_, (ba.slidingRMSp(60, 60) : ba.linear2db : hbargraph("rms[unit:db]", -70, 8))); 
gain(g) = _ * ba.db2linear(g);
h = hslider("headroom[unit:db]", 0, -4, 20, 1);
g = hslider("gain[unit:db]", 0, -4, 20, 1);
m = hslider("makeupgain[unit:db]", 0, -4, 20, 1);
expo = hslider("expo", 0.5, 0.01, 2, 0.01);
treshold = hslider("overdrive treshold[unit:db]", 4, -20, 12, 0.001);
cap = hslider("overdrive cap[unit:db]", 2, -20, 12, 0.001) : ba.db2linear : debug(hbargraph("oc", 0, 8));
overdrive_chain = gain(g) : overdrive(expo, treshold : ba.db2linear : debug(hbargraph("ot", 0, 8)), cap) : gain(min(0, treshold) : *(-1) : debug(hbargraph("makeupgain", -10, 10)) : ba.db2linear) ;
process = _ : ba.bypass_fade(ma.BS*4, checkbox("bypass"), overdrive_chain) : gain(-h) : dbmeter <: _,_;
//process = overdrive(hslider("expo", 0.5, 0.01, 20, 0.01), 1.2, -1.5);
//process = hslider("overdrive treshold[unit:db]", 4, -20, 4, 0.001) : ba.db2linear;
Many mixers have an saturation/clipping character when the signal is >0db. This would be nice for EQUIS too, especially as the hardclip we currently use is not pleasant. just some faust code dump: ``` import("stdfaust.lib"); superpow(p) = _ <: abs, ma.signum : pow(p), _ : *; overdrive_inner(expo, treshold, cap, x) = pow((abs(x) - offset), expo) : ma.tanh : pow(1/expo) : (_*cap) : *(ma.signum(x)) with { offset = overdrive_offset(expo, treshold, cap); }; overdrive_offset(expo, treshold, cap) = ( treshold - ( pow( ma.atanh( pow( (treshold/cap), expo ) ), (1 / expo) ) ) ); debug(e) = _ <: attach(_, e); overdrive(expo, treshold, cap, x) = x , overdrive_inner(expo, treshold, cap, x) : select2(abs(x) > treshold); dbmeter = _ <: attach(_, (ba.slidingRMSp(60, 60) : ba.linear2db : hbargraph("rms[unit:db]", -70, 8))); gain(g) = _ * ba.db2linear(g); h = hslider("headroom[unit:db]", 0, -4, 20, 1); g = hslider("gain[unit:db]", 0, -4, 20, 1); m = hslider("makeupgain[unit:db]", 0, -4, 20, 1); expo = hslider("expo", 0.5, 0.01, 2, 0.01); treshold = hslider("overdrive treshold[unit:db]", 4, -20, 12, 0.001); cap = hslider("overdrive cap[unit:db]", 2, -20, 12, 0.001) : ba.db2linear : debug(hbargraph("oc", 0, 8)); overdrive_chain = gain(g) : overdrive(expo, treshold : ba.db2linear : debug(hbargraph("ot", 0, 8)), cap) : gain(min(0, treshold) : *(-1) : debug(hbargraph("makeupgain", -10, 10)) : ba.db2linear) ; process = _ : ba.bypass_fade(ma.BS*4, checkbox("bypass"), overdrive_chain) : gain(-h) : dbmeter <: _,_; //process = overdrive(hslider("expo", 0.5, 0.01, 20, 0.01), 1.2, -1.5); //process = hslider("overdrive treshold[unit:db]", 4, -20, 4, 0.001) : ba.db2linear; ```
obsoleszenz changed title from (削除) tanh distortion for >0db signals (削除ここまで) to tanh distortion for >0db signals & overdrive 2023年10月14日 00:41:26 +02:00
obsoleszenz added this to the 0.8 milestone 2023年10月14日 01:16:48 +02:00
obsoleszenz changed title from (削除) tanh distortion for >0db signals & overdrive (削除ここまで) to Overdrive/clipping distortion to give EQUIS some character 2024年10月14日 03:52:35 +02:00
Author
Owner
Copy link

Another approach:

import("stdfaust.lib");
hardclipWithNonlinearity(l,h, in) = hardclip(l+(nonlinearityL*0.3), h+(nonlinearityL*h), in)
with {
 //nonlinearity = 0.0;
 nonlinearityL = in : fi.svf.lp(300, 1.03) : _ * 2 : ma.tanh;
};
hardclip(l,h, in) = max(min(in, h), l);
l = hslider("L[unit:db]", 0.1, -2.0, 3.0, 0.001) : ba.db2linear : _ * -1 <: attach(_, hbargraph("test", 0, 70));
h = hslider("H[unit:db]", 0.3, -2.0, 3.0, 0.001) : ba.db2linear;
gain = hslider("Gain[unit:db]", 0.0, -10.0, 8.0, 0.001) : si.smoo : ba.db2linear;
headroom = hslider("Headroom[unit:db]", 1, 0.0, 3.0, 0.001) : ba.db2linear : _ * -1 : _ + 2.0 : _ <: attach(_, hbargraph("headroom", 0, 70));
bypass = checkbox("bypass");
process = 
 _,_ 
 : par(i, 2, 
 _ 
 :_ * gain
 <:
 (
 hardclipWithNonlinearity(l, h)
 : co.compressor_mono(4, 0, 0.001, 0.02)
 ),
 hardclip(-1.0, 1.0) 
 : select2(bypass)
 : _ * headroom
 : hardclip(-1.0, 1.0) 
 ); 
Another approach: ``` import("stdfaust.lib"); hardclipWithNonlinearity(l,h, in) = hardclip(l+(nonlinearityL*0.3), h+(nonlinearityL*h), in) with { //nonlinearity = 0.0; nonlinearityL = in : fi.svf.lp(300, 1.03) : _ * 2 : ma.tanh; }; hardclip(l,h, in) = max(min(in, h), l); l = hslider("L[unit:db]", 0.1, -2.0, 3.0, 0.001) : ba.db2linear : _ * -1 <: attach(_, hbargraph("test", 0, 70)); h = hslider("H[unit:db]", 0.3, -2.0, 3.0, 0.001) : ba.db2linear; gain = hslider("Gain[unit:db]", 0.0, -10.0, 8.0, 0.001) : si.smoo : ba.db2linear; headroom = hslider("Headroom[unit:db]", 1, 0.0, 3.0, 0.001) : ba.db2linear : _ * -1 : _ + 2.0 : _ <: attach(_, hbargraph("headroom", 0, 70)); bypass = checkbox("bypass"); process = _,_ : par(i, 2, _ :_ * gain <: ( hardclipWithNonlinearity(l, h) : co.compressor_mono(4, 0, 0.001, 0.02) ), hardclip(-1.0, 1.0) : select2(bypass) : _ * headroom : hardclip(-1.0, 1.0) ); ```
Sign in to join this conversation.
No Branch/Tag specified
main
improve_subfilter_sound
fix_nix
feat_bessel_filter
feat_main_volume
fix_nixfiles
fix_linear_interpolation
feat_cueable_subfilters
feat_midi_scripting
feat_granular_logging
fix_smoothing
feat_waveshaper
feat_improve_denormalize_fq
feat_generic_midi_mapping
refactor_midi_mapping
feat_cue_b
feat_add_more_channels
cue_system
feat_canceling_cue
feat_cue_pre_eq
faust_refactoring
butterworth_filter
bessel_filter
seperation
controller_mappings
feat_state_snapshots
v0.7.1
v0.7.0
0.6.3
v0.6.3
v0.6.2
v0.6.0
v0.6.1
v0.5.2
v0.5.1
v0.5.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
OpenDJLab/EQUIS#15
Reference in a new issue
OpenDJLab/EQUIS
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?