Skip to content

Commit

Permalink
add diffusion to 2>5 upmixes, and square mode of 2>7 upmix
Browse files Browse the repository at this point in the history
  • Loading branch information
junh1024 committed May 11, 2024
1 parent 8d4d64d commit 774fc5f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 5 deletions.
28 changes: 26 additions & 2 deletions Converters/2.0 to 5.0 Upmix V3 (L).txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ desc: 2.0 to 5.0 Surround upscale BETA
slider1:0<0,100,2>Width
slider2:0<-100,100,1>Depth
slider3:90<0,180,2>Rear threshold
slider4:90<0,180,2>Crossover width
slider4:90<0,240,2>Crossover and diffusion (deg)
slider5:50<0,100,2>Rear Width
slider6:50<0,100,1>Rear LP
slider7:0 <0,100,2>Rear transients
Expand Down Expand Up @@ -48,7 +48,14 @@ sliderfft = (2^(slider8))|0;
fftsize != sliderfft ? fft_initialize();

Rear_threshold= slider3*pi/180;
Crossover_width=max(slider4*pi/180,0.1);//min of 0.1 since don't want an infinite slope/div 0

// crossover & diffusion

Crossover_width=min(max(slider4*pi/180,0.1),pi);//min of 0.1 since don't want an infinite slope/div 0
// cap to pi to separate crossover & diffusion

diffusion_amount=max( (slider4/180) -1,0); //clamp to >0

width_coeff=slider1/100;

depth_coeff=(slider2*$pi)/200; //depth scaled from 0-100 to 0>half pi
Expand Down Expand Up @@ -288,6 +295,23 @@ pos += 2;
pos2=(pos2+2)%(fftsize*2);


// crossover & diffusion

L_diff=(spl0-spl4)*0.5;
R_diff=(spl1-spl5)*0.5;

spl0-=L_diff*(diffusion_amount);
spl4+=L_diff*(diffusion_amount);

spl1-=R_diff*(diffusion_amount);
spl5+=R_diff*(diffusion_amount);

C_diff=((spl0+spl1)*0.5)-spl2;
spl0-=C_diff*(diffusion_amount);
spl1-=C_diff*(diffusion_amount);
spl2+=C_diff*(diffusion_amount)*1.414; // sqrt2 needed for c since it's only a single channel


do_width(width_coeff);
do_depth(depth_coeff);
do_cross_width(R_width_coeff);
Expand Down
33 changes: 31 additions & 2 deletions Converters/2.0 to 5.0 Upmix V3 (S).txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ desc: 2.0 to 5.0 Surround upscale (Small) BETA
slider1:0<0,100,2>Width
slider2:0<-100,100,1>Depth
slider3:90<0,180,2>-Rear threshold
slider4:90<0,180,2>-Crossover width
slider4:180<0,240,2>Crossover and diffusion (deg)
slider5:50<0,100,2>-Rear Width
slider6:50<0,100,1>Rear LP
slider7:0 <0,100,2>-Rear transients
Expand Down Expand Up @@ -45,7 +45,17 @@ sliderfft = (2^(slider8))|0;
fftsize != sliderfft ? fft_initialize();

Rear_threshold= slider3*pi/180;
Crossover_width=max(slider4*pi/180,0.1);//min of 0.1 since don't want an infinite slope/div 0

// crossover & diffusion

Crossover_width=min(max(slider4*pi/180,0.1),pi);//min of 0.1 since don't want an infinite slope/div 0
// cap to pi to separate crossover & diffusion

diffusion_amount=max( (slider4/180) -1,0); //clamp to >0

slider4<180?slider4=180; // map old slider


width_coeff=slider1/100;

depth_coeff=(slider2*$pi)/200; //depth scaled from 0-100 to 0>half pi
Expand Down Expand Up @@ -274,6 +284,25 @@ pos += 2;
pos2=(pos2+2)%(fftsize*2);




// crossover & diffusion
// blend front & back channels
L_diff=(spl0-spl4)*0.5;
R_diff=(spl1-spl5)*0.5;

spl0-=L_diff*(diffusion_amount);
spl4+=L_diff*(diffusion_amount);

spl1-=R_diff*(diffusion_amount);
spl5+=R_diff*(diffusion_amount);
// blend phantom C & real C
C_diff=((spl0+spl1)*0.5)-spl2;
spl0-=C_diff*(diffusion_amount);
spl1-=C_diff*(diffusion_amount);
spl2+=C_diff*(diffusion_amount)*1.414; // sqrt2 needed for c since it's only a single channel


do_width(width_coeff);
do_depth(depth_coeff);
// do_cross_width(R_width_coeff);
Expand Down
18 changes: 17 additions & 1 deletion Converters/5.1 to 7.1 Upmix V3 (L).txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,24 @@ mode==1?
pos += 2;
pos2=(pos2+2)%(fftsize*2);

mode > 1 ?

mode == 0?
(
// blend corners & sides
L_diff=((spl0+spl4)*0.5)-spl6;
spl0-=L_diff*(diffuse_amount);
spl4-=L_diff*(diffuse_amount);
spl6+=L_diff*(diffuse_amount)*1.414; // sqrt2 needed for SL since it's only a single channel

R_diff=((spl1+spl5)*0.5)-spl7;
spl1-=R_diff*(diffuse_amount);
spl5-=R_diff*(diffuse_amount);
spl7+=R_diff*(diffuse_amount)*1.414;

)
:
(
// blend sides & back
L_diff=(spl6-spl4)*0.5;
R_diff=(spl7-spl5)*0.5;

Expand Down

0 comments on commit 774fc5f

Please sign in to comment.