Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Jan 8, 2025
2 parents 2e1f3e1 + 87bc915 commit 3340a88
Show file tree
Hide file tree
Showing 204 changed files with 5,702 additions and 528 deletions.
7 changes: 7 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.234:
- addition of accelerated movement plugins (Thirsa Huisman)
- addition of shelving filter modes in filter audio plugin
- improvement of simplefdn
- improvement of simplesynth
- replace xyzgain attribute by automatic detection of 2D/3D layout

0.233.2: bugfix of tascar_spkcalib
0.233.1:
- add layer property for faces/facegroups (fholzm)
Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# variables:
VERSION=0.233.2
VERSION=0.234.0

ARCH=$(shell uname -m)

Expand Down
13 changes: 13 additions & 0 deletions examples/skyfall.tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<session license="CC0">
<scene>
<receiver type="hrtf" name="out" dlocation="0 0 100"/>
</scene>
<modules>
<skyfall actor="/scene/out" z0="12" wx="0" wy="0" wz="0"/>
<pos2osc avatar="dl" pattern="/scene/out" url="osc.udp://localhost:9877/" mode="11" transport="false"/>
<datalogging>
<osc path="/dl/out" size="6"/>
</datalogging>
</modules>
</session>
2 changes: 1 addition & 1 deletion gui/src/tascar_mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ tascar_window_t::tascar_window_t(BaseObjectType* cobject,
TASCAR::add_warning("css error: " + e.what());
}
// optionally test for running jack server and start qjackctl:
bool checkforjack = TASCAR::config("tascar.gui.checkforjack", 1);
bool checkforjack = TASCAR::config("tascar.gui.checkforjack", 0);
if(checkforjack) {
bool jack_is_running = test_for_jack_server();
if(!jack_is_running) {
Expand Down
14 changes: 7 additions & 7 deletions libtascar/include/coordinates.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ template <class T> void make_friendly_number_limited(T& x)

namespace TASCAR {

inline bool is_denormal(const double& a)
{
return !((a < 1.0) || (a > 0.0));
}
inline bool is_denormal(const double& a) { return !((a < 1.0) || (a > 0.0)); }

inline bool is_denormal(const float& a)
{
Expand All @@ -79,6 +76,9 @@ namespace TASCAR {
/// Generate random number between 0 and 1
double drand();

/// Generate random number between 0 and 1
float frand();

/**
\brief Linear interpolation table
*/
Expand Down Expand Up @@ -896,11 +896,11 @@ namespace TASCAR {
};
inline void set_euler_zyx(const zyx_euler_t& eul)
{
set_rotation(eul.x, TASCAR::posf_t(1.0f, 0.0f, 0.0f));
set_rotation((float)(eul.x), TASCAR::posf_t(1.0f, 0.0f, 0.0f));
quaternion_t q;
q.set_rotation(eul.y, TASCAR::posf_t(0.0f, 1.0f, 0.0f));
q.set_rotation((float)(eul.y), TASCAR::posf_t(0.0f, 1.0f, 0.0f));
rmul(q);
q.set_rotation(eul.z, TASCAR::posf_t(0.0f, 0.0f, 1.0f));
q.set_rotation((float)(eul.z), TASCAR::posf_t(0.0f, 0.0f, 1.0f));
rmul(q);
};
// inline void set_euler_xyz(const zyx_euler_t& eul)
Expand Down
99 changes: 54 additions & 45 deletions libtascar/include/fdn.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#define FDN_H

#include "coordinates.h"
#include "filterclass.h"
#include "fft.h"
#include "filterclass.h"

namespace TASCAR {

Expand Down Expand Up @@ -96,19 +96,27 @@ namespace TASCAR {
class reflectionfilter_t {
public:
reflectionfilter_t();
inline void filter(foa_sample_t& x)
inline void filter(foa_sample_t& x, bool use_biquad)
{
x *= B1;
x -= A2 * sy;
sy = x;
// all pass section:
foa_sample_t tmp(eta * x + sapx);
sapx = x;
x = tmp - eta * sapy;
sapy = x;
if(use_biquad) {
x.w = ap_w.filter(x.w);
x.y = ap_y.filter(x.y);
x.z = ap_z.filter(x.z);
x.x = ap_x.filter(x.x);
} else {
foa_sample_t tmp(eta * x + sapx);
sapx = x;
x = tmp - eta * sapy;
sapy = x;
}
};
void set_lp(float g, float c);
void set_eta(float e) { eta = e; };
void set_allpass(float eta, float rw, float ry, float rz, float rx,
float phase);

protected:
float B1 = 0.0f; ///< non-recursive filter coefficient for all channels
Expand All @@ -117,34 +125,10 @@ namespace TASCAR {
foa_sample_t sy; ///< output state buffer
foa_sample_t sapx; ///< input state variable of allpass filter
foa_sample_t sapy; ///< output state variable of allpass filter
};

// y[n] = -g x[n] + x[n-1] + g y[n-1]
class reflectionfilter_biquadallpass_t {
public:
reflectionfilter_biquadallpass_t();
inline void filter(foa_sample_t& x)
{
x *= B1;
x -= A2 * sy;
sy = x;
// all pass section:
x.w = ap_w.filter(x.w);
x.y = ap_y.filter(x.y);
x.z = ap_z.filter(x.z);
x.x = ap_x.filter(x.x);
};
void set_lp(float g, float c);
void set_allpass(float rw, float ry, float rz, float rx, float phase);

protected:
float B1 = 0.0f; ///< non-recursive filter coefficient for all channels
float A2 = 0.0f; ///< recursive filter coefficient for all channels
TASCAR::biquadf_t ap_w;
TASCAR::biquadf_t ap_y;
TASCAR::biquadf_t ap_z;
TASCAR::biquadf_t ap_x;
foa_sample_t sy; ///< output state buffer
};

class fdnpath_t {
Expand All @@ -170,22 +154,50 @@ namespace TASCAR {
uint32_t pos = 0u;
};

//class fdn_base_t {
//public:
// enum gainmethod_t { original, mean, schroeder };
// fdn_base_t(uint32_t fdnorder, uint32_t maxdelay, bool logdelays,
// gainmethod_t gm, bool feedback_);
// virtual ~fdn_base_t(){};
// virtual void setpar_t60(float az, float daz, float t, float dt, float t60,
// float damping, bool fixcirculantmat,
// bool truncate_forward) = 0;
// virtual void set_scatterpar(float daz, float t, float dt, float t60,
// float damping) = 0;
// virtual void set_logdelays(bool ld) { logdelays_ = ld; };
// virtual void set_zero() = 0;
// virtual void prefilt() = 0;
// bool logdelays_ = true;
// uint32_t fdnorder_ = 5u;
// uint32_t maxdelay_ = 8u;
// // feedback matrix:
// std::vector<float> feedbackmat;
// // gain calculation method:
// gainmethod_t gainmethod = original;
// // use feedback matrix:
// bool feedback = true;
// // output FOA sample:
// foa_sample_t outval;
//};

class fdn_t {
public:
enum gainmethod_t { original, mean, schroeder };
fdn_t(uint32_t fdnorder, uint32_t maxdelay, bool logdelays, gainmethod_t gm,
bool feedback_);
bool feedback_, std::vector<float> rallpass);
~fdn_t(){};
inline void process(std::vector<fdnpath_t>& src)
void set_logdelays(bool ld) { logdelays_ = ld; };
inline void process(std::vector<fdnpath_t>& src, bool use_biquad)
{
outval.set_zero();
if(feedback) {
// get output values from delayline, apply reflection filters and
// rotation:
for(auto& path : fdnpath) {
foa_sample_t tmp(path.delayline[path.pos]);
path.reflection.filter(tmp);
path.rotation.rotate(tmp);
path.reflection.filter(tmp, use_biquad);
path.dlout = tmp;
outval += tmp;
}
Expand Down Expand Up @@ -235,8 +247,8 @@ namespace TASCAR {
// rotation:
for(auto& path : fdnpath) {
foa_sample_t tmp(path.delayline[path.pos]);
path.reflection.filter(tmp);
path.rotation.rotate(tmp);
path.reflection.filter(tmp, use_biquad);
path.dlout = tmp;
outval += tmp;
}
Expand All @@ -245,33 +257,30 @@ namespace TASCAR {
void setpar_t60(float az, float daz, float t, float dt, float t60,
float damping, bool fixcirculantmat, bool truncate_forward);
void set_scatterpar(float daz, float t, float dt, float t60, float damping);
void set_logdelays(bool ld) { logdelays_ = ld; };
void set_zero()
{
for(auto& path : fdnpath)
path.set_zero();
};

// private:
bool logdelays_ = true;
uint32_t fdnorder_ = 5u;
uint32_t maxdelay_ = 8u;
// feedback matrix:
std::vector<float> feedbackmat;
// reflection filter:
reflectionfilter_t prefilt0;
reflectionfilter_t prefilt1;
// FDN path:
std::vector<fdnpath_t> fdnpath;
// gain calculation method:
gainmethod_t gainmethod = original;
// use feedback matrix:
bool feedback = true;
//

public:
// output FOA sample:
foa_sample_t outval;
// reflection filter:
reflectionfilter_t prefilt0;
reflectionfilter_t prefilt1;
// FDN path:
std::vector<fdnpath_t> fdnpath;
// allpass filter radius, requires four entries:
std::vector<float> rallpass;
};

} // namespace TASCAR
Expand Down
4 changes: 4 additions & 0 deletions libtascar/include/filterclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ namespace TASCAR {
b2_ = b2;
};
void set_pareq(double f, double fs, double gain, double q);
void set_highshelf(double f, double fs, double gain, double s);
void set_lowshelf(double f, double fs, double gain, double s);
inline double filter(double in)
{
double out = z1 + b0_ * in;
Expand Down Expand Up @@ -245,6 +247,8 @@ namespace TASCAR {
*/
void set_butterworth(float f, float fs, bool highpass = false);
void set_pareq(float f, float fs, float gain, float q);
void set_highshelf(float f, float fs, float gain, float s);
void set_lowshelf(float f, float fs, float gain, float s);
inline float filter(float in)
{
float out = z1 + b0_ * in;
Expand Down
25 changes: 13 additions & 12 deletions libtascar/include/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,21 @@ namespace TASCAR {
session_core_t(const std::string& filename_or_data, load_type_t t,
const std::string& path);
// configuration variables:
double duration;
bool loop;
bool playonload;
double levelmeter_tc;
TASCAR::levelmeter::weight_t levelmeter_weight;
double duration = 60;
bool loop = false;
bool playonload = false;
double locateonload = -1.0;
double levelmeter_tc = 2.0;
TASCAR::levelmeter::weight_t levelmeter_weight = TASCAR::levelmeter::Z;
std::string levelmeter_mode;
double levelmeter_min;
double levelmeter_range;
double requiresrate;
double warnsrate;
int32_t requirefragsize;
int32_t warnfragsize;
double levelmeter_min = 30.0;
double levelmeter_range = 70.0;
double requiresrate = 0.0;
double warnsrate = 0.0;
int32_t requirefragsize = 0;
int32_t warnfragsize = 0;
std::string initcmd;
double initcmdsleep;
double initcmdsleep = 0.0;

private:
void start_initcmd();
Expand Down
5 changes: 2 additions & 3 deletions libtascar/include/speakerarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace TASCAR {
spk_array_t(const spk_array_t&);

public:
enum dffusedecoder_t { basic, maxre, inphase };
double get_rmax() const { return rmax; };
double get_rmin() const { return rmin; };
class didx_t {
Expand All @@ -116,7 +117,7 @@ namespace TASCAR {
private:
double rmax;
double rmin;
float xyzgain;
dffusedecoder_t diffusedecoder_enum = maxre;
std::string onload;
std::string onunload;
std::vector<didx_t> didx;
Expand Down Expand Up @@ -212,8 +213,6 @@ namespace TASCAR {
// lowpass filters for subwoofer (24 dB/Oct):
std::vector<TASCAR::biquadf_t> flt_lowp1;
std::vector<TASCAR::biquadf_t> flt_lowp2;
// allpass filters for transition phase matching, broad band speakers:
//std::vector<TASCAR::biquad_t> flt_allp;
std::vector<std::vector<float>> subweight;
std::vector<std::string>
convolution_ir; //< file name of impulse response for convolution
Expand Down
11 changes: 6 additions & 5 deletions libtascar/src/acousticmodel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ uint32_t acoustic_model_t::process(const TASCAR::transport_t& tp)
return 1;
}
} // of visible
} // of layers check
} // of ISM order check
} // of layers check
} // of ISM order check
} else {
delayline.add_chunk(audio);
}
Expand Down Expand Up @@ -631,8 +631,9 @@ void receiver_t::configure()
scatter_handle = create_diffuse_state_data(f_sample, n_fragment);
scatterfilterpath.resize(scatterreflections);
if(scatterreflections > 0) {
scatterfilter = new TASCAR::fdn_t(scatterreflections, (uint32_t)f_sample,
true, TASCAR::fdn_t::mean, false);
scatterfilter =
new TASCAR::fdn_t(scatterreflections, (uint32_t)f_sample, true,
TASCAR::fdn_t::mean, false, {0.0f, 0.0f, 0.0f, 0.0f});
scatterfilter->set_scatterpar(
scatterspread, f_sample * (0.1f * scatterstructuresize / 340.0f),
f_sample * (scatterstructuresize / 340.0f), f_sample,
Expand Down Expand Up @@ -750,7 +751,7 @@ void receiver_t::postproc(std::vector<wave_t>& output)
// path.dlout = x;
++kflt;
}
scatterfilter->process(scatterfilterpath);
scatterfilter->process(scatterfilterpath, false);
scatterbuffer->w()[k] = scatterfilter->outval.w;
scatterbuffer->x()[k] = scatterfilter->outval.x;
scatterbuffer->y()[k] = scatterfilter->outval.y;
Expand Down
7 changes: 6 additions & 1 deletion libtascar/src/coordinates.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ using namespace TASCAR;

double TASCAR::drand()
{
return (double)rand() / (double)(RAND_MAX + 1.0);
return (double)rand() / ((double)RAND_MAX + 1.0);
}

float TASCAR::frand()
{
return (float)rand() / ((float)RAND_MAX + 1.0f);
}

std::string pos_t::print_cart(const std::string& delim) const
Expand Down
Loading

0 comments on commit 3340a88

Please sign in to comment.