aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease/src
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/fftease/src')
-rw-r--r--externals/grill/fftease/src/burrow~.cpp107
-rw-r--r--externals/grill/fftease/src/convert.c134
-rw-r--r--externals/grill/fftease/src/cross~.cpp92
-rw-r--r--externals/grill/fftease/src/dentist~.cpp149
-rw-r--r--externals/grill/fftease/src/disarray~.cpp164
-rw-r--r--externals/grill/fftease/src/drown~.cpp50
-rw-r--r--externals/grill/fftease/src/ether~.cpp87
-rw-r--r--externals/grill/fftease/src/fft.c157
-rw-r--r--externals/grill/fftease/src/fft4.c340
-rw-r--r--externals/grill/fftease/src/fftease.cpp236
-rw-r--r--externals/grill/fftease/src/fold.c67
-rw-r--r--externals/grill/fftease/src/leanconvert.c84
-rw-r--r--externals/grill/fftease/src/main.cpp51
-rw-r--r--externals/grill/fftease/src/main.h110
-rw-r--r--externals/grill/fftease/src/makewindows.c190
-rw-r--r--externals/grill/fftease/src/morphine~.cpp119
-rw-r--r--externals/grill/fftease/src/pv.h65
-rw-r--r--externals/grill/fftease/src/pvoc~.cpp130
-rw-r--r--externals/grill/fftease/src/scrape~.cpp154
-rw-r--r--externals/grill/fftease/src/shapee~.cpp88
-rw-r--r--externals/grill/fftease/src/swinger~.cpp64
-rw-r--r--externals/grill/fftease/src/taint~.cpp99
-rw-r--r--externals/grill/fftease/src/thresher~.cpp112
-rw-r--r--externals/grill/fftease/src/vacancy~.cpp134
-rw-r--r--externals/grill/fftease/src/xsyn~.cpp50
25 files changed, 0 insertions, 3033 deletions
diff --git a/externals/grill/fftease/src/burrow~.cpp b/externals/grill/fftease/src/burrow~.cpp
deleted file mode 100644
index 01564618..00000000
--- a/externals/grill/fftease/src/burrow~.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-
-
-class burrow:
- public fftease
-{
- FLEXT_HEADER_S(burrow,fftease,setup)
-
-public:
- burrow(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I _N2,S *const *in);
-
- BL _invert;
-
- F _threshold,_multiplier;
- F _thresh_dB,_mult_dB;
-
-private:
- V ms_thresh(F v) { _threshold = FromdB(_thresh_dB = v); }
- V ms_mult(F v) { _multiplier = FromdB(_mult_dB = v); }
-
-
- static V setup(t_classid c);
-
- FLEXT_ATTRGET_F(_thresh_dB)
- FLEXT_CALLSET_F(ms_thresh)
- FLEXT_ATTRGET_F(_mult_dB)
- FLEXT_CALLSET_F(ms_mult)
- FLEXT_ATTRVAR_B(_invert)
-};
-
-FLEXT_LIB_DSP_V("burrow~",burrow)
-
-
-V burrow::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR(c,"thresh",_thresh_dB,ms_thresh);
- FLEXT_CADDATTR_VAR(c,"mult",_mult_dB,ms_mult);
- FLEXT_CADDATTR_VAR1(c,"invert",_invert);
-}
-
-
-burrow::burrow(I argc,const t_atom *argv):
- fftease(4,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_NOPH2),
- _invert(false),
- _thresh_dB(-30),_mult_dB(-18)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _thresh_dB = GetAFloat(argv[0]);
- else
- post("%s - Threshold must be a float value - set to %0f",thisName(),_thresh_dB);
- }
- if(argc >= 2) {
- if(CanbeFloat(argv[1]))
- _mult_dB = GetAFloat(argv[1]);
- else
- post("%s - Multiplier must be a float value - set to %0f",thisName(),_mult_dB);
- }
- if(argc >= 3) {
- if(CanbeBool(argv[2]))
- _invert = GetABool(argv[2]);
- else
- post("%s - Invert flag must be a boolean value - set to %i",thisName(),_invert?1:0);
- }
-
- ms_thresh(_thresh_dB);
- ms_mult(_mult_dB);
-
- AddInSignal("Messages and input signal");
- AddInSignal("Reference signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V burrow::Transform(I _N,S *const *)
-{
- register const F thr = _threshold,mul = _multiplier;
-
- // use simple threshold from second signal to trigger filtering
- // transform does not need phase of signal 2
-
- if(_invert)
- for (I i = 0; i <= _N; i += 2)
- if(_channel2[i] < thr) _channel1[i] *= mul;
- else
- for (I i = 0; i <= _N; i += 2)
- if(_channel2[i] > thr) _channel1[i] *= mul;
-}
-
-
-
diff --git a/externals/grill/fftease/src/convert.c b/externals/grill/fftease/src/convert.c
deleted file mode 100644
index 006e4cf7..00000000
--- a/externals/grill/fftease/src/convert.c
+++ /dev/null
@@ -1,134 +0,0 @@
-#include "pv.h"
-
-/* S is a spectrum in rfft format, i.e., it contains N real values
- arranged as real followed by imaginary values, except for first
- two values, which are real parts of 0 and Nyquist frequencies;
- convert first changes these into N/2+1 PAIRS of magnitude and
- phase values to be stored in output array C; the phases are then
- unwrapped and successive phase differences are used to compute
- estimates of the instantaneous frequencies for each phase vocoder
- analysis channel; decimation rate D and sampling rate R are used
- to render these frequency values directly in Hz. */
-
-void convert(float *S, float *C, int N2, float *lastphase, float fundamental, float factor )
-{
-#if 1
- float phase,phasediff;
- int even,odd;
- float a,b;
- int i;
-
- for ( i = 0; i <= N2; i++ ) {
- odd = ( even = i<<1 ) + 1;
- a = ( i == N2 ? S[1] : S[even] );
- b = ( i == 0 || i == N2 ? 0. : S[odd] );
-
- C[even] = hypot( a, b );
- if ( C[even] == 0. )
- phasediff = 0.;
- else {
- phase = -atan2( b, a );
- phasediff = fmod(phase - lastphase[i] + (PV_2PI+PV_PI), PV_2PI)-PV_PI;
- lastphase[i] = phase;
- }
-
- C[odd] = phasediff*factor + i*fundamental;
- }
-#else
- float phase,
- phasediff;
- int real,
- imag,
- amp,
- freq;
- float a,
- b;
- int i;
-
- float myTWOPI, myPI;
-
- myTWOPI = 8.*atan(1.);
- myPI = 4.*atan(1.);
-
-
- for ( i = 0; i <= N2; i++ ) {
- imag = freq = ( real = amp = i<<1 ) + 1;
- a = ( i == N2 ? S[1] : S[real] );
- b = ( i == 0 || i == N2 ? 0. : S[imag] );
-
- C[amp] = hypot( a, b );
- if ( C[amp] == 0. )
- phasediff = 0.;
- else {
- phasediff = ( phase = -atan2( b, a ) ) - lastphase[i];
- lastphase[i] = phase;
-
- // TG: DANGEROUS!!!! (and slow, if lastphase not correctly initialized)
- while ( phasediff > myPI )
- phasediff -= myTWOPI;
- while ( phasediff < -myPI )
- phasediff += myTWOPI;
- }
- C[freq] = phasediff*factor + i*fundamental;
- /*
- if( i > 8 && i < 12 ) {
- fprintf(stderr,"convert freq %d: %f\n",i, C[freq]);
- }
- */
- }
-#endif
-}
-
-
-void unconvert(float *C, float *S, int N2, float *lastphase, float fundamental, float factor )
-{
-#if 1
- int i,even,odd;
- float mag,phase;
-
- for ( i = 0; i <= N2; i++ ) {
- odd = ( even = i<<1 ) + 1;
-
- mag = C[even];
- lastphase[i] += C[odd] - i*fundamental;
- phase = lastphase[i]*factor;
-
- if(i != N2) {
- S[even] = mag*cos( phase );
- S[odd] = -mag*sin( phase );
- }
- else
- S[1] = mag*cos( phase );
- }
-#else
- int i,
- real,
- imag,
- amp,
- freq;
- float mag,
- phase;
-
- for ( i = 0; i <= N2; i++ ) {
-
- imag = freq = ( real = amp = i<<1 ) + 1;
-
- if ( i == N2 )
- real = 1;
-
- mag = C[amp];
- lastphase[i] += C[freq] - i*fundamental;
- phase = lastphase[i]*factor;
- S[real] = mag*cos( phase );
-
- if ( i != N2 )
- S[imag] = -mag*sin( phase );
- /*
- if( i == 10 ) {
- fprintf(stderr,"unconvert: amp: %f freq: %f funda %f fac %f\n", C[amp],C[freq],fundamental,factor);
- }
- */
- }
-
-#endif
-}
diff --git a/externals/grill/fftease/src/cross~.cpp b/externals/grill/fftease/src/cross~.cpp
deleted file mode 100644
index cdbd9d0a..00000000
--- a/externals/grill/fftease/src/cross~.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-
-
-class cross:
- public fftease
-{
- FLEXT_HEADER_S(cross,fftease,setup)
-
-public:
- cross();
-
-protected:
-
- F *amps;
- BL memory;
-
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
-
- virtual V Transform(I _N2,S *const *in);
-
-private:
- static V setup(t_classid c);
-
- FLEXT_ATTRVAR_B(memory)
-};
-
-FLEXT_LIB_DSP("cross~",cross)
-
-
-V cross::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR1(c,"memorize",memory);
-}
-
-cross::cross():
- fftease(2,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_NOPH2),
- memory(true)
-{
- AddInSignal("Messages and driver signal");
- AddInSignal("Filter signal");
- AddInSignal("Threshold signal for cross synthesis");
- AddOutSignal("Transformed signal");
-}
-
-V cross::Clear()
-{
- amps = NULL;
- fftease::Clear();
-}
-
-V cross::Delete()
-{
- fftease::Delete();
- if(amps) delete[] amps;
-}
-
-V cross::Set()
-{
- fftease::Set();
- const I _N2 = get_N()/2;
- amps = new F[_N2];
- ZeroMem(amps,_N2*sizeof(*amps));
-}
-
-V cross::Transform(I _N,S *const *in)
-{
- // filled only once per signal vector!!
- register const F threshie = *in[0];
- F *amp = amps;
-
- for (I i = 0; i <= _N; i += 2,amp++)
- if( _channel2[i] > threshie )
- *amp = _channel1[i] *= _channel2[i];
- else if(memory)
- // retrieve previous value
- _channel1[i] = *amp;
-
-}
-
diff --git a/externals/grill/fftease/src/dentist~.cpp b/externals/grill/fftease/src/dentist~.cpp
deleted file mode 100644
index 99d111bb..00000000
--- a/externals/grill/fftease/src/dentist~.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class dentist:
- public fftease
-{
- FLEXT_HEADER_S(dentist,fftease,setup)
-
-public:
- dentist(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I _N2,S *const *in);
-
- BL *_bin_selection;
- I _teeth;
- F _knee;
- I _max_bin; // determined by _knee and fundamental frequency
-
- V reset_shuffle();
-
-private:
-
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
-
- V ms_knee(F knee);
- V ms_teeth(I teeth) { _teeth = teeth; reset_shuffle(); }
-
-
- static V setup(t_classid c);
-
- FLEXT_CALLBACK(reset_shuffle)
- FLEXT_ATTRGET_F(_knee)
- FLEXT_CALLSET_F(ms_knee)
- FLEXT_ATTRGET_I(_teeth)
- FLEXT_CALLSET_I(ms_teeth)
-};
-
-FLEXT_LIB_DSP_V("dentist~",dentist)
-
-
-V dentist::setup(t_classid c)
-{
- FLEXT_CADDBANG(c,0,reset_shuffle);
-
- FLEXT_CADDATTR_VAR(c,"knee",_knee,ms_knee);
- FLEXT_CADDATTR_VAR(c,"teeth",_teeth,ms_teeth);
-}
-
-
-dentist::dentist(I argc,const t_atom *argv):
- fftease(4,F_BALANCED|F_BITSHUFFLE),
- _teeth(10),_knee(500),_max_bin(0)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _knee = GetAFloat(argv[0]);
- else
- post("%s - Knee must be a float value - set to %0f",thisName(),_knee);
- }
- if(argc >= 2) {
- if(CanbeInt(argv[1]))
- _teeth = GetAInt(argv[1]);
- else
- post("%s - Teeth must be an integer value - set to %0i",thisName(),_teeth);
- }
-
- AddInSignal("Messages and input signal");
- AddOutSignal("Transformed signal");
-}
-
-V dentist::Clear()
-{
- _bin_selection = NULL;
- fftease::Clear();
-}
-
-V dentist::Delete()
-{
- fftease::Delete();
- if(_bin_selection) delete[] _bin_selection;
-}
-
-
-V dentist::ms_knee(F f)
-{
- _knee = f; // store original
-
- const F funda = get_Fund();
-
- // TG: This is a different, but steady correction than in original fftease
- if( f < funda ) f = funda;
- else if(f > Samplerate()/2) f = Samplerate()/2;
-
- _max_bin = (I)(f/funda+0.5);
-
- reset_shuffle();
-}
-
-
-V dentist::Set()
-{
- fftease::Set();
-
- _bin_selection = new BL[get_N()/2];
-
- // calculation of _max_bin
- ms_knee(_knee);
-}
-
-V dentist::Transform(I _N,S *const *)
-{
- const BL *bs = _bin_selection;
- for(I i = 0; i < _N ; i += 2)
- if(!*(bs++)) _channel1[i] = 0;
-}
-
-
-V dentist::reset_shuffle()
-{
- const I _N2 = get_N()/2;
- I t = _teeth;
-
- // check number of teeth
- if( t < 0 ) t = 0;
- else if( t > _N2 ) t = _N2;
-
- // clear and set random bins
- I i;
- for( i = 0; i < _N2; i++ )
- _bin_selection[i] = false;
- for( i = 0; i < t; i++ )
- _bin_selection[rand()%_max_bin] = true;
-}
diff --git a/externals/grill/fftease/src/disarray~.cpp b/externals/grill/fftease/src/disarray~.cpp
deleted file mode 100644
index 342d45fc..00000000
--- a/externals/grill/fftease/src/disarray~.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class disarray:
- public fftease
-{
- FLEXT_HEADER_S(disarray,fftease,setup)
-
-public:
- disarray(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I _N2,S *const *in);
-
- BL _qual;
- I _shuffle_count,_max_bin;
- F _freq;
- I *_shuffle_in,*_shuffle_out;
-
- V reset_shuffle();
-
-private:
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
-
- V ms_freq(F f);
-
- static V setup(t_classid c);
-
- FLEXT_CALLBACK(reset_shuffle)
- FLEXT_ATTRGET_F(_freq)
- FLEXT_CALLSET_F(ms_freq)
- FLEXT_ATTRVAR_I(_shuffle_count)
-};
-
-FLEXT_LIB_DSP_V("disarray~",disarray)
-
-
-V disarray::setup(t_classid c)
-{
- FLEXT_CADDBANG(c,0,reset_shuffle);
-
- FLEXT_CADDATTR_VAR(c,"knee",_freq,ms_freq);
- FLEXT_CADDATTR_VAR1(c,"partials",_shuffle_count);
-}
-
-
-disarray::disarray(I argc,const t_atom *argv):
- fftease(2,F_BITSHUFFLE),
- _qual(false),_shuffle_count(20),_max_bin(0),_freq(1300)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _freq = GetAFloat(argv[0]);
- else
- post("%s - Freq must be a float value - set to %0f",thisName(),_freq);
- }
- if(argc >= 2) {
- if(CanbeBool(argv[1]))
- _qual = GetABool(argv[1]);
- else
- post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0);
- }
- if(argc >= 3) {
- if(CanbeInt(argv[2]))
- _shuffle_count = GetAInt(argv[2]);
- else
- post("%s - Partials must be an integer value - set to %0i",thisName(),_shuffle_count);
- }
-
- Mult(_qual?4:2);
- if(_qual) _flags |= F_BALANCED;
-
- AddInSignal("Messages and input signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V disarray::Clear()
-{
- _shuffle_in = _shuffle_out = NULL;
- fftease::Clear();
-}
-
-V disarray::Delete()
-{
- fftease::Delete();
- if(_shuffle_in) delete[] _shuffle_in;
- if(_shuffle_out) delete[] _shuffle_out;
-}
-
-V disarray::Set()
-{
- fftease::Set();
-
- const I _N2 = get_N()/2;
-
- _shuffle_in = new I[_N2];
- _shuffle_out = new I[_N2];
-
- // calculate _max_bin
- ms_freq(_freq);
-}
-
-V disarray::ms_freq(F f)
-{
- _freq = f; // store original
-
- const F funda = get_Fund();
-
- // TG: This is a different, but steady correction than in original fftease
- if( f < funda ) f = funda;
- else if(f > Samplerate()/2) f = Samplerate()/2;
-
- _max_bin = (I)(f/funda+0.5);
-
- reset_shuffle();
-}
-
-inline V swap(F &a,F &b) { F t = a; a = b; b = t; }
-inline V swap(I &a,I &b) { I t = a; a = b; b = t; }
-
-V disarray::Transform(I _N,S *const *)
-{
- I shcnt = _shuffle_count;
- if(shcnt < 0) shcnt = 0;
- else if(shcnt > _N/2) shcnt = _N/2;
-
- for(I i = 0; i < shcnt; i++)
- // leave phase, just swap amplitudes
- swap(_channel1[ _shuffle_in[i] * 2 ],_channel1[ _shuffle_out[i] * 2]);
-}
-
-
-V disarray::reset_shuffle()
-{
- const I _N2 = get_N()/2;
-
- I i;
- for( i = 0; i < _N2; i++ )
- _shuffle_out[i] = _shuffle_in[i] = i ;
-
- for( i = 0; i < _max_bin*2; i++ ) {
- I p1 = _shuffle_out[ rand()%_max_bin ];
- I p2 = _shuffle_out[ rand()%_max_bin ];
- swap(_shuffle_out[ p1 ],_shuffle_out[ p2 ]);
- }
-
-}
-
diff --git a/externals/grill/fftease/src/drown~.cpp b/externals/grill/fftease/src/drown~.cpp
deleted file mode 100644
index 2f59cc0a..00000000
--- a/externals/grill/fftease/src/drown~.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class drown:
- public fftease
-{
- FLEXT_HEADER(drown,fftease)
-
-public:
- drown();
-
-protected:
- virtual V Transform(I n,S *const *in);
-};
-
-FLEXT_LIB_DSP("drown~ denude~",drown)
-
-
-drown::drown():
- fftease(4,F_BALANCED)
-{
- AddInSignal("Messages and input signal");
- AddInSignal("Threshold generator signal");
- AddInSignal("Multiplier signal for weak bins");
- AddOutSignal("Transformed signal");
-}
-
-
-V drown::Transform(I _N,S *const *in)
-{
- // only first value of the signal vectors
- const F thresh = *in[0],mult = *in[1];
-
- // make up low amplitude bins
- for (I i = 0; i <= _N; i += 2)
- if(_channel1[i] < thresh) _channel1[i] *= mult;
-}
-
-
diff --git a/externals/grill/fftease/src/ether~.cpp b/externals/grill/fftease/src/ether~.cpp
deleted file mode 100644
index 6e4d3810..00000000
--- a/externals/grill/fftease/src/ether~.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class ether:
- public fftease
-{
- FLEXT_HEADER_S(ether,fftease,setup)
-
-public:
- ether(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I n,S *const *in);
-
- BL _qual,_invert;
- F _threshMult;
-
-private:
- static V setup(t_classid c);
-
-
- FLEXT_ATTRVAR_B(_invert)
- FLEXT_ATTRVAR_F(_threshMult)
-};
-
-FLEXT_LIB_DSP_V("ether~",ether)
-
-
-V ether::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR1(c,"invert",_invert);
- FLEXT_CADDATTR_VAR1(c,"index",_threshMult);
-}
-
-
-ether::ether(I argc,const t_atom *argv):
- fftease(2,F_STEREO|F_BITSHUFFLE),
- _qual(false),_invert(false),_threshMult(0)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeBool(argv[0]))
- _qual = GetABool(argv[0]);
- else
- post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0);
- }
-
- Mult(_qual?4:2);
- if(_qual) _flags |= F_BALANCED;
-
- AddInSignal("Messages and input signal");
- AddInSignal("Reference signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V ether::Transform(I _N,S *const *)
-{
- const BL inv = _invert;
- const F threshMult = _threshMult?_threshMult:1;
-
- for (I i = 0; i <= _N; i += 2) {
- F &amp1 = _channel1[i];
- F &phase1 = _channel1[i+1];
-
- F &amp2 = _channel2[i];
- F &phase2 = _channel2[i+1];
-
- // use simple threshold for inverse compositing
-
- if(inv?(amp1 > amp2*threshMult):(amp1 < amp2*threshMult) ) amp1 = amp2;
- if (phase1 == 0. ) phase1 = phase2;
- }
-}
-
diff --git a/externals/grill/fftease/src/fft.c b/externals/grill/fftease/src/fft.c
deleted file mode 100644
index 844cddd5..00000000
--- a/externals/grill/fftease/src/fft.c
+++ /dev/null
@@ -1,157 +0,0 @@
-#include "pv.h"
-
-
-/* If forward is true, rfft replaces 2*N real data points in x with
- N complex values representing the positive frequency half of their
- Fourier spectrum, with x[1] replaced with the real part of the Nyquist
- frequency value. If forward is false, rfft expects x to contain a
- positive frequency spectrum arranged as before, and replaces it with
- 2*N real values. N MUST be a power of 2. */
-static void
-bitreverse( float *x, int N );
-
-static float sqr(float x) { return x*x; }
-
-void pv_rfft( float *x, int N, int forward )
-{
- float c1,c2,
- h1r,h1i,
- h2r,h2i,
- wr,wi,
- wpr,wpi,
- temp,
- theta;
- float xr,xi;
- int i,
- i1,i2,i3,i4,
- N2p1;
- static int first = 1;
-
- if ( first ) {
-
- first = 0;
- }
- theta = PV_PI/N;
- wr = 1.;
- wi = 0.;
- c1 = 0.5;
- if ( forward ) {
- c2 = -0.5;
- pv_cfft( x, N, forward );
- xr = x[0];
- xi = x[1];
- } else {
- c2 = 0.5;
- theta = -theta;
- xr = x[1];
- xi = 0.;
- x[1] = 0.;
- }
- wpr = -2.*sqr( sin( 0.5*theta ));
- wpi = sin( theta );
- N2p1 = (N<<1) + 1;
- for ( i = 0; i <= N>>1; i++ ) {
- i1 = i<<1;
- i2 = i1 + 1;
- i3 = N2p1 - i2;
- i4 = i3 + 1;
- if ( i == 0 ) {
- h1r = c1*(x[i1] + xr );
- h1i = c1*(x[i2] - xi );
- h2r = -c2*(x[i2] + xi );
- h2i = c2*(x[i1] - xr );
- x[i1] = h1r + wr*h2r - wi*h2i;
- x[i2] = h1i + wr*h2i + wi*h2r;
- xr = h1r - wr*h2r + wi*h2i;
- xi = -h1i + wr*h2i + wi*h2r;
- } else {
- h1r = c1*(x[i1] + x[i3] );
- h1i = c1*(x[i2] - x[i4] );
- h2r = -c2*(x[i2] + x[i4] );
- h2i = c2*(x[i1] - x[i3] );
- x[i1] = h1r + wr*h2r - wi*h2i;
- x[i2] = h1i + wr*h2i + wi*h2r;
- x[i3] = h1r - wr*h2r + wi*h2i;
- x[i4] = -h1i + wr*h2i + wi*h2r;
- }
- wr = (temp = wr)*wpr - wi*wpi + wr;
- wi = wi*wpr + temp*wpi + wi;
- }
- if ( forward )
- x[1] = xr;
- else
- pv_cfft( x, N, forward );
-}
-
-/* cfft replaces float array x containing NC complex values
- (2*NC float values alternating real, imagininary, etc.)
- by its Fourier transform if forward is true, or by its
- inverse Fourier transform if forward is false, using a
- recursive Fast Fourier transform method due to Danielson
- and Lanczos. NC MUST be a power of 2. */
-
-void pv_cfft( float *x, int NC, int forward )
-{
- float wr,wi,
- wpr,wpi,
- theta,
- scale;
- int mmax,
- ND,
- m,
- i,j,
- delta;
-
- ND = NC<<1;
- bitreverse( x, ND );
- for ( mmax = 2; mmax < ND; mmax = delta ) {
- delta = mmax<<1;
- theta = PV_2PI/( forward? mmax : -mmax );
- wpr = -2.*sqr( sin( 0.5*theta ));
- wpi = sin( theta );
- wr = 1.;
- wi = 0.;
- for ( m = 0; m < mmax; m += 2 ) {
- register float rtemp, itemp;
- for ( i = m; i < ND; i += delta ) {
- j = i + mmax;
- rtemp = wr*x[j] - wi*x[j+1];
- itemp = wr*x[j+1] + wi*x[j];
- x[j] = x[i] - rtemp;
- x[j+1] = x[i+1] - itemp;
- x[i] += rtemp;
- x[i+1] += itemp;
- }
- wr = (rtemp = wr)*wpr - wi*wpi + wr;
- wi = wi*wpr + rtemp*wpi + wi;
- }
- }
-
-/* scale output */
-
- scale = forward ? 1./ND : 2.;
- { register float *xi=x, *xe=x+ND;
- while ( xi < xe )
- *xi++ *= scale;
- }
-}
-
-/* bitreverse places float array x containing N/2 complex values
- into bit-reversed order */
-
-void bitreverse( float *x, int N )
-{
- float rtemp,itemp;
- int i,j,
- m;
-
- for ( i = j = 0; i < N; i += 2, j += m ) {
- if ( j > i ) {
- rtemp = x[j]; itemp = x[j+1]; /* complex exchange */
- x[j] = x[i]; x[j+1] = x[i+1];
- x[i] = rtemp; x[i+1] = itemp;
- }
- for ( m = N>>1; m >= 2 && j >= m; m >>= 1 )
- j -= m;
- }
-}
diff --git a/externals/grill/fftease/src/fft4.c b/externals/grill/fftease/src/fft4.c
deleted file mode 100644
index 70127b47..00000000
--- a/externals/grill/fftease/src/fft4.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * This file is part of the pv-lib
- *
- * The pv-lib can be used by everyone as desired
- *
- * (c) Eric Lyon and Christopher Penrose
- *
- */
-
-#include <math.h>
-#include "pv.h"
-
-static void bitrv2(int n, int *ip, float *a);
-static void cftsub(int n, float *a, float *w);
-static void rftsub(int n, float *a, int nc, float *c);
-static void makewt(int nw, int *ip, float *w);
-static void makect(int nc, int *ip, float *c);
-
-void init_rdft(int n, int *ip, float *w)
-{
-
- int nw,
- nc;
-
- nw = n >> 2;
- makewt(nw, ip, w);
-
- nc = n >> 2;
- makect(nc, ip, w + nw);
-
- return;
-}
-
-
-void pv_rdft(int n, int isgn, float *a, int *ip, float *w)
-{
-
- int j,
- nw,
- nc;
-
- float xi;
-
- nw = ip[0];
- nc = ip[1];
-
- if (isgn < 0) {
- a[1] = 0.5 * (a[1] - a[0]);
- a[0] += a[1];
-
- for (j = 3; j <= n - 1; j += 2) {
- a[j] = -a[j];
- }
-
- if (n > 4) {
- rftsub(n, a, nc, w + nw);
- bitrv2(n, ip + 2, a);
- }
-
- cftsub(n, a, w);
-
- for (j = 1; j < n; j += 2) {
- a[j] = -a[j];
- }
- }
-
- else {
-
- if (n > 4) {
- bitrv2(n, ip + 2, a);
- }
-
- cftsub(n, a, w);
-
- if (n > 4) {
- rftsub(n, a, nc, w + nw);
- }
-
- xi = a[0] - a[1];
- a[0] += a[1];
- a[1] = xi;
- }
-}
-
-
-static void bitrv2(int n, int *ip, float *a)
-{
- int j, j1, k, k1, l, m, m2;
- float xr, xi;
-
- ip[0] = 0;
- l = n;
- m = 1;
-
- while ((m << 2) < l) {
- l >>= 1;
- for (j = 0; j < m; j++) {
- ip[m + j] = ip[j] + l;
- }
- m <<= 1;
- }
-
- if ((m << 2) > l) {
-
- for (k = 1; k < m; k++) {
-
- for (j = 0; j <= k - 1; j++) {
- j1 = (j << 1) + ip[k];
- k1 = (k << 1) + ip[j];
- xr = a[j1];
- xi = a[j1 + 1];
- a[j1] = a[k1];
- a[j1 + 1] = a[k1 + 1];
- a[k1] = xr;
- a[k1 + 1] = xi;
- }
- }
- }
-
- else {
- m2 = m << 1;
-
- for (k = 1; k < m; k++) {
-
- for (j = 0; j < k; j++) {
- j1 = (j << 1) + ip[k];
- k1 = (k << 1) + ip[j];
- xr = a[j1];
- xi = a[j1 + 1];
- a[j1] = a[k1];
- a[j1 + 1] = a[k1 + 1];
- a[k1] = xr;
- a[k1 + 1] = xi;
- j1 += m2;
- k1 += m2;
- xr = a[j1];
- xi = a[j1 + 1];
- a[j1] = a[k1];
- a[j1 + 1] = a[k1 + 1];
- a[k1] = xr;
- a[k1 + 1] = xi;
- }
- }
- }
-}
-
-
-static void cftsub(int n, float *a, float *w)
-{
- int j, j1, j2, j3, k, k1, ks, l, m;
- float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
- float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
-
- l = 2;
-
- while ((l << 1) < n) {
- m = l << 2;
-
- for (j = 0; j <= l - 2; j += 2) {
- j1 = j + l;
- j2 = j1 + l;
- j3 = j2 + l;
- x0r = a[j] + a[j1];
- x0i = a[j + 1] + a[j1 + 1];
- x1r = a[j] - a[j1];
- x1i = a[j + 1] - a[j1 + 1];
- x2r = a[j2] + a[j3];
- x2i = a[j2 + 1] + a[j3 + 1];
- x3r = a[j2] - a[j3];
- x3i = a[j2 + 1] - a[j3 + 1];
- a[j] = x0r + x2r;
- a[j + 1] = x0i + x2i;
- a[j2] = x0r - x2r;
- a[j2 + 1] = x0i - x2i;
- a[j1] = x1r - x3i;
- a[j1 + 1] = x1i + x3r;
- a[j3] = x1r + x3i;
- a[j3 + 1] = x1i - x3r;
- }
-
- if (m < n) {
- wk1r = w[2];
-
- for (j = m; j <= l + m - 2; j += 2) {
- j1 = j + l;
- j2 = j1 + l;
- j3 = j2 + l;
- x0r = a[j] + a[j1];
- x0i = a[j + 1] + a[j1 + 1];
- x1r = a[j] - a[j1];
- x1i = a[j + 1] - a[j1 + 1];
- x2r = a[j2] + a[j3];
- x2i = a[j2 + 1] + a[j3 + 1];
- x3r = a[j2] - a[j3];
- x3i = a[j2 + 1] - a[j3 + 1];
- a[j] = x0r + x2r;
- a[j + 1] = x0i + x2i;
- a[j2] = x2i - x0i;
- a[j2 + 1] = x0r - x2r;
- x0r = x1r - x3i;
- x0i = x1i + x3r;
- a[j1] = wk1r * (x0r - x0i);
- a[j1 + 1] = wk1r * (x0r + x0i);
- x0r = x3i + x1r;
- x0i = x3r - x1i;
- a[j3] = wk1r * (x0i - x0r);
- a[j3 + 1] = wk1r * (x0i + x0r);
- }
-
- k1 = 1;
- ks = -1;
-
- for (k = (m << 1); k <= n - m; k += m) {
- k1++;
- ks = -ks;
- wk1r = w[k1 << 1];
- wk1i = w[(k1 << 1) + 1];
- wk2r = ks * w[k1];
- wk2i = w[k1 + ks];
- wk3r = wk1r - 2 * wk2i * wk1i;
- wk3i = 2 * wk2i * wk1r - wk1i;
-
- for (j = k; j <= l + k - 2; j += 2) {
- j1 = j + l;
- j2 = j1 + l;
- j3 = j2 + l;
- x0r = a[j] + a[j1];
- x0i = a[j + 1] + a[j1 + 1];
- x1r = a[j] - a[j1];
- x1i = a[j + 1] - a[j1 + 1];
- x2r = a[j2] + a[j3];
- x2i = a[j2 + 1] + a[j3 + 1];
- x3r = a[j2] - a[j3];
- x3i = a[j2 + 1] - a[j3 + 1];
- a[j] = x0r + x2r;
- a[j + 1] = x0i + x2i;
- x0r -= x2r;
- x0i -= x2i;
- a[j2] = wk2r * x0r - wk2i * x0i;
- a[j2 + 1] = wk2r * x0i + wk2i * x0r;
- x0r = x1r - x3i;
- x0i = x1i + x3r;
- a[j1] = wk1r * x0r - wk1i * x0i;
- a[j1 + 1] = wk1r * x0i + wk1i * x0r;
- x0r = x1r + x3i;
- x0i = x1i - x3r;
- a[j3] = wk3r * x0r - wk3i * x0i;
- a[j3 + 1] = wk3r * x0i + wk3i * x0r;
- }
- }
- }
-
- l = m;
- }
-
- if (l < n) {
-
- for (j = 0; j <= l - 2; j += 2) {
- j1 = j + l;
- x0r = a[j] - a[j1];
- x0i = a[j + 1] - a[j1 + 1];
- a[j] += a[j1];
- a[j + 1] += a[j1 + 1];
- a[j1] = x0r;
- a[j1 + 1] = x0i;
- }
- }
-}
-
-
-static void rftsub(int n, float *a, int nc, float *c)
-{
- int j, k, kk, ks;
- float wkr, wki, xr, xi, yr, yi;
-
- ks = (nc << 2) / n;
- kk = 0;
-
- for (k = (n >> 1) - 2; k >= 2; k -= 2) {
- j = n - k;
- kk += ks;
- wkr = 0.5 - c[kk];
- wki = c[nc - kk];
- xr = a[k] - a[j];
- xi = a[k + 1] + a[j + 1];
- yr = wkr * xr - wki * xi;
- yi = wkr * xi + wki * xr;
- a[k] -= yr;
- a[k + 1] -= yi;
- a[j] += yr;
- a[j + 1] -= yi;
- }
-}
-
-
-static void makewt(int nw, int *ip, float *w)
-{
- int nwh, j;
- float delta, x, y;
-
- ip[0] = nw;
- ip[1] = 1;
- if (nw > 2) {
- nwh = nw >> 1;
- delta = atan(1.0) / nwh;
- w[0] = 1;
- w[1] = 0;
- w[nwh] = cos(delta * nwh);
- w[nwh + 1] = w[nwh];
- for (j = 2; j <= nwh - 2; j += 2) {
- x = cos(delta * j);
- y = sin(delta * j);
- w[j] = x;
- w[j + 1] = y;
- w[nw - j] = y;
- w[nw - j + 1] = x;
- }
- bitrv2(nw, ip + 2, w);
- }
-}
-
-
-static void makect(int nc, int *ip, float *c)
-{
- int nch, j;
- float delta;
-
- ip[1] = nc;
- if (nc > 1) {
- nch = nc >> 1;
- delta = atan(1.0) / nch;
- c[0] = 0.5;
- c[nch] = 0.5 * cos(delta * nch);
- for (j = 1; j <= nch - 1; j++) {
- c[j] = 0.5 * cos(delta * j);
- c[nc - j] = 0.5 * sin(delta * j);
- }
- }
-}
-
diff --git a/externals/grill/fftease/src/fftease.cpp b/externals/grill/fftease/src/fftease.cpp
deleted file mode 100644
index 9a7641c1..00000000
--- a/externals/grill/fftease/src/fftease.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-
-
-fftease::fftease(I mult,I flags):
- _inCount(0),
- _flags(flags),
- blsz(0),smprt(0),
- _mult(mult),_N(0)
-{}
-
-fftease::~fftease() {}
-
-BL fftease::Init()
-{
- Clear();
- Set();
- return flext_dsp::Init();
-}
-
-V fftease::Exit()
-{
- Delete();
-}
-
-V fftease::m_dsp(I n,S *const *,S *const *)
-{
- const F sr = Samplerate();
- if(n != blsz || sr != smprt) {
- blsz = n;
- smprt = sr;
- MakeVar();
-
- Delete();
- Set();
- }
-}
-
-V fftease::m_signal(I n,S *const *in,S *const *out)
-{
- /* declare working variables */
- I i;
- const I _N = get_N(),_Nw = _N,_N2 = _N/2; //,_Nw2 = _Nw/2;
-
- /* fill our retaining buffers */
- _inCount += n;
-
- if(_flags&F_STEREO) {
- for(i = 0; i < _N-n ; i++ ) {
- _input1[i] = _input1[i+n];
- _input2[i] = _input2[i+n];
- }
- for(I j = 0; i < _N; i++,j++) {
- _input1[i] = in[0][j];
- _input2[i] = in[1][j];
- }
- }
- else {
- for (i = 0 ; i < _N-n ; i++ )
- _input1[i] = _input1[i+n];
- for (I j = 0; i < _N; i++,j++ )
- _input1[i] = in[0][j];
- }
-
- _rms = 0.;
- if(_flags&F_RMS) {
- for ( i=0; i < _Nw; i++ )
- _rms += _input1[i] * _input1[i];
- _rms = sqrt(_rms / _Nw);
- }
-
- /* apply hamming window and fold our window buffer into the fft buffer */
- fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount );
- if(_flags&F_STEREO) fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount );
-
- /* do an fft */
- if(_flags&F_BITSHUFFLE) {
- pv_rdft( _N, 1, _buffer1, _bitshuffle, _trigland );
- if(_flags&F_STEREO) pv_rdft( _N, 1, _buffer2, _bitshuffle, _trigland );
- }
- else {
- pv_rfft( _buffer1, _N2, 1);
- if(_flags&F_STEREO) pv_rfft( _buffer2, _N2,1);
- }
-
- if(!(_flags&F_NOSPEC)) {
- if(_flags&F_PHCONV) {
- convert( _buffer1, _channel1, _N2, _c_lastphase_in1, get_Fund(), _c_factor_in );
- if(_flags&F_STEREO) convert( _buffer2, _channel2, _N2, _c_lastphase_in2, get_Fund(), _c_factor_in );
- }
- else {
- leanconvert( _buffer1, _channel1, _N2 , !(_flags&F_NOAMP1),!(_flags&F_NOPH1));
- if(_flags&F_STEREO) leanconvert( _buffer2, _channel2, _N2 ,!(_flags&F_NOAMP2),!(_flags&F_NOPH2) );
- }
- }
-
- // ---- BEGIN --------------------------------
-
- Transform(_N,in+((_flags&F_STEREO)?2:1));
-
- // ---- END --------------------------------
-
- if(!(_flags&F_NOSPEC)) {
- if(_flags&F_PHCONV)
- unconvert( _channel1, _buffer1, _N2, _c_lastphase_out, get_Fund(), 1./_c_factor_in );
- else
- leanunconvert( _channel1, _buffer1, _N2 );
- }
-
-
- /* do an inverse fft */
- if(_flags&F_BITSHUFFLE)
- pv_rdft( _N, -1, _buffer1, _bitshuffle, _trigland );
- else
- pv_rfft( _buffer1, _N2, 0);
-
- /* dewindow our result */
- overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount);
-
- /* set our output and adjust our retaining output buffer */
- const F mult = 1./_N;
- for ( i = 0; i < n; i++ )
- out[0][i] = _output[i] * mult;
-
- for ( i = 0; i < _N-n; i++ )
- _output[i] = _output[i+n];
- for (; i < _N; i++ )
- _output[i] = 0.;
-}
-
-
-void fftease::Set()
-{
- /* preset the objects data */
- const I n = Blocksize(),_N = n*Mult(),_Nw = _N,_N2 = _N/2; //,_Nw2 = _Nw/2;
-
- _inCount = -_Nw;
-
- /* assign memory to the buffers */
- _input1 = new F[_Nw];
- ZeroMem(_input1,_Nw*sizeof(*_input1));
- _buffer1 = new F[_N];
- if(_flags&F_STEREO) {
- _input2 = new F[_Nw];
- ZeroMem(_input2,_Nw*sizeof(*_input2));
- _buffer2 = new F[_N];
- }
-
- if(!(_flags&F_NOSPEC) || (_flags&F_SPECRES)) {
- _channel1 = new F[_N+2];
- ZeroMem(_channel1,(_N+2)*sizeof(*_channel1));
- if(_flags&F_STEREO) {
- _channel2 = new F[_N+2];
- ZeroMem(_channel2,(_N+2)*sizeof(*_channel2));
- }
-
- if(_flags&F_PHCONV) {
- _c_lastphase_in1 = new F[_N2+1];
- ZeroMem(_c_lastphase_in1,(_N2+1)*sizeof(*_c_lastphase_in1));
- if(_flags&F_STEREO) {
- _c_lastphase_in2 = new F[_N2+1];
- ZeroMem(_c_lastphase_in2,(_N2+1)*sizeof(*_c_lastphase_in2));
- }
- _c_lastphase_out = new F[_N2+1];
- ZeroMem(_c_lastphase_out,(_N2+1)*sizeof(*_c_lastphase_out));
-
- _c_factor_in = Samplerate()/(n * PV_2PI);
- }
- }
-
- _output = new F[_Nw];
- ZeroMem(_output,_Nw*sizeof(*_output));
-
- if(_flags&F_BITSHUFFLE) {
- _bitshuffle = new I[_N*2];
- _trigland = new F[_N*2];
- init_rdft( _N, _bitshuffle, _trigland);
- }
-
- _Hwin = new F[_Nw];
- _Wanal = new F[_Nw];
- _Wsyn = new F[_Nw];
- if(_flags&F_BALANCED)
- makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, n, 0);
- else
- makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, n, 0,0);
-}
-
-void fftease::Clear()
-{
- _bitshuffle = NULL;
- _trigland = NULL;
- _input1 = _input2 = NULL;
- _Hwin = NULL;
- _Wanal = _Wsyn = NULL;
- _buffer1 = _buffer2 = NULL;
- _channel1 = _channel2 = NULL;
- _output = NULL;
-
- _c_lastphase_in1 = _c_lastphase_in2 = _c_lastphase_out = NULL;
-}
-
-void fftease::Delete()
-{
- if(_input1) delete[] _input1;
- if(_buffer1) delete[] _buffer1;
- if(_channel1) delete[] _channel1;
- if(_input2) delete[] _input2;
- if(_buffer2) delete[] _buffer2;
- if(_channel2) delete[] _channel2;
-
- if(_c_lastphase_in1) delete[] _c_lastphase_in1;
- if(_c_lastphase_in2) delete[] _c_lastphase_in2;
- if(_c_lastphase_out) delete[] _c_lastphase_out;
-
- if(_output) delete[] _output;
-
- if(_bitshuffle) delete[] _bitshuffle;
- if(_trigland) delete[] _trigland;
-
- if(_Hwin) delete[] _Hwin;
- if(_Wanal) delete[] _Wanal;
- if(_Wsyn) delete[] _Wsyn;
-}
-
-
diff --git a/externals/grill/fftease/src/fold.c b/externals/grill/fftease/src/fold.c
deleted file mode 100644
index 5b9ce476..00000000
--- a/externals/grill/fftease/src/fold.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * multiply current input I by window W (both of length Nw);
- * using modulus arithmetic, fold and rotate windowed input
- * into output array O of (FFT) length N according to current
- * input time n
- */
-void fold( float *I, float *W, int Nw, float *O, int N, int n )
-{
-#if 1
- int i;
- for ( i = 0; i < N; i++ ) O[i] = 0.;
-
- while ( n < 0 ) n += N;
- n %= N;
-
- for ( i = 0; i < Nw; i++ ) {
- O[n] += I[i]*W[i];
- if ( ++n == N ) n = 0;
- }
-#else
- int i;
-
- for ( i = 0; i < N; i++ )
- O[i] = 0.;
-
- while ( n < 0 )
- n += N;
- n %= N;
- for ( i = 0; i < Nw; i++ ) {
- O[n] += I[i]*W[i];
- if ( ++n == N )
- n = 0;
- }
-#endif
-}
-
-
-/*
- * input I is a folded spectrum of length N; output O and
- * synthesis window W are of length Nw--overlap-add windowed,
- * unrotated, unfolded input data into output O
- */
-void overlapadd( float *I, int N, float *W, float *O, int Nw, int n )
-{
-#if 1
- int i ;
- while ( n < 0 ) n += N ;
- n %= N ;
-
- for ( i = 0 ; i < Nw ; i++ ) {
- O[i] += I[n]*W[i] ;
- if ( ++n == N ) n = 0 ;
- }
-#else
- int i ;
- while ( n < 0 )
- n += N ;
- n %= N ;
- for ( i = 0 ; i < Nw ; i++ ) {
- O[i] += I[n]*W[i] ;
- if ( ++n == N )
- n = 0 ;
- }
-
-#endif
-}
-
diff --git a/externals/grill/fftease/src/leanconvert.c b/externals/grill/fftease/src/leanconvert.c
deleted file mode 100644
index d121d896..00000000
--- a/externals/grill/fftease/src/leanconvert.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "pv.h"
-
-void leanconvert( float *S, float *C, int N2 , int amp, int ph)
-{
-#if 1
- register int i;
-
- float a = fabs(S[0]); /* real value at f=0 */
- float b = fabs(S[1]); /* real value at f=Nyquist */
-
- C[0] = a;
- C[1] = 0;
- S += 2,C += 2;
-
- if(amp && ph) {
- for ( i = 1; i < N2; i++,S += 2,C += 2 ) {
- C[0] = hypot( S[0], S[1] );
- C[1] = -atan2( S[1], S[0] );
- }
- }
- else if(amp) {
- for ( i = 1; i < N2; i++,S += 2,C += 2 )
- C[0] = hypot( S[0], S[1] );
- }
- else if(ph) {
- for ( i = 1; i < N2; i++,S += 2,C += 2 )
- C[1] = -atan2( S[1], S[0] );
- }
-
- C[0] = b;
- C[1] = 0;
-#else
-
- int real, imag,
- amp, phase;
- float a, b;
- int i;
-
- for ( i = 0; i <= N2; i++ ) {
- imag = phase = ( real = amp = i<<1 ) + 1;
- a = ( i == N2 ? S[1] : S[real] );
- b = ( i == 0 || i == N2 ? 0. : S[imag] );
- C[amp] = hypot( a, b );
- C[phase] = -atan2( b, a );
- }
-#endif
-}
-
-
-/* unconvert essentially undoes what convert does, i.e., it
- turns N2+1 PAIRS of amplitude and frequency values in
- C into N2 PAIR of complex spectrum data (in rfft format)
- in output array S; sampling rate R and interpolation factor
- I are used to recompute phase values from frequencies */
-
-void leanunconvert( float *C, float *S, int N2 )
-{
-#if 1
- register int i;
-
- S[0] = fabs(C[0]);
- S[1] = fabs(C[N2*2]);
- S += 2,C += 2;
-
- for (i = 1; i < N2; i++,S += 2,C += 2 ) {
- S[0] = C[0] * cos( C[1] );
- S[1] = -C[0] * sin( C[1] );
- }
-#else
- int real, imag,
- amp, phase;
- float a, b;
- register int i;
-
- for ( i = 0; i <= N2; i++ ) {
- imag = phase = ( real = amp = i<<1 ) + 1;
- S[real] = *(C+amp) * cos( *(C+phase) );
- if ( i != N2 )
- S[imag] = -*(C+amp) * sin( *(C+phase) );
- }
-
-#endif
-}
-
diff --git a/externals/grill/fftease/src/main.cpp b/externals/grill/fftease/src/main.cpp
deleted file mode 100644
index 75bea448..00000000
--- a/externals/grill/fftease/src/main.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-
-
-// Initialization function for xsample library
-static V fftease_main()
-{
- post("");
- post("-------------------------------------------------------------------");
- post("FFTease - A set of Live Spectral Processors");
- post("Originally written by Eric Lyon and Christopher Penrose for MAX/MSP");
- post("");
- post("flext port (version " FFTEASE_VERSION ") provided by Thomas Grill, (C)2003-2004");
- post("-------------------------------------------------------------------");
- post("");
-
- // call the objects' setup routines
- FLEXT_DSP_SETUP(burrow);
- FLEXT_DSP_SETUP(cross);
- FLEXT_DSP_SETUP(dentist);
- FLEXT_DSP_SETUP(disarray);
- FLEXT_DSP_SETUP(drown);
- FLEXT_DSP_SETUP(ether);
- FLEXT_DSP_SETUP(morphine);
- FLEXT_DSP_SETUP(scrape);
- FLEXT_DSP_SETUP(shapee);
- FLEXT_DSP_SETUP(swinger);
- FLEXT_DSP_SETUP(taint);
- FLEXT_DSP_SETUP(thresher);
- FLEXT_DSP_SETUP(vacancy);
- FLEXT_DSP_SETUP(xsyn);
-/*
- FLEXT_DSP_SETUP(pvcompand);
- FLEXT_DSP_SETUP(pvoc);
-
-*/
-}
-
-// setup the library
-FLEXT_LIB_SETUP(fftease,fftease_main)
-
diff --git a/externals/grill/fftease/src/main.h b/externals/grill/fftease/src/main.h
deleted file mode 100644
index 50ca4c66..00000000
--- a/externals/grill/fftease/src/main.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#ifndef __FFTEASE_H
-#define __FFTEASE_H
-
-#define FFTEASE_VERSION "0.0.0"
-
-
-#define FLEXT_ATTRIBUTES 1
-
-#include <flext.h>
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 501)
-#error You need at least flext version 0.5.1
-#endif
-
-
-#include "pv.h"
-
-// lazy me
-#define F float
-#define D double
-#define I int
-#define L long
-#define C char
-#define V void
-#define BL bool
-#define S t_sample
-
-
-
-class fftease:
- public flext_dsp
-{
- FLEXT_HEADER(fftease,flext_dsp)
-
-public:
- fftease(I mult,I flags);
- virtual ~fftease();
-
- static F FromdB(F v) { return pow(10.,v*.05); }
-
- inline I get_N() const { return _N; }
- inline F get_Fund() const { return smprt/_N; }
-
-protected:
-
- virtual BL Init();
- virtual V Exit();
-
- virtual V m_dsp(I n,S *const *in,S *const *out);
- virtual V m_signal(I n,S *const *in,S *const *out);
-
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
- virtual V Transform(I _N,S *const *in) = 0;
-
-
- V Mult(I n) { _mult = n; MakeVar(); }
- inline I Mult() const { return _mult; }
-
- F *_input1,*_input2;
- F *_buffer1,*_buffer2;
- F *_channel1,*_channel2;
- F *_output;
- F *_trigland;
- I *_bitshuffle;
- F *_Wanal,*_Wsyn,*_Hwin;
-
- F *_c_lastphase_in1,*_c_lastphase_in2,*_c_lastphase_out;
- F _c_factor_in;
-
- I _inCount;
-
- enum {
- F_STEREO = 0x01,
- F_BALANCED = 0x02,
- F_BITSHUFFLE = 0x04,
- F_RMS = 0x08,
- F_NOSPEC = 0x10,F_SPECRES = 0x20,F_PHCONV = 0x40,
- F_NOAMP1 = 0x100,
- F_NOPH1 = 0x200,
- F_NOAMP2 = 0x400,
- F_NOPH2 = 0x800
- };
-
- I _flags;
- F _rms;
-
-private:
-
- V MakeVar() { _N = Blocksize()*_mult; }
-
- I blsz;
- F smprt;
- I _mult,_N;
-};
-
-
-#endif
diff --git a/externals/grill/fftease/src/makewindows.c b/externals/grill/fftease/src/makewindows.c
deleted file mode 100644
index e26690ec..00000000
--- a/externals/grill/fftease/src/makewindows.c
+++ /dev/null
@@ -1,190 +0,0 @@
-#include "pv.h"
-#include "math.h"
-
-/*
- * make balanced pair of analysis (A) and synthesis (S) windows;
- * window lengths are Nw, FFT length is N, synthesis interpolation
- * factor is I, and osc is true (1) if oscillator bank resynthesis
- * is specified
- */
-void makewindows( float *H, float *A, float *S, int Nw, int N, int I, int osc )
-{
- int i ;
- float sum ;
-
-/*
- * basic Hamming windows
- */
- for ( i = 0 ; i < Nw ; i++ )
- H[i] = A[i] = S[i] = 0.54 - 0.46*cos( PV_2PI*i/(Nw - 1) ) ;
-/*
- * when Nw > N, also apply interpolating (sinc) windows to
- * ensure that window are 0 at increments of N (the FFT length)
- * away from the center of the analysis window and of I away
- * from the center of the synthesis window
- */
- if ( Nw > N ) {
- float x ;
-
-/*
- * take care to create symmetrical windows
- */
- x = -(Nw - 1)/2. ;
- for ( i = 0 ; i < Nw ; i++, x += 1. )
- if ( x != 0. ) {
- A[i] *= N*sin( PV_PI*x/N )/(PV_PI*x) ;
- if ( I )
- S[i] *= I*sin( PV_PI*x/I )/(PV_PI*x) ;
- }
- }
-/*
- * normalize windows for unity gain across unmodified
- * analysis-synthesis procedure
- */
- for ( sum = i = 0 ; i < Nw ; i++ )
- sum += A[i] ;
-
- for ( i = 0 ; i < Nw ; i++ ) {
- float afac = 2./sum ;
- float sfac = Nw > N ? 1./afac : afac ;
- A[i] *= afac ;
- S[i] *= sfac ;
- }
-
- if ( Nw <= N && I ) {
- for ( sum = i = 0 ; i < Nw ; i += I )
- sum += S[i]*S[i] ;
- for ( sum = 1./sum, i = 0 ; i < Nw ; i++ )
- S[i] *= sum ;
- }
-}
-
-void makehamming( float *H, float *A, float *S, int Nw, int N, int I, int osc,int odd )
-{
- int i;
- float sum ;
-
-/*
- * basic Hamming windows
- */
-
-
- if (odd) {
- for ( i = 0 ; i < Nw ; i++ )
- H[i] = A[i] = S[i] = sqrt(0.54 - 0.46*cos( PV_2PI*i/(Nw - 1) ));
- }
-
- else {
-
- for ( i = 0 ; i < Nw ; i++ )
- H[i] = A[i] = S[i] = 0.54 - 0.46*cos( PV_2PI*i/(Nw - 1) );
-
- }
-
-/*
- * when Nw > N, also apply interpolating (sinc) windows to
- * ensure that window are 0 at increments of N (the FFT length)
- * away from the center of the analysis window and of I away
- * from the center of the synthesis window
- */
- if ( Nw > N ) {
- float x ;
-
-/*
- * take care to create symmetrical windows
- */
- x = -(Nw - 1)/2. ;
- for ( i = 0 ; i < Nw ; i++, x += 1. )
- if ( x != 0. ) {
- A[i] *= N*sin( PV_PI*x/N )/(PV_PI*x) ;
- if ( I )
- S[i] *= I*sin( PV_PI*x/I )/(PV_PI*x) ;
- }
- }
-/*
- * normalize windows for unity gain across unmodified
- * analysis-synthesis procedure
- */
- for ( sum = i = 0 ; i < Nw ; i++ )
- sum += A[i] ;
-
- for ( i = 0 ; i < Nw ; i++ ) {
- float afac = 2./sum ;
- float sfac = Nw > N ? 1./afac : afac ;
- A[i] *= afac ;
- S[i] *= sfac ;
- }
-
- if ( Nw <= N && I ) {
- for ( sum = i = 0 ; i < Nw ; i += I )
- sum += S[i]*S[i] ;
- for ( sum = 1./sum, i = 0 ; i < Nw ; i++ )
- S[i] *= sum ;
- }
-}
-
-
-void makehanning( float *H, float *A, float *S, int Nw, int N, int I, int osc, int odd )
-{
- int i;
- float sum ;
-
-/*
- * basic Hanning windows
- */
-
-
- if (odd) {
- for ( i = 0 ; i < Nw ; i++ )
- H[i] = A[i] = S[i] = sqrt(0.5 * (1. + cos(PV_PI + PV_2PI * i / (Nw - 1))));
- }
-
- else {
-
- for ( i = 0 ; i < Nw ; i++ )
- H[i] = A[i] = S[i] = 0.5 * (1. + cos(PV_PI + PV_2PI * i / (Nw - 1)));
-
- }
-
-/*
- * when Nw > N, also apply interpolating (sinc) windows to
- * ensure that window are 0 at increments of N (the FFT length)
- * away from the center of the analysis window and of I away
- * from the center of the synthesis window
- */
- if ( Nw > N ) {
- float x ;
-
-/*
- * take care to create symmetrical windows
- */
- x = -(Nw - 1)/2. ;
- for ( i = 0 ; i < Nw ; i++, x += 1. )
- if ( x != 0. ) {
- A[i] *= N*sin( PV_PI*x/N )/(PV_PI*x) ;
- if ( I )
- S[i] *= I*sin( PV_PI*x/I )/(PV_PI*x) ;
- }
- }
-/*
- * normalize windows for unity gain across unmodified
- * analysis-synthesis procedure
- */
- for ( sum = i = 0 ; i < Nw ; i++ )
- sum += A[i] ;
-
- for ( i = 0 ; i < Nw ; i++ ) {
- float afac = 2./sum ;
- float sfac = Nw > N ? 1./afac : afac ;
- A[i] *= afac ;
- S[i] *= sfac ;
- }
-
- if ( Nw <= N && I ) {
- for ( sum = i = 0 ; i < Nw ; i += I )
- sum += S[i]*S[i] ;
- for ( sum = 1./sum, i = 0 ; i < Nw ; i++ )
- S[i] *= sum ;
- }
-}
-
diff --git a/externals/grill/fftease/src/morphine~.cpp b/externals/grill/fftease/src/morphine~.cpp
deleted file mode 100644
index cda155c8..00000000
--- a/externals/grill/fftease/src/morphine~.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class morphine:
- public fftease
-{
- FLEXT_HEADER_S(morphine,fftease,setup)
-
-public:
- morphine(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I n,S *const *in);
-
- F _index;
-
- struct pickme { I bin; F value; };
- static I sortpicks( const V *a, const V *b );
-
- pickme *_picks;
-
-private:
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
-
- static V setup(t_classid c);
-
- FLEXT_ATTRVAR_F(_index)
-};
-
-FLEXT_LIB_DSP_V("morphine~",morphine)
-
-
-V morphine::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR1(c,"index",_index);
-}
-
-
-morphine::morphine(I argc,const t_atom *argv):
- fftease(4,F_STEREO|F_BALANCED|F_BITSHUFFLE),
- _index(0)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _index = GetAFloat(argv[0]);
- else
- post("%s - Index must be a float value - set to %f",thisName(),_index);
- }
-
- AddInSignal("Messages and input signal 1");
- AddInSignal("Input signal 2");
- AddOutSignal("Transformed signal");
-}
-
-V morphine::Clear()
-{
- _picks = NULL;
- fftease::Clear();
-}
-
-V morphine::Delete()
-{
- fftease::Delete();
- if(_picks) delete[] _picks;
-}
-
-V morphine::Set()
-{
- fftease::Set();
-
- _picks = new pickme[get_N()/2+1];
-}
-
-I morphine::sortpicks( const void *a, const void *b )
-{
- if ( ((pickme *)a)->value > ((pickme *) b)->value ) return 1;
- if ( ((pickme *) a)->value < ((pickme *) b)->value ) return -1;
- return 0;
-}
-
-V morphine::Transform(I _N,S *const *)
-{
- const I _N2 = _N/2;
- I i;
- for ( i = 0; i <= _N2; i++ ) {
- // find amplitude differences between home and visitors
- _picks[i].value = fabs( _channel1[i*2] - _channel2[i*2]);
- _picks[i].bin = i;
- }
-
- // sort our differences in ascending order
- qsort( _picks, _N2+1, sizeof(pickme), sortpicks );
-
- I ix2 = (I)(_index*(_N2+1)+.5)*2;
- if(ix2 < 0) ix2 = 0;
- else if(ix2 > _N+2) ix2 = _N+2;
-
- // choose the bins that are least different first
- for (i=0; i < ix2; i += 2) {
- _channel1[i] = _channel2[i];
- _channel1[i+1] = _channel2[i+1];
- }
-}
-
diff --git a/externals/grill/fftease/src/pv.h b/externals/grill/fftease/src/pv.h
deleted file mode 100644
index 1a555ec7..00000000
--- a/externals/grill/fftease/src/pv.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of the pv-lib
- *
- * The pv-lib can be used by everyone as desired
- *
- * (c) Eric Lyon and Christopher Penrose
- */
-
-#include <stdio.h>
-
-/* -------------------------------------
- modifications by Thomas Grill
-*/
-
-/* #include <fts/fts.h> */
-#include <math.h>
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4305)
-#pragma warning(disable: 4244)
-#pragma warning(disable: 4101)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define PV_PI 3.141592653589793115997963468544185161590576171875
-#define PV_2PI (2.*PV_PI)
-
-/* ------------------------------------- */
-
-
-#define FORWARD 1
-#define INVERSE 0
-
-typedef struct {
- float min;
- float max;
-} Bound;
-
-void init_rdft(int n, int *ip, float *w);
-void pv_rdft(int n, int isgn, float *a, int *ip, float *w);
-void fold( float *I, float *W, int Nw, float *O, int N, int n );
-void overlapadd(float *I, int N, float *W, float *O, int Nw, int n );
-void makehanning( float *H, float *A, float *S, int Nw, int N, int I, int osc, int odd );
-void makewindows( float *H, float *A, float *S, int Nw, int N, int I, int osc );
-void leanconvert( float *S, float *C, int N2 , int amp, int ph );
-void leanunconvert( float *C, float *S, int N2 );
-void pv_rfft( float *x, int N, int forward );
-void pv_cfft( float *x, int NC, int forward );
-void convert_new(float *S, float *C, int N2, float *lastphase, float fundamental, float factor );
-void convert(float *S, float *C, int N2, float *lastphase, float fundamental, float factor );
-void unconvert(float *C, float *S, int N2, float *lastphase, float fundamental, float factor );
-
-
-/* ------------------------------------- */
-
-#ifdef __cplusplus
-}
-#endif
-
-/* ------------------------------------- */
-
diff --git a/externals/grill/fftease/src/pvoc~.cpp b/externals/grill/fftease/src/pvoc~.cpp
deleted file mode 100644
index 5f941e09..00000000
--- a/externals/grill/fftease/src/pvoc~.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-
-
-class pvoc:
- public fftease
-{
- FLEXT_HEADER_S(pvoc,fftease,setup)
-
-public:
- pvoc(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I _N2,S *const *in);
-
- BL _invert;
-
- F _threshold,_multiplier;
- F _thresh_dB,_mult_dB;
-
-private:
- V ms_thresh(F v) { _threshold = FromdB(_thresh_dB = v); }
- V ms_mult(F v) { _multiplier = FromdB(_mult_dB = v); }
-
-
- static V setup(t_classid c);
-
- FLEXT_ATTRGET_F(_thresh_dB)
- FLEXT_CALLSET_F(ms_thresh)
- FLEXT_ATTRGET_F(_mult_dB)
- FLEXT_CALLSET_F(ms_mult)
- FLEXT_ATTRVAR_B(_invert)
-};
-
-FLEXT_LIB_DSP_V("pvoc~",pvoc)
-
-
-V pvoc::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR(c,"thresh",_thresh_dB,ms_thresh);
- FLEXT_CADDATTR_VAR(c,"mult",_mult_dB,ms_mult);
- FLEXT_CADDATTR_VAR1(c,"invert",_invert);
-}
-
-
-pvoc::pvoc(I argc,const t_atom *argv):
- fftease(4,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_NOPH2),
- _thresh_dB(-30),_mult_dB(-18),
- _invert(false)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _thresh_dB = GetAFloat(argv[0]);
- else
- post("%s - Threshold must be a float value - set to %0f",thisName(),_thresh_dB);
- }
- if(argc >= 2) {
- if(CanbeFloat(argv[1]))
- _mult_dB = GetAFloat(argv[1]);
- else
- post("%s - Multiplier must be a float value - set to %0f",thisName(),_mult_dB);
- }
- if(argc >= 3) {
- if(CanbeBool(argv[2]))
- _invert = GetABool(argv[2]);
- else
- post("%s - Invert flag must be a boolean value - set to %i",thisName(),_invert?1:0);
- }
-
- ms_thresh(_thresh_dB);
- ms_mult(_mult_dB);
-
- AddInSignal("Messages and input signal");
- AddInSignal("Reference signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V pvoc::Transform(I _N,S *const *in)
-{
- /*
- int freq,amp;
- int chan;
-
- // start osc bank
- for ( chan = lo_bin; chan < hi_bin; chan++ ) {
- freq = ( amp = ( chan << 1 ) ) + 1;
- if ( _channel1[amp] < synt ){
- breaker = 1;
- }
- if( breaker ) {
- breaker = 0 ;
- }
- else {
- _channel1[freq] *= myPInc;
- finc = ( _channel1[freq] - ( f = lastfreq[chan] ) )*Iinv;
- ainc = ( _channel1[amp] - ( a = lastamp[chan] ) )*Iinv;
- address = index[chan];
- for ( n = 0; n < I; n++ ) {
- output[n] += a*table[ (int) address ];
- address += f;
- while ( address >= L )
- address -= L;
- while ( address < 0 )
- address += L;
- a += ainc;
- f += finc;
- }
- lastfreq[chan] = _channel1[freq];
- lastamp[chan] = _channel1[amp];
- index[chan] = address;
- }
- }
- */
-}
-
-
-
diff --git a/externals/grill/fftease/src/scrape~.cpp b/externals/grill/fftease/src/scrape~.cpp
deleted file mode 100644
index dff46dfb..00000000
--- a/externals/grill/fftease/src/scrape~.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class scrape:
- public fftease
-{
- FLEXT_HEADER_S(scrape,fftease,setup)
-
-public:
- scrape(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I n,S *const *in);
-
- F _thresh1,_thresh2;
- F _knee,_cutoff;
- F *_threshfunc;
-
- V UpdThrFun();
-
-private:
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
-
- static V setup(t_classid c);
-
- inline V ms_knee(F knee) { _knee = knee; UpdThrFun(); }
- inline V ms_cutoff(F cutoff) { _cutoff = cutoff; UpdThrFun(); }
- inline V ms_thresh1(F thr) { _thresh1 = thr; UpdThrFun(); }
- inline V ms_thresh2(F thr) { _thresh2 = thr; UpdThrFun(); }
-
- FLEXT_ATTRGET_F(_knee)
- FLEXT_CALLSET_F(ms_knee)
- FLEXT_ATTRGET_F(_cutoff)
- FLEXT_CALLSET_F(ms_cutoff)
- FLEXT_ATTRGET_F(_thresh1)
- FLEXT_CALLSET_F(ms_thresh1)
- FLEXT_ATTRGET_F(_thresh2)
- FLEXT_CALLSET_F(ms_thresh2)
-};
-
-FLEXT_LIB_DSP_V("scrape~",scrape)
-
-
-V scrape::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR(c,"knee",_knee,ms_knee);
- FLEXT_CADDATTR_VAR(c,"cutoff",_cutoff,ms_cutoff);
- FLEXT_CADDATTR_VAR(c,"thresh1",_thresh1,ms_thresh1);
- FLEXT_CADDATTR_VAR(c,"thresh2",_thresh2,ms_thresh2);
-}
-
-
-scrape::scrape(I argc,const t_atom *argv):
- fftease(4,F_BALANCED|F_BITSHUFFLE),
- _thresh1(.0001),_thresh2(.09),
- _knee(1000),_cutoff(4000)
-
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _knee = GetAFloat(argv[0]);
- else
- post("%s - Knee must be a float value - set to %f",thisName(),_knee);
- }
- if(argc >= 2) {
- if(CanbeFloat(argv[1])) {
- F c = GetAFloat(argv[1]);
- if(c > 0) _cutoff = c;
- else
- post("%s - Cutoff must be > 0 - set to %f",thisName(),_cutoff);
- }
- else
- post("%s - Cutoff must be a float value - set to %f",thisName(),_cutoff);
- }
-
- AddInSignal("Messages and input signal");
- AddInSignal("Multiplier signal");
- AddOutSignal("Transformed signal");
-}
-
-V scrape::Clear()
-{
- _threshfunc = NULL;
- fftease::Clear();
-}
-
-V scrape::Delete()
-{
- fftease::Delete();
- if(_threshfunc) delete[] _threshfunc;
-}
-
-V scrape::Set()
-{
- fftease::Set();
-
- _threshfunc = new F[get_N()/2];
- UpdThrFun();
-}
-
-V scrape::UpdThrFun()
-{
- const I _N2 = get_N()/2;
- const F funda = get_Fund();
-
- F curfreq = funda;
- for(I i = 0; i < _N2; i++ ) {
- if( curfreq < _knee )
- _threshfunc[i] = 0;
- else if( curfreq >= _knee && curfreq < _cutoff ) {
- const F m = (_knee - curfreq) / (_cutoff - _knee) ;
- _threshfunc[i] = (1-m) * _thresh1 + m * _thresh2 ;
- } else
- _threshfunc[i] = _thresh2;
-
- curfreq += funda ;
- }
-}
-
-/*! \brief Do the spectral transformation
-
- \remark maxamp is calculated later than in the original FFTease scrape~ object
-*/
-V scrape::Transform(I _N,S *const *in)
-{
- const F fmult = *in[0];
- const F *thrf = _threshfunc;
-
- I i;
- F maxamp = 1.;
- for( i = 0; i <= _N; i += 2 )
- if(maxamp < _channel1[i])
- maxamp = _channel1[i];
-
- for( i = 0; i <= _N; i += 2 )
- if(_channel1[i] < *(thrf++) * maxamp)
- _channel1[i] *= fmult;
-}
-
diff --git a/externals/grill/fftease/src/shapee~.cpp b/externals/grill/fftease/src/shapee~.cpp
deleted file mode 100644
index 1e86f801..00000000
--- a/externals/grill/fftease/src/shapee~.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class shapee:
- public fftease
-{
- FLEXT_HEADER(shapee,fftease)
-
-public:
- shapee(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I n,S *const *in);
-
- BL _qual;
-};
-
-FLEXT_LIB_DSP_V("shapee~",shapee)
-
-
-shapee::shapee(I argc,const t_atom *argv):
- fftease(2,F_STEREO|F_BITSHUFFLE),
- _qual(false)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeBool(argv[0]))
- _qual = GetABool(argv[0]);
- else
- post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0);
- }
-
- if(_qual) {
- Mult(4);
- _flags |= F_BALANCED;
- }
- else
- Mult(2);
-
- AddInSignal("Messages and frequency reference signal");
- AddInSignal("Amplitude reference signal");
- AddOutSignal("Transformed signal");
-}
-
-#define THRESH 0.000001
-
-V shapee::Transform(I _N,S *const *)
-{
- // lets just shape the entire signal in groups of three
-
- I i;
- for ( i=2; i <= _N; i += 6 ) {
- const F ref = _channel1[i];
- F lowerMult,upperMult;
-
- if(!ref)
- lowerMult = upperMult = 1;
- else {
- lowerMult = _channel1[i-2] / ref;
- upperMult = _channel1[i+2] / ref;
- }
- F newCenter = ( _channel2[i-2]+_channel2[i]+_channel2[i+2] ) / (upperMult + lowerMult + 1);
-
- _channel2[i-2] = lowerMult * newCenter;
- _channel2[i+2] = upperMult * newCenter;
- _channel2[i] = newCenter;
- }
-
- for ( i=0; i <= _N; i+=2 ) {
- _channel1[i] = _channel2[i];
- if ( _channel1[i] == 0. )
- _channel1[i+1] = 0.;
- else if( _channel1[i+1] == 0. )
- _channel1[i+1] = _channel2[i+1];
- }
-}
diff --git a/externals/grill/fftease/src/swinger~.cpp b/externals/grill/fftease/src/swinger~.cpp
deleted file mode 100644
index 4660058d..00000000
--- a/externals/grill/fftease/src/swinger~.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-
-// add quality switch
-
-class swinger:
- public fftease
-{
- FLEXT_HEADER(swinger,fftease)
-
-public:
- swinger(I argc,const t_atom *argv);
-
-protected:
-
- BL _qual;
-
- virtual V Transform(I n,S *const *in);
-};
-
-FLEXT_LIB_DSP_V("swinger~",swinger)
-
-
-swinger::swinger(I argc,const t_atom *argv):
- fftease(2,F_STEREO|F_BITSHUFFLE|F_NOPH1|F_NOAMP2),
- _qual(false)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeBool(argv[0]))
- _qual = GetABool(argv[0]);
- else
- post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0);
- }
-
- if(_qual) {
- Mult(4);
- _flags |= F_BALANCED;
- }
- else
- Mult(2);
-
- AddInSignal("Messages and input signal");
- AddInSignal("Signal to supply phase information");
- AddOutSignal("Transformed signal");
-}
-
-
-V swinger::Transform(I _N,S *const *)
-{
- for (I i = 0; i <= _N; i += 2) _channel1[i+1] = _channel2[i+1];
-}
diff --git a/externals/grill/fftease/src/taint~.cpp b/externals/grill/fftease/src/taint~.cpp
deleted file mode 100644
index b9bf9cf9..00000000
--- a/externals/grill/fftease/src/taint~.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class taint:
- public fftease
-{
- FLEXT_HEADER_S(taint,fftease,setup)
-
-public:
- taint(I argc,const t_atom *argv);
-
-protected:
-
- virtual V Transform(I n,S *const *in);
-
- V ms_thresh(F thr) { _threshold = FromdB(_threshdB = thr); }
-
- F _threshold,_threshdB;
- BL _invert;
-
-private:
- static V setup(t_classid c);
-
- FLEXT_ATTRGET_F(_threshdB)
- FLEXT_CALLSET_F(ms_thresh)
- FLEXT_ATTRVAR_B(_invert)
-};
-
-FLEXT_LIB_DSP_V("taint~",taint)
-
-
-V taint::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR(c,"thresh",_threshdB,ms_thresh);
- FLEXT_CADDATTR_VAR1(c,"invert",_invert);
-}
-
-
-taint::taint(I argc,const t_atom *argv):
- fftease(4,F_STEREO|F_BALANCED|F_BITSHUFFLE|F_NOPH2),
- _threshdB(-10),_invert(false)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _threshdB = GetAFloat(argv[0]);
- else
- post("%s - Threshold must be a float value - set to %f",thisName(),_threshdB);
- }
-
- if(argc >= 2) {
- if(CanbeBool(argv[1]))
- _invert = GetABool(argv[1]);
- else
- post("%s - Invert must be a boolean value - set to %0i",thisName(),_invert?1:0);
- }
-
- ms_thresh(_threshdB);
-
- AddInSignal("Messages and frequency reference signal");
- AddInSignal("Amplitude reference signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V taint::Transform(I _N,S *const *)
-{
- register const F thr = _threshold;
-
- if(_invert) {
- // use threshold for inverse filtering to avoid division by zero
- for (I i = 0; i <= _N; i += 2) {
- const F magnitude = _channel2[i];
-
- if ( magnitude < thr )
- _channel1[i] = 0;
- else
- _channel1[i] /= magnitude;
- }
- }
- else {
- // simple multiplication of magnitudes
- for (I i = 0; i <= _N; i += 2) {
- const F magnitude = _channel2[i];
- if (magnitude > thr) _channel1[i] *= magnitude;
- }
- }
-}
diff --git a/externals/grill/fftease/src/thresher~.cpp b/externals/grill/fftease/src/thresher~.cpp
deleted file mode 100644
index 7e674bdf..00000000
--- a/externals/grill/fftease/src/thresher~.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class thresher:
- public fftease
-{
- FLEXT_HEADER_S(thresher,fftease,setup)
-
-public:
- thresher();
-
-protected:
- virtual V Set();
- virtual V Clear();
- virtual V Delete();
-
- virtual V Transform(I n,S *const *in);
-
- F *_compositeFrame;
- I *_framesLeft;
- BL _firstFrame;
-
- F _moveThreshold;
- I _maxHoldFrames;
-
-private:
- static V setup(t_classid c);
-};
-
-FLEXT_LIB_DSP("thresher~ nacho~",thresher)
-
-
-V thresher::setup(t_classid )
-{
-}
-
-void thresher::Set()
-{
- fftease::Set();
-
- const F rate = Samplerate();
- const I n = Blocksize(),_N = get_N(),_N2 = _N/2;
-
- _compositeFrame = new F[_N+2];
- _framesLeft = new I[_N2+1];
-
- _firstFrame = true;
- _moveThreshold = .00001 ;
- F _maxHoldTime = 5.0 ;
- _maxHoldFrames = (I)(_maxHoldTime *rate/n);
-}
-
-void thresher::Clear()
-{
- fftease::Clear();
- _compositeFrame = NULL;
- _framesLeft = NULL;
-}
-
-void thresher::Delete()
-{
- fftease::Delete();
- if(_compositeFrame) delete[] _compositeFrame;
- if(_framesLeft) delete[] _framesLeft;
-}
-
-
-thresher::thresher():
- fftease(4,F_BALANCED|F_BITSHUFFLE|F_PHCONV)
-{
- AddInSignal("Messages and input signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V thresher::Transform(I _N,S *const *)
-{
- I *fr = _framesLeft;
- if( _firstFrame ) {
- for (I i = 0; i <= _N; i += 2,++fr ){
- _compositeFrame[i] = _channel1[i];
- _compositeFrame[i+1] = _channel1[i+1];
- *fr = _maxHoldFrames;
- }
- _firstFrame = false;
- }
- else {
- for(I i = 0; i <= _N; i += 2,++fr ){
- if( (fabs( _compositeFrame[i] - _channel1[i] ) > _moveThreshold) || (*fr <= 0) ) {
- _compositeFrame[i] = _channel1[i];
- _compositeFrame[i+1] = _channel1[i+1];
- *fr = _maxHoldFrames;
- }
- else {
- _channel1[i] = _compositeFrame[i];
- _channel1[i+1] = _compositeFrame[i+1];
- --*fr;
- }
- }
- }
-}
diff --git a/externals/grill/fftease/src/vacancy~.cpp b/externals/grill/fftease/src/vacancy~.cpp
deleted file mode 100644
index 53341bb4..00000000
--- a/externals/grill/fftease/src/vacancy~.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class vacancy:
- public fftease
-{
- FLEXT_HEADER_S(vacancy,fftease,setup)
-
-public:
- vacancy(I argc,const t_atom *argv);
-
-protected:
- virtual V Transform(I n,S *const *in);
-
- V ms_thresh(F thr) { _threshold = FromdB(_threshdB = thr); }
- V ms_userms(BL r) { if(r) _flags |= F_RMS; else _flags &= ~F_RMS; }
-
- F _threshold,_threshdB;
- BL _invert,_useRms,_swapPhase;
-
-private:
- static V setup(t_classid c);
-
- FLEXT_ATTRGET_F(_threshdB)
- FLEXT_CALLSET_F(ms_thresh)
- FLEXT_ATTRVAR_B(_invert)
- FLEXT_ATTRGET_B(_useRms)
- FLEXT_CALLSET_B(ms_userms)
- FLEXT_ATTRVAR_B(_swapPhase)
-};
-
-FLEXT_LIB_DSP_V("vacancy~",vacancy)
-
-
-V vacancy::setup(t_classid c)
-{
- FLEXT_CADDATTR_VAR(c,"thresh",_threshdB,ms_thresh);
- FLEXT_CADDATTR_VAR1(c,"invert",_invert);
- FLEXT_CADDATTR_VAR(c,"rms",_useRms,ms_userms);
- FLEXT_CADDATTR_VAR1(c,"swap",_swapPhase);
-}
-
-
-vacancy::vacancy(I argc,const t_atom *argv):
- fftease(2,F_STEREO|F_BITSHUFFLE),
- _threshdB(-30),_invert(false),_useRms(true),_swapPhase(false)
-{
- /* parse and set object's options given */
- if(argc >= 1) {
- if(CanbeFloat(argv[0]))
- _threshdB = GetAFloat(argv[0]);
- else
- post("%s - Threshold must be a float value - set to %f",thisName(),_threshdB);
- }
-
- if(argc >= 2) {
- if(CanbeBool(argv[1]))
- _invert = GetABool(argv[1]);
- else
- post("%s - Invert must be a boolean value - set to %0i",thisName(),_invert?1:0);
- }
-
- if(argc >= 3) {
- if(CanbeBool(argv[2]))
- _useRms = GetABool(argv[2]);
- else
- post("%s - Rms flag must be a boolean value - set to %0i",thisName(),_useRms?1:0);
- }
-
- if(argc >= 4) {
- if(CanbeBool(argv[3]))
- _swapPhase = GetABool(argv[3]);
- else
- post("%s - Swapphase flag must be a boolean value - set to %0i",thisName(),_swapPhase?1:0);
- }
-
- ms_thresh(_threshdB);
- ms_userms(_useRms);
-
- AddInSignal("Messages and input signal");
- AddInSignal("Reference signal");
- AddOutSignal("Transformed signal");
-}
-
-
-V vacancy::Transform(I _N,S *const *)
-{
- const F useme = _useRms?_rms * _threshold:_threshold;
-
- // composite here please
- if (_invert) {
- if (_swapPhase) {
- for (I i=0; i < _N; i+=2 )
- if ( _channel1[i] > useme && _channel2[i] < _channel1[i] ) {
- _channel1[i] = _channel2[i];
- _channel1[i+1] = _channel2[i+1];
- }
- }
- else {
- for (I i=0; i < _N; i+=2 )
- if ( _channel1[i] > useme && _channel2[i] < _channel1[i] ) {
- _channel1[i] = _channel2[i];
- if ( _channel1[i+1] == 0. ) _channel1[i+1] = _channel2[i+1];
- }
- }
- }
- else {
- if (_swapPhase) {
- for (I i=0; i < _N; i+=2 )
- if ( _channel1[i] < useme && _channel2[i] > _channel1[i] ) {
- _channel1[i] = _channel2[i];
- _channel1[i+1] = _channel2[i+1];
- }
- }
- else {
- for (I i=0; i < _N; i+=2 )
- if ( _channel1[i] < useme && _channel2[i] > _channel1[i] ) {
- _channel1[i] = _channel2[i];
- if ( _channel1[i+1] == 0. ) _channel1[i+1] = _channel2[i+1];
- }
- }
- }
-}
diff --git a/externals/grill/fftease/src/xsyn~.cpp b/externals/grill/fftease/src/xsyn~.cpp
deleted file mode 100644
index b08ae1e2..00000000
--- a/externals/grill/fftease/src/xsyn~.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
-FFTease - A set of Live Spectral Processors
-Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "main.h"
-#include <stdlib.h>
-
-class xsyn:
- public fftease
-{
- FLEXT_HEADER(xsyn,fftease)
-
-public:
- xsyn();
-
-protected:
- virtual V Transform(I n,S *const *in);
-};
-
-FLEXT_LIB_DSP("xsyn~",xsyn)
-
-
-xsyn::xsyn():
- fftease(2,F_STEREO|F_BITSHUFFLE|F_NOPH2)
-{
- AddInSignal("Messages and source signal 1");
- AddInSignal("Source signal 2");
- AddOutSignal("Transformed signal");
-}
-
-
-V xsyn::Transform(I _N,S *const *)
-{
- F maxamp = 0;
- I i;
- for( i = 0; i <= _N; i+= 2 )
- if(_channel2[i] > maxamp ) maxamp = _channel2[i];
-
- const F f = maxamp?1./maxamp:1.;
-
- for( i = 0; i <= _N; i+= 2 )
- _channel1[i] *= (_channel2[i] * f);
-}