Commit 2604fe58 authored by wargreen's avatar wargreen
Browse files

Add 3D

parent 89264ce9
declare name "Ambisonic Encoder 3D";
declare version "1.0";
declare author "Wargreen";
declare license "GPL v3";
declare copyright "(c) Wargreen 2019";
import("stdfaust.lib");
ORD = 1;
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("Azimut (deg)", 0, -180, 180, 0.01)) * (ma.PI/180) : 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)) * (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, ma.neg(0.43*radius), 15000);
//delay = _;
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) = _ * volume(radius)<: ho.encoder3D(ORD, _, stereAzim(ch), elevation);
encoderev(ch) = _ * ba.db2linear(erLvl) <: ho.encoder3D(ORD, _, stereAzim(ch), elevation);
addout = _,_,_;
dryprocess = par(i, 2, delay : encodedry(i)) :> _, par(i, ORD, addout);
revlateprocess = _,_ :>_;
revearlyprocess = par(i, 2, delay : encoderev(i)) :> _, par(i, ORD, addout);
process =_, _: par(i, 2,preprocess) <: dryprocess, revlateprocess, revearlyprocess;
\ No newline at end of file
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