Commit 7bdca4c0 authored by wargreen's avatar wargreen
Browse files

Fixed delay, stereo width calc, small refactor... First full working version !

parent 04aaf28e
declare name "Ambisonic Encoder";
declare version "0.1";
declare version "1.0";
declare author "Wargreen";
declare license "GPL v3";
declare copyright "(c) Wargreen 2019";
......@@ -8,23 +8,25 @@ import("stdfaust.lib");
ORD = 1;
radius = hslider("Radius (m)", 1.0, 0.01, 50, 0.01) : si.smooth(ba.tau2pole(0.02));
radius = hslider("Radius (m)", 1.0, 0.1, 50, 0.01) : si.smooth(ba.tau2pole(0.02));
azimut = (hslider("Azimut (deg)", 0, -180, 180, 0.01)) * (ma.PI/180) : si.smooth(ba.tau2pole(0.02));
//elevation = hslider("Elevation", 180, 0, 359.99, 0.01) : si.smooth(ba.tau2pole(0.02));
stereo = checkbox("Stereo input");
width = hslider("Stereo Width (deg)", 90, -180, 180, 0.01) : si.smooth(ba.tau2pole(0.02));
width = hslider("Stereo Width (deg)", 90, -180, 180, 0.01) : si.smooth(ba.tau2pole(0.02)) * (ma.PI/180);
erLvl = hslider("Early Reflection Lvl", 0, -20, 0, 0.01) : si.smooth(ba.tau2pole(0.02));
//preprocess = _;
//preprocess = fi.lowpass(1, 91930/radius) ;
preprocess = fi.highshelf( 1, 0.524*radius, 20000);
preprocess = fi.highshelf( 1, ma.neg(0.43*radius), 15000);
//delay = _;
delay = de.fdelayltv(1,ma.SR, 1/340*radius) ;
delay = de.fdelayltv(1,ma.SR, ma.SR * 1/340*radius) ;
volume(r) = 1. / (r * r * (r > 0.1) + (r < 0.1));
stereAzim(ch) = ma.neg( ba.if(stereo, ba.if(ch < 1, azimut-width/2, azimut+width/2), azimut));
encodedry(ch) = _ * ma.inv(ma.cbrt(radius))<: ho.encoder(ORD, _, ma.neg( ba.if(stereo, ba.if(ch < 1, azimut-width/2, azimut+width/2), azimut)));
encodedry(ch) = _ * volume(radius)<: ho.encoder(ORD, _, stereAzim(ch) );
encoderev(ch) = _ <: ho.encoder(ORD, _, ma.neg(ba.if(stereo, ba.if(ch < 1, azimut-width/2, azimut+width/2), azimut)));
encoderev(ch) = _ * ba.db2linear(erLvl) <: ho.encoder(ORD, _, stereAzim(ch));
addout = _,_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment