Skip to content

Commit

Permalink
bessel i0 fix and others
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Aug 21, 2018
1 parent 072e2fe commit 6942c4e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 16 deletions.
8 changes: 2 additions & 6 deletions dsp/v4f_IIR2.h
Expand Up @@ -32,10 +32,6 @@

namespace DSP {

#ifdef __APPLE__
inline float pow10f(float f) {return pow(10,f);}
#endif

class RBJv4
{
public:
Expand Down Expand Up @@ -142,7 +138,7 @@ class IIR2v4
/* A = pow (10, gain / 40) */
v4f_t A = (v4f_t) {.025,.025,.025,.025};
A *= gain;
A = v4f_map<pow10f> (A);
A = v4f_map<exp10f> (A);

RBJv4 p (f, Q);

Expand Down Expand Up @@ -429,7 +425,7 @@ class IIR2v4Bank
/* A = pow (10, gain / 40) */
v4f_t A = (v4f_t) {.025,.025,.025,.025};
A *= gain[i];
A = v4f_map<pow10f> (A);
A = v4f_map<exp10f> (A);

RBJv4 p (f[i], Q[i]);

Expand Down
12 changes: 12 additions & 0 deletions dsp/windows.cc
@@ -0,0 +1,12 @@
#include "../basics.h"
#include "../dsp/windows.h"
#include <boost/math/special_functions/bessel.hpp>

namespace DSP {

double besseli (double x)
{
return boost::math::cyl_bessel_i(0.0, x);
}

} // namespace DSP
11 changes: 6 additions & 5 deletions dsp/windows.h
Expand Up @@ -28,6 +28,8 @@
#ifndef DSP_WINDOWS_H
#define DSP_WINDOWS_H

#include "Sine.h"

namespace DSP {

/* prototypes for window value application ... */
Expand Down Expand Up @@ -112,6 +114,9 @@ blackman_harris (sample_t * s, int n)
}

/* helper for the kaiser window, courtesy of R. Dobson, courtesy of csound */
#if 1
double besseli (double x);
#else
inline double
besseli (double x)
{
Expand Down Expand Up @@ -146,6 +151,7 @@ besseli (double x)
return ans;
}
#endif

/* step = .5 : window [-n to 0] */
template <window_sample_func_t F>
Expand All @@ -158,11 +164,6 @@ kaiser (sample_t * s, int n, double beta, double step = 1)
for (double i = -n / 2 + .1; si < n; ++si, i += step)
{
double k = besseli ((beta * sqrt (1 - pow ((2 * i / (n - 1)), 2)))) / bb;

/* can you spell hack */
if (!finite (k) || isnan(k))
k = 0;

F (s[si], k);
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/mod-caps-AmpVTS.lv2/Makefile
Expand Up @@ -17,7 +17,7 @@ endif
CXXFLAGS += $(OPTS) -I../.. -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS += -shared -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined

SOURCES = ../../Amp.cc ../../ToneStack.cc ../../dsp/polynomials.cc interface.cc
SOURCES = ../../Amp.cc ../../ToneStack.cc ../../dsp/polynomials.cc ../../dsp/windows.cc interface.cc
OBJECTS = $(SOURCES:.cc=.o)

PLUG = AmpVTS
Expand Down
2 changes: 1 addition & 1 deletion plugins/mod-caps-CabinetIV.lv2/Makefile
Expand Up @@ -17,7 +17,7 @@ endif
CXXFLAGS += $(OPTS) -I../.. -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS += -shared -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined

SOURCES = ../../CabIV.cc ../../dsp/polynomials.cc interface.cc
SOURCES = ../../CabIV.cc ../../dsp/polynomials.cc ../../dsp/windows.cc interface.cc
OBJECTS = $(SOURCES:.cc=.o)

PLUG = CabinetIV
Expand Down
2 changes: 1 addition & 1 deletion plugins/mod-caps-Compress.lv2/Makefile
Expand Up @@ -17,7 +17,7 @@ endif
CXXFLAGS += $(OPTS) -I../.. -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS += -shared -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined

SOURCES = ../../Compress.cc ../../dsp/polynomials.cc interface.cc
SOURCES = ../../Compress.cc ../../dsp/polynomials.cc ../../dsp/windows.cc interface.cc
OBJECTS = $(SOURCES:.cc=.o)

PLUG = Compress
Expand Down
2 changes: 1 addition & 1 deletion plugins/mod-caps-CompressX2.lv2/Makefile
Expand Up @@ -17,7 +17,7 @@ endif
CXXFLAGS += $(OPTS) -I../.. -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS += -shared -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined

SOURCES = ../../Compress.cc ../../dsp/polynomials.cc interface.cc
SOURCES = ../../Compress.cc ../../dsp/polynomials.cc ../../dsp/windows.cc interface.cc
OBJECTS = $(SOURCES:.cc=.o)

PLUG = CompressX2
Expand Down
2 changes: 1 addition & 1 deletion plugins/mod-caps-Saturate.lv2/Makefile
Expand Up @@ -17,7 +17,7 @@ endif
CXXFLAGS += $(OPTS) -I../.. -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS += -shared -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--no-undefined

SOURCES = ../../Saturate.cc ../../dsp/polynomials.cc interface.cc
SOURCES = ../../Saturate.cc ../../dsp/polynomials.cc ../../dsp/windows.cc interface.cc
OBJECTS = $(SOURCES:.cc=.o)

PLUG = Saturate
Expand Down

0 comments on commit 6942c4e

Please sign in to comment.