├── .gitignore ├── COPYING ├── Makefile ├── README ├── extra.mk ├── gverb ├── Makefile ├── gverb-test.c ├── gverb.c ├── gverb.h ├── gverbdsp.c └── gverbdsp.h ├── include ├── ladspa-util.h └── lv2.h ├── plugins ├── a_law-swh.lv2 │ └── plugin.xml ├── alias-swh.lv2 │ └── plugin.xml ├── allpass-swh.lv2 │ └── plugin.xml ├── am_pitchshift-swh.lv2 │ └── plugin.xml ├── amp-swh.lv2 │ └── plugin.xml ├── analogue_osc-swh.lv2 │ └── plugin.xml ├── bandpass_a_iir-swh.lv2 │ └── plugin.xml ├── bandpass_iir-swh.lv2 │ └── plugin.xml ├── bode_shifter-swh.lv2 │ └── plugin.xml ├── bode_shifter_cv-swh.lv2 │ └── plugin.xml ├── butterworth-swh.lv2 │ └── plugin.xml ├── chebstortion-swh.lv2 │ └── plugin.xml ├── comb-swh.lv2 │ └── plugin.xml ├── comb_splitter-swh.lv2 │ └── plugin.xml ├── const-swh.lv2 │ └── plugin.xml ├── crossover_dist-swh.lv2 │ └── plugin.xml ├── dc_remove-swh.lv2 │ └── plugin.xml ├── debug-swh.lv2 │ └── plugin.xml ├── decay-swh.lv2 │ └── plugin.xml ├── decimator-swh.lv2 │ └── plugin.xml ├── declip-swh.lv2 │ └── plugin.xml ├── delay-swh.lv2 │ └── plugin.xml ├── delayorama-swh.lv2 │ └── plugin.xml ├── diode-swh.lv2 │ └── plugin.xml ├── divider-swh.lv2 │ └── plugin.xml ├── dj_eq-swh.lv2 │ └── plugin.xml ├── dj_flanger-swh.lv2 │ └── plugin.xml ├── dyson_compress-swh.lv2 │ └── plugin.xml ├── fad_delay-swh.lv2 │ └── plugin.xml ├── fast_lookahead_limiter-swh.lv2 │ └── plugin.xml ├── flanger-swh.lv2 │ └── plugin.xml ├── fm_osc-swh.lv2 │ └── plugin.xml ├── foldover-swh.lv2 │ └── plugin.xml ├── foverdrive-swh.lv2 │ └── plugin.xml ├── freq_tracker-swh.lv2 │ └── plugin.xml ├── gate-swh.lv2 │ └── plugin.xml ├── giant_flange-swh.lv2 │ └── plugin.xml ├── gong-swh.lv2 │ └── plugin.xml ├── gong_beater-swh.lv2 │ └── plugin.xml ├── gsm-swh.lv2 │ └── plugin.xml ├── gverb-swh.lv2 │ └── plugin.xml ├── hard_limiter-swh.lv2 │ └── plugin.xml ├── harmonic_gen-swh.lv2 │ └── plugin.xml ├── hermes_filter-swh.lv2 │ └── plugin.xml ├── highpass_iir-swh.lv2 │ └── plugin.xml ├── hilbert-swh.lv2 │ └── plugin.xml ├── imp-swh.lv2 │ └── plugin.xml ├── impulse-swh.lv2 │ └── plugin.xml ├── inv-swh.lv2 │ └── plugin.xml ├── karaoke-swh.lv2 │ └── plugin.xml ├── latency-swh.lv2 │ └── plugin.xml ├── lcr_delay-swh.lv2 │ └── plugin.xml ├── lookahead_limiter-swh.lv2 │ └── plugin.xml ├── lookahead_limiter_const-swh.lv2 │ └── plugin.xml ├── lowpass_iir-swh.lv2 │ └── plugin.xml ├── ls_filter-swh.lv2 │ └── plugin.xml ├── matrix_ms_st-swh.lv2 │ └── plugin.xml ├── matrix_spatialiser-swh.lv2 │ └── plugin.xml ├── matrix_st_ms-swh.lv2 │ └── plugin.xml ├── mbeq-swh.lv2 │ └── plugin.xml ├── mod_delay-swh.lv2 │ └── plugin.xml ├── multivoice_chorus-swh.lv2 │ └── plugin.xml ├── notch_iir-swh.lv2 │ └── plugin.xml ├── offset-swh.lv2 │ └── plugin.xml ├── phasers-swh.lv2 │ └── plugin.xml ├── pitch_scale-swh.lv2 │ └── plugin.xml ├── plate-swh.lv2 │ └── plugin.xml ├── pointer_cast-swh.lv2 │ └── plugin.xml ├── rate_shifter-swh.lv2 │ └── plugin.xml ├── retro_flange-swh.lv2 │ └── plugin.xml ├── revdelay-swh.lv2 │ └── plugin.xml ├── ringmod-swh.lv2 │ └── plugin.xml ├── satan_maximiser-swh.lv2 │ └── plugin.xml ├── sc1-swh.lv2 │ └── plugin.xml ├── sc2-swh.lv2 │ └── plugin.xml ├── sc3-swh.lv2 │ └── plugin.xml ├── sc4-swh.lv2 │ └── plugin.xml ├── se4-swh.lv2 │ └── plugin.xml ├── shaper-swh.lv2 │ └── plugin.xml ├── sifter-swh.lv2 │ └── plugin.xml ├── simple_comb-swh.lv2 │ └── plugin.xml ├── sin_cos-swh.lv2 │ └── plugin.xml ├── single_para-swh.lv2 │ └── plugin.xml ├── sinus_wavewrapper-swh.lv2 │ └── plugin.xml ├── smooth_decimate-swh.lv2 │ └── plugin.xml ├── split-swh.lv2 │ └── plugin.xml ├── step_muxer-swh.lv2 │ └── plugin.xml ├── surround_encoder-swh.lv2 │ └── plugin.xml ├── svf-swh.lv2 │ └── plugin.xml ├── tape_delay-swh.lv2 │ └── plugin.xml ├── transient-swh.lv2 │ └── plugin.xml ├── triple_para-swh.lv2 │ └── plugin.xml ├── u_law-swh.lv2 │ └── plugin.xml ├── valve-swh.lv2 │ └── plugin.xml ├── valve_rect-swh.lv2 │ └── plugin.xml ├── vynil-swh.lv2 │ └── plugin.xml ├── wave_terrain-swh.lv2 │ └── plugin.xml ├── xfade-swh.lv2 │ └── plugin.xml └── zm1-swh.lv2 │ └── plugin.xml ├── util ├── biquad.h ├── blo.c ├── blo.h ├── buffer.c ├── buffer.h ├── db.c ├── db.h ├── gsm │ ├── COPYRIGHT │ ├── Makefile.am │ ├── Makefile.in │ ├── README │ ├── add.c │ ├── code.c │ ├── config.h │ ├── decode.c │ ├── gsm.h │ ├── gsm_create.c │ ├── gsm_decode.c │ ├── gsm_destroy.c │ ├── gsm_encode.c │ ├── gsm_option.c │ ├── long_term.c │ ├── lpc.c │ ├── preprocess.c │ ├── private.h │ ├── proto.h │ ├── rpe.c │ ├── short_term.c │ ├── table.c │ └── unproto.h ├── iir.c ├── iir.h ├── ls_filter.h ├── pitchscale.c ├── pitchscale.h ├── rms.c ├── rms.h └── waveguide_nl.h └── xslt ├── manifest.xsl ├── source.xsl └── turtle.xsl /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.dylib 4 | plugins/*-swh.lv2/manifest.ttl 5 | plugins/*-swh.lv2/manifest.ttl.in 6 | plugins/*-swh.lv2/plugin.c 7 | plugins/*-swh.lv2/plugin.ttl 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX = /usr/local 2 | INSTALL_DIR = $(PREFIX)/lib/lv2 3 | 4 | VERSION = 1.0.16 5 | 6 | PLUGINS = alias-swh.lv2 allpass-swh.lv2 am_pitchshift-swh.lv2 amp-swh.lv2 \ 7 | analogue_osc-swh.lv2 bandpass_a_iir-swh.lv2 bandpass_iir-swh.lv2 \ 8 | bode_shifter-swh.lv2 bode_shifter_cv-swh.lv2 butterworth-swh.lv2 \ 9 | chebstortion-swh.lv2 comb-swh.lv2 comb_splitter-swh.lv2 const-swh.lv2 \ 10 | crossover_dist-swh.lv2 dc_remove-swh.lv2 decay-swh.lv2 decimator-swh.lv2 \ 11 | declip-swh.lv2 delay-swh.lv2 delayorama-swh.lv2 diode-swh.lv2 divider-swh.lv2 \ 12 | dj_eq-swh.lv2 dj_flanger-swh.lv2 dyson_compress-swh.lv2 fad_delay-swh.lv2 \ 13 | fast_lookahead_limiter-swh.lv2 flanger-swh.lv2 fm_osc-swh.lv2 \ 14 | foldover-swh.lv2 foverdrive-swh.lv2 freq_tracker-swh.lv2 gate-swh.lv2 \ 15 | giant_flange-swh.lv2 gong-swh.lv2 gong_beater-swh.lv2 gverb-swh.lv2 \ 16 | hard_limiter-swh.lv2 harmonic_gen-swh.lv2 hermes_filter-swh.lv2 \ 17 | highpass_iir-swh.lv2 hilbert-swh.lv2 impulse-swh.lv2 inv-swh.lv2 \ 18 | karaoke-swh.lv2 latency-swh.lv2 lcr_delay-swh.lv2 lookahead_limiter-swh.lv2 \ 19 | lookahead_limiter_const-swh.lv2 lowpass_iir-swh.lv2 ls_filter-swh.lv2 \ 20 | matrix_ms_st-swh.lv2 matrix_spatialiser-swh.lv2 matrix_st_ms-swh.lv2 \ 21 | mod_delay-swh.lv2 multivoice_chorus-swh.lv2 \ 22 | phasers-swh.lv2 plate-swh.lv2 pointer_cast-swh.lv2 \ 23 | rate_shifter-swh.lv2 retro_flange-swh.lv2 revdelay-swh.lv2 ringmod-swh.lv2 \ 24 | satan_maximiser-swh.lv2 sc1-swh.lv2 sc2-swh.lv2 sc3-swh.lv2 sc4-swh.lv2 \ 25 | se4-swh.lv2 shaper-swh.lv2 sifter-swh.lv2 simple_comb-swh.lv2 sin_cos-swh.lv2 \ 26 | single_para-swh.lv2 sinus_wavewrapper-swh.lv2 smooth_decimate-swh.lv2 \ 27 | split-swh.lv2 surround_encoder-swh.lv2 svf-swh.lv2 \ 28 | tape_delay-swh.lv2 transient-swh.lv2 triple_para-swh.lv2 valve-swh.lv2 \ 29 | valve_rect-swh.lv2 vynil-swh.lv2 wave_terrain-swh.lv2 xfade-swh.lv2 \ 30 | zm1-swh.lv2 offset-swh.lv2 \ 31 | a_law-swh.lv2 u_law-swh.lv2 32 | 33 | FFT_PLUGINS = mbeq-swh.lv2 pitch_scale-swh.lv2 34 | 35 | 36 | DARWIN := $(shell uname | grep Darwin) 37 | OS := $(shell uname -s) 38 | 39 | ifdef DARWIN 40 | EXT = dylib 41 | CC = clang 42 | PLUGIN_CFLAGS = -Wall -Wno-unused-variable -Wno-self-assign -I. -Iinclude -O3 -fomit-frame-pointer -funroll-loops -DFFTW3 -arch x86_64 -ffast-math -msse -fno-common $(CFLAGS) 43 | PLUGIN_LDFLAGS = -arch x86_64 -dynamiclib $(LDFLAGS) 44 | BUILD_PLUGINS = $(PLUGINS) $(FFT_PLUGINS) 45 | RT = 46 | else 47 | EXT = so 48 | PLUGIN_CFLAGS = -Wall -I. -Iinclude -O3 -fomit-frame-pointer -fstrength-reduce -funroll-loops -fPIC -DPIC -DFFTW3 $(CFLAGS) 49 | PLUGIN_LDFLAGS = -shared -lm $(LDFLAGS) 50 | BUILD_PLUGINS = $(PLUGINS) $(FFT_PLUGINS) 51 | RT = -lrt 52 | endif 53 | 54 | # Load plugin specific flags: 55 | include extra.mk 56 | 57 | OBJECTS = $(shell echo $(BUILD_PLUGINS) | sed 's/\([^ ]*\.lv2\)/plugins\/\1\/plugin.$(EXT)/g') 58 | 59 | all: util gverb $(OBJECTS) 60 | 61 | gverb: gverb/gverb.c gverb/gverbdsp.c gverb/gverb.o gverb/gverbdsp.o 62 | (cd gverb && make -w CFLAGS="$(PLUGIN_CFLAGS)" LDFLAGS="$(PLUGIN_LDFLAGS)") 63 | 64 | util/pitchscale.o: 65 | $(CC) $(PLUGIN_CFLAGS) $(fftw3_CFLAGS) $*.c -c -o $@ 66 | 67 | util: util/blo.o util/iir.o util/db.o util/rms.o util/pitchscale.o 68 | 69 | %.c: OBJ = $(shell echo $@ | sed 's/\.c$$/-@OS@.$(EXT)/') 70 | %.c: %.xml xslt/source.xsl xslt/manifest.xsl 71 | xsltproc -novalid xslt/source.xsl $*.xml | sed 's/LADSPA_Data/float/g' > $@ 72 | xsltproc -novalid -stringparam obj `basename $(OBJ)` xslt/manifest.xsl $*.xml > `dirname $@`/manifest.ttl.in 73 | 74 | %.ttl: %.xml xslt/turtle.xsl 75 | xsltproc -novalid xslt/turtle.xsl $*.xml | sed 's/\\/\\\\/g' > $@ 76 | 77 | %.o: NAME = $(shell echo $@ | sed 's/plugins\/\(.*\)-swh.*/\1/') 78 | %.o: %.c 79 | $(CC) $(PLUGIN_CFLAGS) $($(NAME)_CFLAGS) $*.c -c -o $@ 80 | 81 | %.$(EXT): NAME = $(shell echo $@ | sed 's/plugins\/\(.*\)-swh.*/\1/') 82 | %.$(EXT): %.xml %.o %.ttl 83 | $(CC) $*.o $(PLUGIN_LDFLAGS) $($(NAME)_LDFLAGS) -o $@ 84 | cp $@ $*-$(OS).$(EXT) 85 | sed 's/@OS@/$(OS)/g' < `dirname $@`/manifest.ttl.in > `dirname $@`/manifest.ttl 86 | 87 | clean: dist-clean 88 | 89 | dist-clean: 90 | rm -f plugins/*/*.{$(EXT),o} plugins/*/*.o plugins/*/manifest.ttl util/*.o gverb/*.o 91 | 92 | real-clean: 93 | rm -f plugins/*/*.{c,ttl,$(EXT),o,in} util/*.o gverb/*.o 94 | 95 | install: 96 | @echo 'use install-user to install in home or install-system to install system wide' 97 | 98 | install-system: INSTALL_DIR_REALLY=$(INSTALL_DIR) 99 | install-system: all install-really 100 | 101 | install-user: INSTALL_DIR_REALLY=~/.lv2 102 | install-user: all install-really 103 | 104 | install-really: 105 | for plugin in $(BUILD_PLUGINS); do \ 106 | echo Installing $$plugin; \ 107 | install -pd $(INSTALL_DIR_REALLY)/$$plugin; \ 108 | install -pm 755 plugins/$$plugin/*-$(OS).$(EXT) $(INSTALL_DIR_REALLY)/$$plugin/ ; \ 109 | install -pm 644 plugins/$$plugin/*.ttl $(INSTALL_DIR_REALLY)/$$plugin/ ; \ 110 | done 111 | 112 | dist: real-clean all dist-clean 113 | cd .. && \ 114 | cp -pr lv2 swh-lv2-$(VERSION) && \ 115 | tar cfz swh-lv2-$(VERSION).tar.gz swh-lv2-$(VERSION)/{Makefile,README,*.mk,plugins/*/*,util/*,gverb/*,xslt/*,include/*} && \ 116 | rm -rf swh-lv2-$(VERSION) 117 | mv ../swh-lv2-$(VERSION).tar.gz . 118 | 119 | .PRECIOUS: %.c %.ttl 120 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | SWH LV2 plugins 2 | 3 | http://plugin.org.uk/ 4 | 5 | LICENCE 6 | 7 | This plugins are licensed under the GNU GPL version 3. See the file COPYING for details. 8 | 9 | STATUS 10 | 11 | This is an early experimental port of my LADSPA plugins to the LV2 12 | specification, c.f. http://lv2plug.in/ . It's still quite early days, but most 13 | things should work as well or not as they did in LADSPA. 14 | 15 | BUILD 16 | 17 | Linux / OSX: run "make" 18 | Windows: run "make real-clean all" (untested, might wrk, might not) 19 | 20 | INSTALL 21 | 22 | run "make install-system" if you want the plugins installed globally, requires 23 | root privileges, or "make install-user" if you want them just installed for 24 | the current user. 25 | 26 | BUG REPORTS 27 | 28 | Please report bugs to Steve Harris at steve at plugin.org.uk. 29 | 30 | EDITING 31 | 32 | If you wish to edit the source code (.xml files in the subdirectories of the 33 | plugin directory) then you will need xsltproc installed. It's in the libxslt 34 | package, which is part of gnome, I think. Do not edit the .c files, and do not 35 | send patches against the .c files. 36 | -------------------------------------------------------------------------------- /extra.mk: -------------------------------------------------------------------------------- 1 | analogue_osc_LDFLAGS = util/blo.o $(RT) 2 | fm_osc_LDFLAGS = util/blo.o $(RT) 3 | hermes_filter_LDFLAGS = util/blo.o $(RT) 4 | 5 | bandpass_iir_LDFLAGS = util/iir.o 6 | bandpass_a_iir_LDFLAGS = util/iir.o 7 | butterworth_LDFLAGS = util/iir.o 8 | highpass_iir_LDFLAGS = util/iir.o 9 | lowpass_iir_LDFLAGS = util/iir.o 10 | notch_iir_LDFLAGS = util/iir.o 11 | 12 | gverb_LDFLAGS = gverb/gverbdsp.o gverb/gverb.o 13 | 14 | lookahead_limiter_LDFLAGS = util/db.o 15 | lookahead_limiter_const_LDFLAGS = util/db.o 16 | sc1_LDFLAGS = util/db.o util/rms.o 17 | sc2_LDFLAGS = util/db.o util/rms.o 18 | sc3_LDFLAGS = util/db.o util/rms.o 19 | sc4_LDFLAGS = util/db.o util/rms.o 20 | se4_LDFLAGS = util/db.o util/rms.o 21 | 22 | fftw3_CFLAGS = `pkg-config fftw3f --cflags` 23 | fftw3_LDFLAGS = `pkg-config fftw3f --libs` 24 | 25 | mbeq_CFLAGS = $(fftw3_CFLAGS) 26 | mbeq_LDFLAGS = $(fftw3_LDFLAGS) 27 | 28 | pitch_scale_CFLAGS = $(fftw3_CFLAGS) 29 | pitch_scale_LDFLAGS = util/pitchscale.o $(fftw3_LDFLAGS) 30 | -------------------------------------------------------------------------------- /gverb/Makefile: -------------------------------------------------------------------------------- 1 | HEADERS = gverb.h gverbdsp.h 2 | 3 | OBJECTS = gverb.o gverbdsp.o 4 | 5 | all: $(OBJECTS) 6 | 7 | libgverb.a: $(HEADERS) $(OBJECTS) 8 | ar rvu $@ $(OBJECTS) 9 | ranlib $@ 10 | -------------------------------------------------------------------------------- /gverb/gverb-test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "gverb.h" 7 | 8 | void run(const char *desc); 9 | 10 | #define rdtscll(val) __asm__ __volatile__("rdtsc" : "=A" (val)) 11 | #define SIZE 48000 12 | 13 | float in[SIZE], out[2][SIZE]; 14 | ty_gverb *verb; 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | long long then, now; 19 | unsigned int i; 20 | float v; 21 | 22 | verb = gverb_new(48000, 300.0f, 50.0f, 7.0f, 0.5f, 15.0f, 0.5f, 0.5f, 0.5f); 23 | for (i=0; i RAND_MAX / 5) { 76 | v *= -1.0f; 77 | } 78 | v *= -1.0f; 79 | in[i] = 1.0f; 80 | } 81 | run("+0dB pulse constant"); 82 | 83 | for (i=0; i 25 | #include 26 | #include 27 | #include 28 | 29 | #include "gverbdsp.h" 30 | 31 | #define TRUE 1 32 | #define FALSE 0 33 | 34 | ty_diffuser *diffuser_make(int size, float coeff) 35 | { 36 | ty_diffuser *p; 37 | int i; 38 | 39 | p = (ty_diffuser *)malloc(sizeof(ty_diffuser)); 40 | p->size = size; 41 | p->coeff = coeff; 42 | p->idx = 0; 43 | p->buf = (float *)malloc(size*sizeof(float)); 44 | for (i = 0; i < size; i++) p->buf[i] = 0.0; 45 | return(p); 46 | } 47 | 48 | void diffuser_free(ty_diffuser *p) 49 | { 50 | free(p->buf); 51 | free(p); 52 | } 53 | 54 | void diffuser_flush(ty_diffuser *p) 55 | { 56 | memset(p->buf, 0, p->size * sizeof(float)); 57 | } 58 | 59 | ty_damper *damper_make(float damping) 60 | { 61 | ty_damper *p; 62 | 63 | p = (ty_damper *)malloc(sizeof(ty_damper)); 64 | p->damping = damping; 65 | p->delay = 0.0f; 66 | return(p); 67 | } 68 | 69 | void damper_free(ty_damper *p) 70 | { 71 | free(p); 72 | } 73 | 74 | void damper_flush(ty_damper *p) 75 | { 76 | p->delay = 0.0f; 77 | } 78 | 79 | ty_fixeddelay *fixeddelay_make(int size) 80 | { 81 | ty_fixeddelay *p; 82 | int i; 83 | 84 | p = (ty_fixeddelay *)malloc(sizeof(ty_fixeddelay)); 85 | p->size = size; 86 | p->idx = 0; 87 | p->buf = (float *)malloc(size*sizeof(float)); 88 | for (i = 0; i < size; i++) p->buf[i] = 0.0; 89 | return(p); 90 | } 91 | 92 | void fixeddelay_free(ty_fixeddelay *p) 93 | { 94 | free(p->buf); 95 | free(p); 96 | } 97 | 98 | void fixeddelay_flush(ty_fixeddelay *p) 99 | { 100 | memset(p->buf, 0, p->size * sizeof(float)); 101 | } 102 | 103 | int isprime(int n) 104 | { 105 | unsigned int i; 106 | const unsigned int lim = (int)sqrtf((float)n); 107 | 108 | if (n == 2) return(TRUE); 109 | if ((n & 1) == 0) return(FALSE); 110 | for(i = 3; i <= lim; i += 2) 111 | if ((n % i) == 0) return(FALSE); 112 | return(TRUE); 113 | } 114 | 115 | int nearest_prime(int n, float rerror) 116 | /* relative error; new prime will be in range 117 | * [n-n*rerror, n+n*rerror]; 118 | */ 119 | { 120 | int bound,k; 121 | 122 | if (isprime(n)) return(n); 123 | /* assume n is large enough and n*rerror enough smaller than n */ 124 | bound = n*rerror; 125 | for(k = 1; k <= bound; k++) { 126 | if (isprime(n+k)) return(n+k); 127 | if (isprime(n-k)) return(n-k); 128 | } 129 | return(-1); 130 | } 131 | -------------------------------------------------------------------------------- /gverb/gverbdsp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GVERBDSP_H 3 | #define GVERBDSP_H 4 | 5 | #include "../include/ladspa-util.h" 6 | 7 | typedef struct { 8 | int size; 9 | int idx; 10 | float *buf; 11 | } ty_fixeddelay; 12 | 13 | typedef struct { 14 | int size; 15 | float coeff; 16 | int idx; 17 | float *buf; 18 | } ty_diffuser; 19 | 20 | typedef struct { 21 | float damping; 22 | float delay; 23 | } ty_damper; 24 | 25 | ty_diffuser *diffuser_make(int, float); 26 | void diffuser_free(ty_diffuser *); 27 | void diffuser_flush(ty_diffuser *); 28 | //float diffuser_do(ty_diffuser *, float); 29 | 30 | ty_damper *damper_make(float); 31 | void damper_free(ty_damper *); 32 | void damper_flush(ty_damper *); 33 | //void damper_set(ty_damper *, float); 34 | //float damper_do(ty_damper *, float); 35 | 36 | ty_fixeddelay *fixeddelay_make(int); 37 | void fixeddelay_free(ty_fixeddelay *); 38 | void fixeddelay_flush(ty_fixeddelay *); 39 | //float fixeddelay_read(ty_fixeddelay *, int); 40 | //void fixeddelay_write(ty_fixeddelay *, float); 41 | 42 | int isprime(int); 43 | int nearest_prime(int, float); 44 | 45 | static inline float diffuser_do(ty_diffuser *p, float x) 46 | { 47 | float y,w; 48 | 49 | w = x - p->buf[p->idx]*p->coeff; 50 | w = flush_to_zero(w); 51 | y = p->buf[p->idx] + w*p->coeff; 52 | p->buf[p->idx] = w; 53 | p->idx = (p->idx + 1) % p->size; 54 | return(y); 55 | } 56 | 57 | static inline float fixeddelay_read(ty_fixeddelay *p, int n) 58 | { 59 | int i; 60 | 61 | i = (p->idx - n + p->size) % p->size; 62 | return(p->buf[i]); 63 | } 64 | 65 | static inline void fixeddelay_write(ty_fixeddelay *p, float x) 66 | { 67 | p->buf[p->idx] = x; 68 | p->idx = (p->idx + 1) % p->size; 69 | } 70 | 71 | static inline void damper_set(ty_damper *p, float damping) 72 | { 73 | p->damping = damping; 74 | } 75 | 76 | static inline float damper_do(ty_damper *p, float x) 77 | { 78 | float y; 79 | 80 | y = x*(1.0-p->damping) + p->delay*p->damping; 81 | p->delay = y; 82 | return(y); 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /plugins/a_law-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | A-Law Compressor 17 |

Transforms the input signal according to the 18 | A-law 19 | compression function, which increases the average 20 | dynamic range of the signal while preserving the 21 | peaks.

22 |

An A-law compander pair is part of telephone 23 | transmission outside of the United State and Japan, 24 | where μ-law companding is used.

25 | = 0) 38 | s = 1.0 + log(sabs) * aloginv; 39 | else 40 | s = -1.0 - log(sabs) * aloginv; 41 | } 42 | buffer_write(output[pos], s); 43 | } 44 | ]]> 45 | 46 | 47 | Input 48 | 49 | 50 | 51 | Output 52 | 53 |
54 |
55 | -------------------------------------------------------------------------------- /plugins/alias-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Aliasing 14 |

Simulates aliasing using nyquist frequency modulation. Produces wacky results if the blocks aren't even numbers of samples long.

15 | 16 | 29 | 30 | 31 | Aliasing level 32 |

Controls the amount of simulated aliasing in the output.

33 | 34 |
35 | 36 | 37 | Input 38 | 39 | 40 | 41 | Output 42 | 43 |
44 |
45 | -------------------------------------------------------------------------------- /plugins/amp-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Simple amplifier 17 | 18 | 26 | 27 | 28 | Amps gain (dB) 29 |

Controls the gain of the input signal in dB's.

30 | 31 |
32 | 33 | 34 | Input 35 | 36 | 37 | 38 | Output 39 | 40 |
41 |
42 | -------------------------------------------------------------------------------- /plugins/analogue_osc-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | #include "ladspa-util.h" 14 | #include "util/blo.h" 15 | ]]> 16 | 17 | 18 | 19 | Analogue Oscillator 20 |

This plugin simulates the output you get from an analogue synth's osciallators.

21 |

You can get a reasonable emualtion of a 303's square (for exmaple) if you set the warmth to about 0.4 and the instability to about 0.05.

22 |

The frequency is currently a control input, and there is no interpolation, so if your host is using large block sieze it will sound steppy.

23 |

I'm unsure whether to convert this to an audio input or inpolate the control in.

24 | 25 | 35 | 36 | tables); 38 | blo_h_free(plugin_data->osc); 39 | ]]> 40 | 41 | wave = LIMIT(f_round(wave) - 1, 0, BLO_N_WAVES-1); 49 | osc->nyquist = fs * (0.47f - f_clamp(warm, 0.0f, 1.0f) * 0.41f); 50 | blo_hd_set_freq(osc, freq); 51 | 52 | tables = tables; // So gcc doesn't think it's unused 53 | 54 | for (pos = 0; pos < sample_count; pos++) { 55 | x = blo_hd_run_cub(osc); 56 | rnda += 432577; 57 | rnda *= 47; 58 | rndb += 7643113; 59 | rnda *= 59; 60 | osc->ph.all += (((rnda + rndb)/2) % max_jump) - max_jump/2; 61 | osc->ph.all &= osc->ph_mask; 62 | y = (x - q) / (1.0f - f_exp(-1.2f * (x - q))) + 63 | q / (1.0f - f_exp(1.2f * q)); 64 | /* Catch the case where x ~= q */ 65 | if (fabs(y) > 1.0f) { 66 | y = 0.83333f + q / (1.0f - f_exp(1.2f * q)); 67 | } 68 | otm2 = otm1; 69 | otm1 = leak * otm1 + y - itm1; 70 | itm1 = y; 71 | 72 | buffer_write(output[pos], (otm1 + otm2) * 0.5f); 73 | } 74 | 75 | plugin_data->itm1 = itm1; 76 | plugin_data->otm1 = otm1; 77 | plugin_data->otm2 = otm2; 78 | plugin_data->rnda = rnda; 79 | plugin_data->rndb = rndb; 80 | ]]> 81 | 82 | 83 | Waveform (1=sin, 2=tri, 3=squ, 4=saw) 84 |

98 | 99 |
100 | 101 | 102 | Frequency (Hz) 103 |

The frequency of the output (Hz).

104 | 105 |
106 | 107 | 108 | Warmth 109 |

The degree of softening that is applied to the generted waveform, reduces the number of harmonics in the output.

110 | 111 |
112 | 113 | 114 | Instability 115 |

The degree of pitch instability of the output. Turning this too high with square and saw waves will produce an anoying jittery sound, I want to fix this but it is tricky.

116 | 117 |
118 | 119 | 120 | Output 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 |
132 |
133 | -------------------------------------------------------------------------------- /plugins/bandpass_a_iir-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "util/iir.h" 11 | 12 | 13 | 14 | 15 | 16 | Glame Bandpass Analog Filter 17 |

IIR bandpass filter modeled after an analog circuit. This filter was ported from the glame multitrack editor to ladspa. 18 |

19 | 20 | 21 | sample_rate = s_rate; 22 | gt = init_iir_stage(IIR_STAGE_LOWPASS,1,3,2); 23 | iirf = init_iirf_t(gt); 24 | 25 | 26 | calc_2polebandpass(iirf, gt, center, width, sample_rate); 27 | iir_process_buffer_1s_5(iirf, gt, input, output, sample_count); 28 | 29 | 30 | 31 | calc_2polebandpass(iirf, plugin_data->gt, *(plugin_data->center), *(plugin_data->width), sample_rate); 32 | 33 | 34 | 35 | free_iirf_t(plugin_data->iirf, plugin_data->gt); 36 | free_iir_stage(plugin_data->gt); 37 | 38 | 39 | 40 | Center Frequency (Hz) 41 | 42 | 43 | 44 | 45 | Bandwidth (Hz) 46 | 47 | 48 | 49 | 50 | Input 51 | 52 | 53 | 54 | Output 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |
63 | -------------------------------------------------------------------------------- /plugins/bandpass_iir-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "util/iir.h" 11 | 12 | 13 | 14 | 15 | 16 | Glame Bandpass Filter 17 |

IIR bandpass filter based using chebishev coefficients. The filter allows you to tweak the number of stages used for 18 | filtering. Every stage adds two more poles, which leads to a steeper dropoff. More stages need more CPU power. This 19 | filter was ported from the glame multitrack editor to ladspa. 20 |

21 | 22 | 23 | sample_rate = s_rate; 24 | first = init_iir_stage(IIR_STAGE_LOWPASS,10,3,2); 25 | second = init_iir_stage(IIR_STAGE_HIGHPASS,10,3,2); 26 | gt = init_iir_stage(IIR_STAGE_BANDPASS,20,3,2); 27 | iirf = init_iirf_t(gt); 28 | 29 | 30 | ufc = (center + width*0.5f)/(float)sample_rate; 31 | lfc = (center - width*0.5f)/(float)sample_rate; 32 | combine_iir_stages(IIR_STAGE_BANDPASS, gt, first, second, 33 | chebyshev(iirf, first, 2*CLAMP((int)stages,1,10), IIR_STAGE_LOWPASS, ufc, 0.5f), 34 | chebyshev(iirf, second, 2*CLAMP((int)stages,1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f)); 35 | iir_process_buffer_ns_5(iirf, gt, input, output, sample_count); 36 | 37 | 38 | 39 | plugin_data->ufc = (*(plugin_data->center) + *(plugin_data->width)*0.5f)/(float)sample_rate; 40 | plugin_data->lfc = (*(plugin_data->center) - *(plugin_data->width)*0.5f)/(float)sample_rate; 41 | chebyshev(plugin_data->iirf, plugin_data->first, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_LOWPASS, plugin_data->ufc, 0.5f); 42 | chebyshev(plugin_data->iirf, plugin_data->second, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_HIGHPASS, plugin_data->lfc, 0.5f); 43 | combine_iir_stages(IIR_STAGE_BANDPASS, plugin_data->gt, plugin_data->first, plugin_data->second,0,0); 44 | 45 | 46 | 47 | free_iirf_t(plugin_data->iirf, plugin_data->gt); 48 | free_iir_stage(plugin_data->first); 49 | free_iir_stage(plugin_data->second); 50 | free_iir_stage(plugin_data->gt); 51 | 52 | 53 | 54 | Center Frequency (Hz) 55 | 56 | 57 | 58 | 59 | Bandwidth (Hz) 60 | 61 | 62 | 63 | 64 | Stages(2 poles per stage) 65 | 66 | 67 | 68 | 69 | Input 70 | 71 | 72 | 73 | Output 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 |
85 |
86 | -------------------------------------------------------------------------------- /plugins/chebstortion-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | #define HARMONICS 11 14 | #define STAGES 2 15 | 16 | static float cd_lut[STAGES][HARMONICS]; 17 | 18 | /* Calculate Chebychev coefficents from partial magnitudes, adapted from 19 | * example in Num. Rec. */ 20 | void chebpc(float c[], float d[]) 21 | { 22 | int k, j; 23 | float sv, dd[HARMONICS]; 24 | 25 | for (j = 0; j < HARMONICS; j++) { 26 | d[j] = dd[j] = 0.0; 27 | } 28 | 29 | d[0] = c[HARMONICS - 1]; 30 | 31 | for (j = HARMONICS - 2; j >= 1; j--) { 32 | for (k = HARMONICS - j; k >= 1; k--) { 33 | sv = d[k]; 34 | d[k] = 2.0 * d[k - 1] - dd[k]; 35 | dd[k] = sv; 36 | } 37 | sv = d[0]; 38 | d[0] = -dd[0] + c[j]; 39 | dd[0] = sv; 40 | } 41 | 42 | for (j = HARMONICS - 1; j >= 1; j--) { 43 | d[j] = d[j - 1] - dd[j]; 44 | } 45 | d[0] = -dd[0] + 0.5 * c[0]; 46 | } 47 | 48 | ]]> 49 | 50 | 51 | 52 | Chebyshev distortion 53 |

This is an interesting distortion effect that is seeded from incoming 54 | signal envelope. As the level of the signal rises more and more harmonics will 55 | for added to the output signal.

56 |

The distortion control sets the sensitivity of the input.

57 |

The effect eveolved from some experiments between Tim Goetze and myself, 58 | apptempting to emulate valve based guitar amp distortion. This was one of the 59 | failures, but it still makes an interesting noise.

60 | 61 | 80 | 81 | 87 | 88 | env) { 98 | env = env * 0.9f + a * 0.1f; 99 | } else { 100 | env = env * 0.97f + a * 0.03f; 101 | } 102 | 103 | if (count-- == 0) { 104 | for (i=0; iitm1 = itm1; 126 | plugin_data->otm1 = otm1; 127 | plugin_data->env = env; 128 | plugin_data->count = count; 129 | ]]> 130 | 131 | 132 | Distortion 133 | 134 | 135 | 136 | 137 | Input 138 | 139 | 140 | 141 | 142 | Output 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 |
151 |
152 | -------------------------------------------------------------------------------- /plugins/comb_splitter-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "ladspa-util.h" 11 | #define COMB_SIZE 0x4000 12 | #define COMB_MASK 0x3FFF 13 | 14 | 15 | 16 | 17 | Comb Splitter 18 |

Divides the input up into two parts with frequency peaks at f Hz intervals, skewed by f/2 Hz between the two outputs. Mixing the two outputs will get you exactly the input signal.

19 |

I generally use this trick to divide up an input signal, process the two halves differently, then mix them again. It sounds pretty funky.

20 | 21 | 22 | sample_rate = s_rate; 23 | comb_tbl = malloc(sizeof(LADSPA_Data) * COMB_SIZE); 24 | comb_pos = 0; 25 | last_offset = 1000; 26 | 27 | 28 | 29 | int i; 30 | 31 | for (i = 0; i < COMB_SIZE; i++) { 32 | comb_tbl[i] = 0; 33 | } 34 | comb_pos = 0; 35 | last_offset = 1000; 36 | 37 | 38 | 39 | free(plugin_data->comb_tbl); 40 | 41 | 42 | comb_pos = comb_pos; 67 | plugin_data->last_offset = offset; 68 | ]]> 69 | 70 | 71 | Band separation (Hz) 72 | 73 |

The distance between the frequency peaks.

74 |
75 | 76 | 77 | Input 78 | 79 | 80 | 81 | Output 1 82 |

The sum output.

83 |
84 | 85 | 86 | Output 2 87 |

The difference output.

88 |
89 | 90 | 91 | 92 | 93 | 94 |
95 |
96 | -------------------------------------------------------------------------------- /plugins/const-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Constant Signal Generator 14 |

This plugin add an output DC offset at the given amplitude to the input 15 | signal. It has no real use other than for debugging and in modular synths.

16 | 17 | 20 | 21 | last_amp = amp; 32 | ]]> 33 | 34 | 35 | Signal amplitude 36 |

Controls the amplitude of the output signal.

37 | 38 |
39 | 40 | 41 | Input 42 | 43 | 44 | 45 | Output 46 | 47 | 48 | 49 |
50 |
51 | -------------------------------------------------------------------------------- /plugins/crossover_dist-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | Crossover distortion 17 |

This is a simulation of the distortion that happens in class B and AB power amps when the signal crosses 0.

18 |

For class B simulations the smooth value should be set to about 0.3 +/- 0.2 and for AB it should be set to near 1.0.

19 | 20 | 39 | 40 | 41 | Crossover amplitude 42 |

Controls the point at which the output signal becomes linear.

43 | 44 |
45 | 46 | 47 | Smoothing 48 |

Controls degree of smoothing of the crossover point.

49 | 50 |
51 | 52 | 53 | Input 54 | 55 | 56 | 57 | Output 58 | 59 |
60 |
61 | -------------------------------------------------------------------------------- /plugins/dc_remove-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | DC Offset Remover 14 |

Simply removes the DC (0 Hz) component from an audio signal, uses a high pass filter, so has some side effects, but they should be minimal.

15 | 16 | 20 | 21 | itm1 = itm1; 31 | plugin_data->otm1 = otm1; 32 | ]]> 33 | 34 | 35 | Input 36 | 37 | 38 | 39 | Output 40 | 41 | 42 | 43 | 44 |
45 |
46 | -------------------------------------------------------------------------------- /plugins/debug-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "stdio.h" 11 | 12 | 13 | 14 | 15 | Debug Plugin 16 |

Prints some stats about the input stream to stdout. Not intended for general use.

17 | 18 | 19 | printf("sample rate %ld\n", s_rate); 20 | 21 | 22 | 23 | static LADSPA_Data max, min, maxl, minl; 24 | unsigned long pos; 25 | 26 | if (reset) { 27 | max = 0; 28 | min = 0; 29 | maxl = 0; 30 | minl = 1; 31 | } 32 | 33 | for (pos = 0; pos < sample_count; pos++) { 34 | if (allvals) { 35 | printf("%f\n", input[pos]); 36 | } 37 | max = fabs(input[pos]) > max?fabs(input[pos]):max; 38 | min = fabs(input[pos]) < min?fabs(input[pos]):min; 39 | maxl = input[pos] > maxl?input[pos]:maxl; 40 | minl = input[pos] < minl?input[pos]:minl; 41 | buffer_write(output[pos], input[pos]); 42 | } 43 | printf("amplitude (%f, %f)\t", min, max); 44 | printf("level (%f, %f)\n", minl, maxl); 45 | 46 | 47 | 48 | Diplay all values? 49 | 50 | 51 | 52 | 53 | Reset counters? 54 | 55 | 56 | 57 | 58 | Input 59 | 60 | 61 | 62 | Output 63 | 64 |
65 |
66 | -------------------------------------------------------------------------------- /plugins/decay-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | Exponential signal decay 21 |

Based on work by James McCartney in SuperCollider.

22 | 23 | 26 | 27 | b = 0.f; 29 | plugin_data->y = 0.f; 30 | plugin_data->last_decay_time = 0.f; 31 | plugin_data->first_time = 0; 32 | ]]> 33 | 34 | last_decay_time = decay_time; 39 | plugin_data->b = decay_time == 0.f ? 0.f : exp (LOG001 / (decay_time * sample_rate)); 40 | plugin_data->first_time = 0; 41 | } 42 | 43 | if (decay_time == plugin_data->last_decay_time) { 44 | if (b == 0.f) 45 | for (i=0; ib = decay_time == 0.f ? 0.f : exp (LOG001 / (decay_time * sample_rate)); 54 | b_slope = (plugin_data->b - b) / sample_count; 55 | 56 | for (i=0; ilast_decay_time = decay_time; 62 | } 63 | 64 | plugin_data->y = y; 65 | ]]> 66 | 67 | 68 | Input 69 | 70 | 71 | 72 | Output 73 | 74 | 75 | 76 | Decay Time (s) 77 | 78 |

79 | Time for the echoes to decay by 60 decibels. 80 |

81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 |
89 |
90 | -------------------------------------------------------------------------------- /plugins/decimator-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | #include "ladspa-util.h" 12 | ]]> 13 | 14 | 15 | 16 | Decimator 17 |

Decimates (reduces the effective sample rate), and reduces the bit depth of the input signal, allows non integer values for smooth transitions between clean and lofi signals.

18 | 19 | 20 | sample_rate = s_rate; 21 | count = 0.0f; 22 | last_out = 0.0f; 23 | 24 | 25 | = 31.0f || bits < 1.0f) { 31 | step = 0.0f; 32 | stepr = 1.0f; 33 | } else { 34 | step = pow(0.5f, bits - 0.999f); 35 | stepr = 1/step; 36 | } 37 | 38 | if (fs >= sample_rate) { 39 | ratio = 1.0f; 40 | } else { 41 | ratio = fs/sample_rate; 42 | } 43 | 44 | for (pos = 0; pos < sample_count; pos++) { 45 | count += ratio; 46 | 47 | if (count >= 1.0f) { 48 | count -= 1.0f; 49 | delta = modf((input[pos] + (input[pos]<0?-1.0:1.0)*step*0.5) * stepr, &dummy) * step; 50 | last_out = input[pos] - delta; 51 | buffer_write(output[pos], last_out); 52 | } else { 53 | buffer_write(output[pos], last_out); 54 | } 55 | } 56 | 57 | plugin_data->last_out = last_out; 58 | plugin_data->count = count; 59 | ]]> 60 | 61 | 62 | Bit depth 63 | 64 |

The bit depth that the signal will be reduced to.

65 |
66 | 67 | 68 | Sample rate (Hz) 69 | 70 |

The sample rate that the signal will be resampled at.

71 |
72 | 73 | 74 | Input 75 | 76 | 77 | 78 | 79 | Output 80 | 81 | 82 | 83 | 84 | 85 | 86 |
87 |
88 | -------------------------------------------------------------------------------- /plugins/declip-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #define MAX_AMP 1.0f 11 | #define CLIP 0.8f 12 | #define CLIP_A ((MAX_AMP - CLIP) * (MAX_AMP - CLIP)) 13 | #define CLIP_B (MAX_AMP - 2.0f * CLIP) 14 | 15 | 16 | 17 | 18 | Declipper 19 |

Removes nasty clicks from input signals, not very kind to them though.

20 |

This code came from the music-dsp mailing list, but it was unattributed, if it's yours, please drop me a line and I'll credit you.

21 | 22 | -CLIP)) { 29 | output[pos] = in; 30 | } else if (in > 0.0f) { 31 | output[pos] = MAX_AMP - (CLIP_A / (CLIP_B + in)); 32 | } else { 33 | output[pos] = -(MAX_AMP - (CLIP_A / (CLIP_B - in))); 34 | } 35 | } 36 | ]]> 37 | 38 | 39 | Input 40 | 41 | 42 | 43 | 44 | Output 45 | 46 | 47 |
48 |
49 | -------------------------------------------------------------------------------- /plugins/diode-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Diode Processor 13 |

Mangles the signal as if it had been passed through a diode rectifier network.

14 |

You should probably follow this with a DC offset remover, unless you want the offset.

15 | 16 | = 0.0f && mode < 1.0f) { 20 | for (pos = 0; pos < sample_count; pos++) { 21 | output[pos] = ((1.0f-mode) * input[pos]) + 22 | (mode * (input[pos] > 0.0f ? input[pos] : 0.0f)); 23 | } 24 | } else if (mode >= 1.0f && mode < 2.0f) { 25 | float fac = mode - 1.0f; 26 | for (pos = 0; pos < sample_count; pos++) { 27 | output[pos] =((1.0f-fac) * (input[pos] > 0 ? 28 | input[pos] : 0.0)) + (fac * fabs(input[pos])); 29 | } 30 | } else if (mode >= 2) { 31 | float fac = mode < 3 ? mode - 2 : 1.0; 32 | for (pos = 0; pos < sample_count; pos++) { 33 | output[pos] = (1.0-fac) * fabs(input[pos]); 34 | } 35 | } else { 36 | for (pos = 0; pos < sample_count; pos++) { 37 | output[pos] = input[pos]; 38 | } 39 | } 40 | ]]> 41 | 42 | 43 | Mode (0 for none, 1 for half wave, 2 for full wave) 44 |

The mode parameter is continuously variable from thru to half-wave rectification to full-wave to silence.

45 | 46 |
47 | 48 | 49 | Input 50 | 51 | 52 | 53 | Output 54 | 55 |
56 |
57 | -------------------------------------------------------------------------------- /plugins/divider-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Audio Divider (Suboctave Generator) 13 |

Reduces the period of the signal by the factor given, and makes it a square wave in the process. Has some amplitude tracking capability, but not really useful on complex signals.

14 | 15 | 23 | 24 | 0.0f && last <= 0.0f) || 33 | (input[pos] < 0.0f && last >= 0.0)) { 34 | zeroxs++; 35 | if (den == 1) { 36 | out = out > 0.0f ? -1.0f : 1.0f; 37 | lamp = amp / count; 38 | zeroxs = 0; 39 | count = 0; 40 | amp = 0; 41 | } 42 | } 43 | amp += fabs(input[pos]); 44 | if (den > 1 && (zeroxs % den) == den-1) { 45 | out = out > 0.0f ? -1.0f : 1.0f; 46 | lamp = amp / count; 47 | zeroxs = 0; 48 | count = 0; 49 | amp = 0; 50 | } 51 | last = input[pos]; 52 | output[pos] = out * lamp; 53 | } 54 | 55 | plugin_data->last = last; 56 | plugin_data->amp = amp; 57 | plugin_data->lamp = lamp; 58 | plugin_data->zeroxs = zeroxs; 59 | plugin_data->count = count; 60 | plugin_data->out = out; 61 | ]]> 62 | 63 | 64 | Denominator 65 | 66 |

The factor the incoming frequency will be divided by.

67 |
68 | 69 | 70 | Input 71 | 72 | 73 | 74 | Output 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
96 |
97 | -------------------------------------------------------------------------------- /plugins/dj_flanger-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | #include "ladspa-util.h" 13 | 14 | #define DELAY_TIME 0.005f 15 | ]]> 16 | 17 | 18 | 19 | DJ flanger 20 |

This is a flanger which is more or less typical of DJ mising desks. Requested by Patrick Shirkey.

21 | 22 | 36 | 37 | 41 | 42 | 99.0f) { 52 | fb = 0.99f; 53 | } else if (feedback < -99.0f) { 54 | fb = -0.99f; 55 | } else { 56 | fb = feedback * 0.01f; 57 | } 58 | 59 | if (sync > 0) { 60 | if (!last_sync) { 61 | x = 0.5f; 62 | y = 0.0f; 63 | } 64 | plugin_data->last_sync = 1; 65 | } else { 66 | plugin_data->last_sync = 0; 67 | } 68 | 69 | for (pos = 0; pos < sample_count; pos++) { 70 | /* Write input into delay line */ 71 | buffer[buffer_pos] = input[pos]; 72 | 73 | /* Calcuate delay */ 74 | d = (x + 0.5f) * dr; 75 | 76 | dof = f_round(d); 77 | //dout = buffer[(buffer_pos - f_round(d)) & buffer_mask]; 78 | dout = cube_interp(d - floor(d), 79 | buffer[(buffer_pos - dof - 3) & buffer_mask], 80 | buffer[(buffer_pos - dof - 2) & buffer_mask], 81 | buffer[(buffer_pos - dof - 1) & buffer_mask], 82 | buffer[(buffer_pos - dof) & buffer_mask]); 83 | 84 | /* Write output */ 85 | out = (buffer[buffer_pos] + dout) * 0.5f; 86 | buffer[buffer_pos] = input[pos] + out * fb; 87 | buffer_write(output[pos], out); 88 | 89 | /* Roll ringbuffer */ 90 | buffer_pos = (buffer_pos + 1) & buffer_mask; 91 | 92 | /* Run LFO */ 93 | x -= omega * y; 94 | y += omega * x; 95 | } 96 | 97 | plugin_data->x = x; 98 | plugin_data->y = y; 99 | plugin_data->buffer_pos = buffer_pos; 100 | ]]> 101 | 102 | buffer); 104 | ]]> 105 | 106 | 107 | LFO sync 108 |

When turned from off to on it resets the phase of the LFO back to the start of the cycle. Used to sync the LFO to the track.

109 |
110 | 111 | 112 | LFO period (s) 113 |

The cycle period of the LFO in seconds.

114 | 115 |
116 | 117 | 118 | LFO depth (ms) 119 |

The maximum delay the LFO will use to flange, in milliseconds.

120 | 121 |
122 | 123 | 124 | Feedback (%) 125 |

The amount of the delays output that is mixed back into the delay.

126 | 127 |
128 | 129 | 130 | Input 131 | 132 | 133 | 134 | Output 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 |
145 |
146 | -------------------------------------------------------------------------------- /plugins/fad_delay-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | #include "ladspa-util.h" 10 | 11 | #define BASE_BUFFER 8 // Base buffer length (s) 12 | 13 | 14 | 15 | 16 | Fractionally Addressed Delay Line 17 |

A fixed ring buffer delay implementation. Has different dynamics to a normal delay, more suitable for certain things.

18 |

Changes in delay length are generally more pleasing, but delays >2s long have reduced sound quality.

19 | 20 | 33 | 34 | 35 | int i; 36 | 37 | for (i = 0; i < buffer_size; i++) { 38 | buffer[i] = 0; 39 | } 40 | phase = 0; 41 | last_phase = 0; 42 | last_in = 0.0f; 43 | sample_rate = sample_rate; 44 | 45 | 46 | 47 | free(plugin_data->buffer); 48 | 49 | 50 | 1.0f ? 1.0f : lin_inc; 69 | lin_int = 0.0f; 70 | for (track = last_phase; track < phase; track++) { 71 | lin_int += lin_inc; 72 | buffer[track % buffer_size] = out * fb + 73 | LIN_INTERP(lin_int, last_in, input[pos]); 74 | } 75 | last_in = input[pos]; 76 | buffer_write(output[pos], out); 77 | if (phase >= buffer_size) { 78 | phase -= buffer_size; 79 | } 80 | } 81 | 82 | // Store current phase in instance 83 | plugin_data->phase = phase; 84 | plugin_data->last_phase = last_phase; 85 | plugin_data->last_in = last_in; 86 | ]]> 87 | 88 | 89 | Delay (seconds) 90 |

The neutral delay time is 2 seconds. Times above 2 seconds will have reduced quality and times below will have increased CPU usage.

91 | 92 |
93 | 94 | 95 | Feedback (dB) 96 | 97 | 98 | 99 | 100 | Input 101 | 102 | 103 | 104 | Output 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 |
115 |
116 | -------------------------------------------------------------------------------- /plugins/fm_osc-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | #include "util/blo.h" 13 | 14 | 15 | 16 | 17 | FM Oscillator 18 | 19 | 23 | 24 | wave = LIMIT(f_round(wave) - 1, 0, BLO_N_WAVES-1); 27 | 28 | tables = tables; // So gcc doesn't think it's unused 29 | 30 | for (pos = 0; pos < sample_count; pos++) { 31 | blo_hd_set_freq(osc, fm[pos]); 32 | buffer_write(output[pos], blo_hd_run_cub(osc)); 33 | } 34 | ]]> 35 | 36 | tables); 38 | blo_h_free(plugin_data->osc); 39 | ]]> 40 | 41 | 42 | Waveform (1=sin, 2=tri, 3=squ, 4=saw) 43 |

The shape of the waveform.

44 |

56 | 57 |
58 | 59 | 60 | Frequency (Hz) 61 |

The frequency of the output (in Hertz).

62 | 63 |
64 | 65 | 66 | Output 67 | 68 | 69 | 70 | 71 |
72 |
73 | -------------------------------------------------------------------------------- /plugins/foldover-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Foldover distortion 14 |

Uses a sinwave approximation to simulate valve style foldover distortion.

15 |

Probably should have a DC offset remover on the output, but it's not always necessary.

16 | 17 | 27 | 28 | 29 | Drive 30 | 31 |

Controls the degree of distortion.

32 |
33 | 34 | 35 | Skew 36 | 37 |

Controls the asymmetry of the waveform.

38 |
39 | 40 | 41 | Input 42 | 43 | 44 | 45 | Output 46 | 47 |
48 |
49 | -------------------------------------------------------------------------------- /plugins/foverdrive-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Fast overdrive 13 |

A simple overdrive. Compresses the extreme peaks to make a sound similar to an overdriven amplifier.

14 | 15 | 16 | unsigned long pos; 17 | const float drivem1 = drive - 1.0f; 18 | 19 | for (pos = 0; pos < sample_count; pos++) { 20 | LADSPA_Data x = input[pos]; 21 | const float fx = fabs(x); 22 | output[pos] = x*(fx + drive)/(x*x + drivem1*fx + 1.0f); 23 | } 24 | 25 | 26 | 27 | Drive level 28 | 29 |

Controls the point at which the signal starts to distort, and the degree of distortion.

30 |
31 | 32 | 33 | Input 34 | 35 | 36 | 37 | Output 38 | 39 |
40 |
41 | -------------------------------------------------------------------------------- /plugins/freq_tracker-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | Frequency tracker 17 | 18 | 25 | 26 | 32 | 33 | 0.0f) { 41 | if (cross_time > 3.0f) { 42 | f = fs / ((float)cross_time * 2.0f); 43 | } 44 | cross_time = 0; 45 | } 46 | xm1 = input[pos]; 47 | cross_time++; 48 | fo = fo * damp_lp + f * damp_lpi; 49 | fo = flush_to_zero(fo); 50 | buffer_write(freq[pos], fo); 51 | } 52 | 53 | plugin_data->last_amp = xm1; 54 | plugin_data->fo = fo; 55 | plugin_data->f = f; 56 | plugin_data->cross_time = cross_time; 57 | ]]> 58 | 59 | 60 | Tracking speed 61 |

This controls the level of damping applied to the output.

62 |

High values will make the frequency output jump around, low values will make it a bit slow to respond.

63 | 64 |
65 | 66 | 67 | Input 68 | 69 | 70 | 71 | Frequency (Hz) 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
80 |
81 | -------------------------------------------------------------------------------- /plugins/gong_beater-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Gong beater 17 |

A plugin to simulator the action of a beator on a gong surface, used to trigger the gong physical model.

18 |

It is triggered by an impulse on the input, eg. from a mic or piezo placed near a solid surface, for an event sequencer.

19 | 20 | 29 | 30 | 37 | 38 | 0.05f) { 48 | running = strike_duration * fs; 49 | imp_level = fabs(input[pos]); 50 | } 51 | buffer_write(output[pos], input[pos] * imp_amp); 52 | } 53 | for (; running && pos < sample_count; pos++, running--) { 54 | if (fabs(input[pos]) > imp_level) { 55 | imp_level = fabs(input[pos]); 56 | } 57 | x -= omega * y; 58 | y += omega * x; 59 | xm -= omega * 0.5f * ym; 60 | ym += omega * 0.5f * xm; 61 | 62 | buffer_write(output[pos], input[pos] * imp_amp + y * strike_amp * 63 | imp_level * 4.0f * ym); 64 | } 65 | } 66 | 67 | plugin_data->x = x; 68 | plugin_data->y = y; 69 | plugin_data->xm = xm; 70 | plugin_data->ym = ym; 71 | plugin_data->running = running; 72 | plugin_data->imp_level = imp_level; 73 | ]]> 74 | 75 | 76 | Impulse gain (dB) 77 |

The gain of the input impulse mixed into the output, bringing this up allows you to make the outputted strike more impulsive, but may reduce the gongyness of the resulting output sound.

78 | 79 |
80 | 81 | 82 | Strike gain (dB) 83 |

The gain of the simulated pressure wave mixed into the output, bringing this up allows you to make the outputted strike more pure. The final output level is also proprtional to the amplitude of the trigger.

84 | 85 |
86 | 87 | 88 | Strike duration (s) 89 |

The duration of the pressure wave used to simulate the action of the beater on the gong surface. The logner the duration the more sonorus the resulting gong sound.

90 | 91 |
92 | 93 | 94 | Input 95 | 96 | 97 | 98 | Output 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 |
109 |
110 | -------------------------------------------------------------------------------- /plugins/hard_limiter-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | #include "ladspa-util.h" 13 | ]]> 14 | 15 | 16 | 17 | Hard Limiter 18 |

Brick hard limiter with residue mixer.

19 | 20 | limit_g ? data - limit_g : 0.0; 28 | data -= residue; 29 | buffer_write(output[i], 30 | sign * (wet_gain * data + res_gain * residue)); 31 | } 32 | ]]> 33 | 34 | 35 | dB limit 36 |

37 | 38 |
39 | 40 | 41 | Wet level 42 |

Output level for limited signal.

43 | 44 |
45 | 46 | 47 | Residue level 48 |

Output level for residue signal.

49 | 50 |
51 | 52 | 53 | Input 54 | 55 | 56 | 57 | Output 58 | 59 | 60 |
61 |
62 | -------------------------------------------------------------------------------- /plugins/highpass_iir-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "util/iir.h" 11 | 12 | 13 | 14 | 15 | 16 | Glame Highpass Filter 17 |

IIR highpass filter based using chebishev coefficients. The filter allows you to tweak the number of stages used for 18 | filtering. Every stage adds two more poles, which leads to a steeper dropoff. More stages need more CPU power. This 19 | filter was ported from the glame multitrack editor to ladspa. 20 |

21 | 22 | 23 | sample_rate = s_rate; 24 | gt = init_iir_stage(IIR_STAGE_HIGHPASS,10,3,2); 25 | iirf = init_iirf_t(gt); 26 | 27 | 28 | chebyshev(iirf, gt, 2*CLAMP((int)stages,1,10), IIR_STAGE_HIGHPASS, cutoff/(float)sample_rate, 0.5f); 29 | iir_process_buffer_ns_5(iirf, gt, input, output, sample_count); 30 | 31 | 32 | 33 | chebyshev(plugin_data->iirf, plugin_data->gt, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_HIGHPASS, *(plugin_data->cutoff)/(float)sample_rate, 0.5f); 34 | 35 | 36 | 37 | free_iirf_t(plugin_data->iirf, plugin_data->gt); 38 | free_iir_stage(plugin_data->gt); 39 | 40 | 41 | 42 | Cutoff Frequency 43 | 44 | 45 | 46 | 47 | Stages(2 poles per stage) 48 | 49 | 50 | 51 | 52 | Input 53 | 54 | 55 | 56 | Output 57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 |
65 | -------------------------------------------------------------------------------- /plugins/hilbert-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | #define D_SIZE 256 14 | #define NZEROS 200 15 | 16 | /* The non-zero taps of the Hilbert transformer */ 17 | static float xcoeffs[] = { 18 | +0.0008103736f, +0.0008457886f, +0.0009017196f, +0.0009793364f, 19 | +0.0010798341f, +0.0012044365f, +0.0013544008f, +0.0015310235f, 20 | +0.0017356466f, +0.0019696659f, +0.0022345404f, +0.0025318040f, 21 | +0.0028630784f, +0.0032300896f, +0.0036346867f, +0.0040788644f, 22 | +0.0045647903f, +0.0050948365f, +0.0056716186f, +0.0062980419f, 23 | +0.0069773575f, +0.0077132300f, +0.0085098208f, +0.0093718901f, 24 | +0.0103049226f, +0.0113152847f, +0.0124104218f, +0.0135991079f, 25 | +0.0148917649f, +0.0163008758f, +0.0178415242f, +0.0195321089f, 26 | +0.0213953037f, +0.0234593652f, +0.0257599469f, +0.0283426636f, 27 | +0.0312667947f, +0.0346107648f, +0.0384804823f, +0.0430224431f, 28 | +0.0484451086f, +0.0550553725f, +0.0633242001f, +0.0740128560f, 29 | +0.0884368322f, +0.1090816773f, +0.1412745301f, +0.1988673273f, 30 | +0.3326528346f, +0.9997730178f, -0.9997730178f, -0.3326528346f, 31 | -0.1988673273f, -0.1412745301f, -0.1090816773f, -0.0884368322f, 32 | -0.0740128560f, -0.0633242001f, -0.0550553725f, -0.0484451086f, 33 | -0.0430224431f, -0.0384804823f, -0.0346107648f, -0.0312667947f, 34 | -0.0283426636f, -0.0257599469f, -0.0234593652f, -0.0213953037f, 35 | -0.0195321089f, -0.0178415242f, -0.0163008758f, -0.0148917649f, 36 | -0.0135991079f, -0.0124104218f, -0.0113152847f, -0.0103049226f, 37 | -0.0093718901f, -0.0085098208f, -0.0077132300f, -0.0069773575f, 38 | -0.0062980419f, -0.0056716186f, -0.0050948365f, -0.0045647903f, 39 | -0.0040788644f, -0.0036346867f, -0.0032300896f, -0.0028630784f, 40 | -0.0025318040f, -0.0022345404f, -0.0019696659f, -0.0017356466f, 41 | -0.0015310235f, -0.0013544008f, -0.0012044365f, -0.0010798341f, 42 | -0.0009793364f, -0.0009017196f, -0.0008457886f, -0.0008103736f, 43 | }; 44 | 45 | 46 | 47 | 48 | Hilbert transformer 49 |

A Hilbert Transformer phase shifts the input signal by 90degrees. It outputs the 90 degree phase shifted signal and the unshifted signal, both delayed by an equivlaent ammount

50 |

This plugin was written for a demo at the LAD Meet in 2003.

51 | 52 | 57 | 58 | delay); 60 | ]]> 61 | 62 | dptr = dptr; 79 | 80 | *(plugin_data->latency) = 99; 81 | ]]> 82 | 83 | 84 | Input 85 | 86 | 87 | 88 | 0deg output 89 | 90 | 91 | 92 | 90deg output 93 | 94 | 95 | 96 | latency 97 | 98 | 99 | 100 | 101 |
102 |
103 | -------------------------------------------------------------------------------- /plugins/impulse-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | Non-bandlimited single-sample impulses 21 |

Based on work by James McCartney in SuperCollider.

22 | 23 | 27 | 28 | 31 | 32 | 1.f) { 38 | phase -= 1.f; 39 | buffer_write(out[i], 1.f); 40 | } else { 41 | buffer_write(out[i], 0.f); 42 | } 43 | phase += phase_step; 44 | } 45 | 46 | plugin_data->phase = phase; 47 | ]]> 48 | 49 | 50 | Frequency (Hz) 51 | 52 |

53 | Frequency for the impulses. 54 |

55 |
56 | 57 | 58 | Output 59 | 60 | 61 | 62 | 63 |
64 |
65 | -------------------------------------------------------------------------------- /plugins/inv-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Inverter 14 |

A utility plugin that inverts the signal, also (wrongly) known as a 180 degree phase shift.

15 | 16 | 23 | 24 | 25 | Input 26 | 27 | 28 | 29 | Output 30 | 31 |
32 |
33 | -------------------------------------------------------------------------------- /plugins/karaoke-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Karaoke 14 |

Attempts to strip the vocals from a stereo signal.

15 | 16 | 28 | 29 | 30 | Vocal volume (dB) 31 |

Controls the attenuation of the vocal (centre channel) in dB's.

32 |

The greater the attenuation the greater the loss of stereo field.

33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | Left in 41 | 42 | 43 | 44 | Right in 45 | 46 | 47 | 48 | Left out 49 | 50 | 51 | 52 | Right out 53 | 54 |
55 |
56 | -------------------------------------------------------------------------------- /plugins/latency-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Artificial latency 17 |

Reports its delay value as systemic latency. Does nothing else, *this is not a delay*.

18 |

Can be used to correct for latency between channels.

19 | 20 | 23 | 24 | latency) = (float)delay_fr; 34 | ]]> 35 | 36 | 37 | Delay (ms) 38 | 39 | 40 | 41 | 42 | Input 43 | 44 | 45 | 46 | Output 47 | 48 | 49 | 50 | latency 51 | 52 | 53 | 54 |
55 |
56 | -------------------------------------------------------------------------------- /plugins/lowpass_iir-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "util/iir.h" 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | 17 | Glame Lowpass Filter 18 |

IIR lowpass filter based using chebishev coefficients. The filter allows you to tweak the number of stages used for 19 | filtering. Every stage adds two more poles, which leads to a steeper dropoff. More stages need more CPU power. This 20 | filter was ported from the glame multitrack editor to ladspa. 21 |

22 | 23 | 24 | sample_rate = s_rate; 25 | gt = init_iir_stage(IIR_STAGE_LOWPASS,10,3,2); 26 | iirf = init_iirf_t(gt); 27 | 28 | 29 | chebyshev(iirf, gt, 2*CLAMP((int)stages,1,10), IIR_STAGE_LOWPASS, cutoff/(float)sample_rate, 0.5f); 30 | iir_process_buffer_ns_5(iirf, gt, input, output, sample_count); 31 | 32 | 33 | 34 | chebyshev(plugin_data->iirf, plugin_data->gt, 2*CLAMP(f_round(*(plugin_data->stages)),1,10), IIR_STAGE_LOWPASS, 35 | *(plugin_data->cutoff)/(float)sample_rate, 0.5f); 36 | 37 | 38 | 39 | free_iirf_t(plugin_data->iirf, plugin_data->gt); 40 | free_iir_stage(plugin_data->gt); 41 | 42 | 43 | 44 | Cutoff Frequency 45 | 46 | 47 | 48 | 49 | Stages(2 poles per stage) 50 | 51 | 52 | 53 | 54 | Input 55 | 56 | 57 | 58 | Output 59 | 60 | 61 | 62 | 63 | 64 | 65 |
66 |
67 | -------------------------------------------------------------------------------- /plugins/ls_filter-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | #include "util/ls_filter.h" 13 | 14 | 15 | 16 | 17 | LS Filter 18 |

This is a filter created for the LinkSampler project - its designed to closly follow the filter used in giga sampler.

19 | 20 | 24 | 25 | 28 | 29 | 40 | 41 | filt); 43 | ]]> 44 | 45 | 46 | Filter type (0=LP, 1=BP, 2=HP) 47 |

The type of the filter, 0 for low pass, 1 for band pass, 2 for high pass.

48 | 49 |
50 | 51 | 52 | Cutoff frequency (Hz) 53 |

Controls the frequency at which the filter starts to effect the audio signal.

54 |

eg. a lowpass filter with a cutoff frequency of 1000 Hz will only let frequencies below 100 Hz through.

55 | 56 |
57 | 58 | 59 | Resonance 60 |

Creates a peak at the cutoff frequency, for the classic overdriven fileter sound. At high vlaues the peak at the cutoff will overwhelm the filtered signal.

61 | 62 |
63 | 64 | 65 | Input 66 | 67 | 68 | 69 | Output 70 | 71 | 72 | 73 | 74 |
75 |
76 | -------------------------------------------------------------------------------- /plugins/matrix_ms_st-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Matrix: MS to Stereo 14 | 15 | 23 | 24 | 25 | Width 26 |

The width of the dematrixed stereo field. 1 will give you normal width, 0 will make it completely mono, < 1 will make it narrower and > 1 will make it wider.

27 | 28 |
29 | 30 | 31 | 32 | 33 | Mid 34 | 35 | 36 | Side 37 | 38 | 39 | 40 | 41 | 42 | Left 43 | 44 | 45 | Right 46 | 47 |
48 |
49 | -------------------------------------------------------------------------------- /plugins/matrix_st_ms-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Matrix: Stereo to MS 14 | 15 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Left 30 | 31 | 32 | Right 33 | 34 | 35 | 36 | Mid 37 | 38 | 39 | Side 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /plugins/mod_delay-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Modulatable delay 17 |

A delay whose tap can be modulated at audio rate.

18 |

Requested by Matthias Nagorni at LinuxTag 2002, in order to make a Leslie simulator.

19 | 20 | 31 | 32 | 36 | 37 | buffer); 39 | ]]> 40 | 41 | write_ptr = write_ptr; 55 | ]]> 56 | 57 | 58 | Base delay (s) 59 | 60 | 61 | 62 | 63 | Delay (s) 64 | 65 | 66 | 67 | 68 | Input 69 | 70 | 71 | 72 | Output 73 | 74 | 75 | 76 | 77 | 78 | 79 |
80 |
81 | -------------------------------------------------------------------------------- /plugins/notch_iir-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "util/iir.h" 11 | 12 | 13 | 14 | 15 | 16 | Mag's Notch Filter 17 |

IIR notch filter based using chebishev coefficients. The filter allows you to tweak the number of stages used for 18 | filtering. Every stage adds two more poles, which leads to a steeper dropoff. More stages need more CPU power. 19 |

20 | 21 | 22 | sample_rate = s_rate; 23 | ufc = lfc = 0.0f; 24 | 25 | 26 | ufc = (center - width*0.5f)/(float)sample_rate; 27 | lfc = (center + width*0.5f)/(float)sample_rate; 28 | chebyshev(iirf1, first, 2*CLAMP((int)stages,1,10), IIR_STAGE_LOWPASS, ufc, 0.5f); 29 | chebyshev(iirf2, second, 2*CLAMP((int)stages,1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f); 30 | iir_process_buffer_ns_5(iirf1, first, input, output, sample_count); 31 | iir_process_buffer_ns_5(iirf2, second, input, output, sample_count, 1); /* add to first buffer */ 32 | 33 | 34 | 35 | ufc = (*(plugin_data->center) - *(plugin_data->width)*0.5f)/(float)sample_rate; 36 | lfc = (*(plugin_data->center) + *(plugin_data->width)*0.5f)/(float)sample_rate; 37 | first = init_iir_stage(IIR_STAGE_LOWPASS,10,3,2); 38 | second = init_iir_stage(IIR_STAGE_HIGHPASS,10,3,2); 39 | iirf1 = init_iirf_t(first); 40 | iirf2 = init_iirf_t(second); 41 | chebyshev(iirf1, first, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_LOWPASS, ufc, 0.5f); 42 | chebyshev(iirf2, second, 2*CLAMP((int)(*(plugin_data->stages)),1,10), IIR_STAGE_HIGHPASS, lfc, 0.5f); 43 | 44 | 45 | 46 | free_iirf_t(plugin_data->iirf1, plugin_data->first); 47 | free_iirf_t(plugin_data->iirf2, plugin_data->second); 48 | free_iir_stage(plugin_data->first); 49 | free_iir_stage(plugin_data->second); 50 | 51 | 52 | 53 | Center Frequency (Hz) 54 | 55 | 56 | 57 | 58 | Bandwidth (Hz) 59 | 60 | 61 | 62 | 63 | Stages(2 poles per stage) 64 | 65 | 66 | 67 | 68 | Input 69 | 70 | 71 | 72 | Output 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
84 |
85 | -------------------------------------------------------------------------------- /plugins/offset-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | (b) ? (a) : (b)) 16 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 17 | ]]> 18 | 19 | 20 | 21 | Offset, sample-based 22 |

Intended to be used to eliminate offset between tracks (e.g. single sound source simultaneously recorded from different distances).

23 | 24 | 27 | 28 | buffer_w_pos = 0; 31 | plugin_data->last_offset = 0; 32 | ]]> 33 | 34 | buffer); 36 | ]]> 37 | 38 | 0) { 43 | 44 | // report the maximum offset as latency to the host 45 | *(plugin_data->latency) = MAX_OFFSET; 46 | 47 | // and delay by the maximum offset by default 48 | // (results in no audible offset) 49 | buffer_r_pos = BUFFER_POS(buffer_w_pos - MAX_OFFSET); 50 | 51 | // apply user-configured offset (results in the desired offset): 52 | buffer_r_pos = BUFFER_POS(buffer_r_pos + (long)offset); 53 | 54 | } else { 55 | // report the currently required latency 56 | // (the LV2 specification does not allow a negative latency) 57 | *(plugin_data->latency) = MAX((long)offset, 0); 58 | 59 | // if delaying, apply the configured offset 60 | // (otherwise we rely on the host's latency compensation) 61 | buffer_r_pos = BUFFER_POS(buffer_w_pos + MIN((long)offset, 0)); 62 | } 63 | 64 | // if the offset increased, zero the buffer accordingly 65 | offset_delta = (long)offset - last_offset; 66 | for (; offset_delta>0; offset_delta--) { 67 | buffer[BUFFER_POS(buffer_r_pos - offset_delta)] = 0.0f; 68 | } 69 | 70 | for (i=0; ibuffer_w_pos = buffer_w_pos; 80 | plugin_data->last_offset = (long)offset; 81 | 82 | ]]> 83 | 84 | 85 | offset (in samples) 86 |

If positive, input will be played earlier; if negative, it's a delay.

87 | 88 |
89 | 90 | 91 | automatable (possibly adds playback delay) 92 |

Turn this off if the offset does not change when rolling. Otherwise, the required buffer possibly adds a playback delay.

93 |
94 | 95 | 96 | Input 97 | 98 | 99 | 100 | Output 101 | 102 | 103 | 104 | latency 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 |
114 |
115 | -------------------------------------------------------------------------------- /plugins/pitch_scale-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "string.h" 11 | #include "util/pitchscale.h" 12 | 13 | #define FRAME_LENGTH 4096 14 | #define OVER_SAMP 16 15 | 16 | 17 | 18 | 19 | Higher Quality Pitch Scaler 20 |

A pitch shifter implementation that scales the harmonics appropriately with the base frequencies. It is an implementation of Stephen M. Sprengler's pitch scaler design. It gives reasonable, general purpose results for small changes, but won't give Antares or Eventide anything to worry about.

21 |

The FFT block size and oversampling has been kept at reasonable levels to keep the CPU usage low, but it is smoother than the other Pitch Scaler.

22 | 23 | 24 | pitch_scale(buffers, mult, FRAME_LENGTH, OVER_SAMP, sample_count, sample_rate, input, output, 0, 0.0); 25 | *(plugin_data->latency) = FRAME_LENGTH - (FRAME_LENGTH 26 | / OVER_SAMP); 27 | 28 | 29 | 30 | int i; 31 | float arg; 32 | 33 | buffers = malloc(sizeof(sbuffers)); 34 | sample_rate = s_rate; 35 | buffers->gInFIFO = malloc(FRAME_LENGTH * sizeof(float)); 36 | buffers->gOutFIFO = malloc(FRAME_LENGTH * sizeof(float)); 37 | buffers->gLastPhase = malloc(FRAME_LENGTH * sizeof(float)); 38 | buffers->gSumPhase = malloc(FRAME_LENGTH * sizeof(float)); 39 | buffers->gOutputAccum = malloc(2*FRAME_LENGTH * sizeof(float)); 40 | buffers->gAnaFreq = malloc(FRAME_LENGTH * sizeof(float)); 41 | buffers->gAnaMagn = malloc(FRAME_LENGTH * sizeof(float)); 42 | buffers->gSynFreq = malloc(FRAME_LENGTH * sizeof(float)); 43 | buffers->gSynMagn = malloc(FRAME_LENGTH * sizeof(float)); 44 | buffers->gWindow = malloc(FRAME_LENGTH * sizeof(float)); 45 | 46 | arg = 2.0f * M_PI / (float)(FRAME_LENGTH-1); 47 | for (i=0; i < FRAME_LENGTH; i++) { 48 | // Blackman-Harris 49 | buffers->gWindow[i] = 0.35875f - 0.48829f * cos(arg * (float)i) + 0.14128f * cos(2.0f * arg * (float)i) - 0.01168f * cos(3.0f * arg * (float)i); 50 | // Gain correction 51 | buffers->gWindow[i] *= 0.761f; 52 | 53 | } 54 | 55 | 56 | 57 | gInFIFO, 0, FRAME_LENGTH*sizeof(float)); 59 | memset(buffers->gOutFIFO, 0, FRAME_LENGTH*sizeof(float)); 60 | memset(buffers->gLastPhase, 0, FRAME_LENGTH*sizeof(float)/2); 61 | memset(buffers->gSumPhase, 0, FRAME_LENGTH*sizeof(float)/2); 62 | memset(buffers->gOutputAccum, 0, 2*FRAME_LENGTH*sizeof(float)); 63 | memset(buffers->gAnaFreq, 0, FRAME_LENGTH*sizeof(float)); 64 | memset(buffers->gAnaMagn, 0, FRAME_LENGTH*sizeof(float)); 65 | buffers->gRover = 0; 66 | pitch_scale(buffers, 1.0, FRAME_LENGTH, 16, FRAME_LENGTH, sample_rate, buffers->gInFIFO, buffers->gOutFIFO, 0, 0.0f); 67 | ]]> 68 | 69 | buffers->gInFIFO); 71 | free (plugin_data->buffers->gOutFIFO); 72 | free (plugin_data->buffers->gLastPhase); 73 | free (plugin_data->buffers->gSumPhase); 74 | free (plugin_data->buffers->gOutputAccum); 75 | free (plugin_data->buffers->gAnaFreq); 76 | free (plugin_data->buffers->gAnaMagn); 77 | free (plugin_data->buffers->gSynFreq); 78 | free (plugin_data->buffers->gSynMagn); 79 | free (plugin_data->buffers->gWindow); 80 | free (plugin_data->buffers); 81 | ]]> 82 | 83 | 84 | Pitch co-efficient 85 | 86 |

The pitch scaling factor, a value of 2.0 will increase the pitch by one octave, etc.

87 |
88 | 89 | 90 | Input 91 | 92 | 93 | 94 | Output 95 | 96 | 97 | 98 | latency 99 | 100 | 101 | 102 | 103 | 104 |
105 |
106 | -------------------------------------------------------------------------------- /plugins/plate-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "util/waveguide_nl.h" 12 | 13 | #define LP_INNER 0.96f 14 | #define LP_OUTER 0.983f 15 | 16 | /* required for clang compilation */ 17 | void waveguide_nl_process_lin(waveguide_nl *wg, float in0, float in1, float *out0, float *out1); 18 | 19 | #define RUN_WG(n, junct_a, junct_b) waveguide_nl_process_lin(w[n], junct_a - out[n*2+1], junct_b - out[n*2], out+n*2, out+n*2+1) 20 | 21 | 22 | 23 | 24 | Plate reverb 25 |

A physical model of a steel plate reverb.

26 |

Based on Josep Comajuncosas' gong model, it uses 8 linear waveguides to model the plate.

27 | 28 | 41 | 42 | 49 | 50 | size * scale); 57 | } 58 | for (pos=0; pos<4; pos++) { 59 | waveguide_nl_set_fc(w[pos], LP_INNER * lpscale); 60 | } 61 | for (; pos<8; pos++) { 62 | waveguide_nl_set_fc(w[pos], LP_OUTER * lpscale); 63 | } 64 | 65 | for (pos = 0; pos < sample_count; pos++) { 66 | const float alpha = (out[0] + out[2] + out[4] + out[6]) * 0.5f 67 | + input[pos]; 68 | const float beta = (out[1] + out[9] + out[14]) * 0.666666666f; 69 | const float gamma = (out[3] + out[8] + out[11]) * 0.666666666f; 70 | const float delta = (out[5] + out[10] + out[13]) * 0.666666666f; 71 | const float epsilon = (out[7] + out[12] + out[15]) * 0.666666666f; 72 | 73 | RUN_WG(0, beta, alpha); 74 | RUN_WG(1, gamma, alpha); 75 | RUN_WG(2, delta, alpha); 76 | RUN_WG(3, epsilon, alpha); 77 | RUN_WG(4, beta, gamma); 78 | RUN_WG(5, gamma, delta); 79 | RUN_WG(6, delta, epsilon); 80 | RUN_WG(7, epsilon, beta); 81 | 82 | outputl[pos] = beta * wet + input[pos] * (1.0f - wet); 83 | outputr[pos] = gamma * wet + input[pos] * (1.0f - wet); 84 | } 85 | ]]> 86 | 87 | w[i]); 92 | } 93 | free(plugin_data->w); 94 | free(plugin_data->out); 95 | ]]> 96 | 97 | 98 | Reverb time 99 |

Controls the RT60 time of the reverb. Actually controls the size of the plate. The mapping betwwen plate size and RT60 time is just a heuristic, so it's not very accurate.

100 | 101 |
102 | 103 | 104 | Damping 105 |

Controls the degree that the surface of the plate is damped.

106 | 107 |
108 | 109 | 110 | Dry/wet mix 111 |

Controls the balance between the dry and wet signals.

112 | 113 |
114 | 115 | 116 | 117 | 118 | 119 | 120 | Input 121 | 122 | 123 | 124 | Left output 125 | 126 | 127 | 128 | Right output 129 | 130 | 131 | 132 | 133 |
134 |
135 | -------------------------------------------------------------------------------- /plugins/pointer_cast-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | #include "ladspa-util.h" 14 | #include "util/biquad.h" 15 | 16 | typedef union { 17 | LADSPA_Data fp; 18 | int in; 19 | } pcast; 20 | ]]> 21 | 22 | 23 | 24 | Pointer cast distortion 25 |

This distortion is created by treating the floating point repesentation 26 | of the input signal as a 0.32 1's complement fixedpoint integer. Its very 27 | unmusical but supprisingly recognisable. I'm not sure that its useful for 28 | anything, but it can make interesting noises.

29 | 30 | 34 | 35 | 38 | 39 | 57 | 58 | filt); 60 | ]]> 61 | 62 | 63 | Effect cutoff freq (Hz) 64 |

Controls the frequencies that will be passed to the effect.

65 | 66 |
67 | 68 | 69 | Dry/wet mix 70 |

Controls the ammount of distortion mixed into the output.

71 | 72 |
73 | 74 | 75 | Input 76 | 77 | 78 | 79 | Output 80 | 81 | 82 | 83 | 84 |
85 |
86 | -------------------------------------------------------------------------------- /plugins/rate_shifter-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Rate shifter 17 |

Stretches or compresses the input with a ringbuffer.

18 |

Because of the ringbuffer you will get stretches of silence or clicks when the read pointer passes the write pointer.

19 |

The ringbuffer is about 2.7-3.0s long, depending on the sample rate.

20 |

Versions with variable buffer sizes or declicking code would be easy (but a bit less efficient); shout if you would find them useful.

21 | 22 | 34 | 35 | 41 | 42 | buffer); 44 | ]]> 45 | 46 | read_ptr.all = read_ptr.all; 66 | plugin_data->write_ptr = write_ptr; 67 | ]]> 68 | 69 | 70 | Rate 71 |

The rate of the output signal; eg. 2.0 will double the speed. Negative numbers will play backwards.

72 |

Pretty much any value will work, but the ranges give what most people are going to want to use. You can get some interesting sounds with very high numbers (e.g. 2000).

73 | 74 |
75 | 76 | 77 | Input 78 | 79 | 80 | 81 | Output 82 | 83 | 84 | 85 | 86 | 87 | 88 |
89 |
90 | -------------------------------------------------------------------------------- /plugins/satan_maximiser-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | #include "ladspa-util.h" 13 | 14 | #define BUFFER_SIZE 16 15 | #define BUFFER_MASK 15 16 | ]]> 17 | 18 | 19 | 20 | Barry's Satan Maximiser 21 |

Formerly Stupid Compressor. Thanks to Matt Yee-King for the name.

22 |

Compresses signals with a stupidly short attack and decay, infinite 23 | ratio and hard knee. Not really as a compressor, but good harsh (non-musical) 24 | distortion.

25 | 26 | 31 | 32 | 37 | 38 | buffer); 40 | ]]> 41 | 42 | env) { 57 | env = fabs(input[pos]); 58 | } else { 59 | env = fabs(input[pos]) * env_tr + env * (1.0f - env_tr); 60 | } 61 | if (env <= knee) { 62 | env_sc = 1.0f / knee; 63 | } else { 64 | env_sc = 1.0f / env; 65 | } 66 | buffer[buffer_pos] = input[pos]; 67 | output[pos] = buffer[(buffer_pos - delay) & BUFFER_MASK] * env_sc; 68 | buffer_pos = (buffer_pos + 1) & BUFFER_MASK; 69 | } 70 | 71 | plugin_data->env = env; 72 | plugin_data->buffer_pos = buffer_pos; 73 | ]]> 74 | 75 | 76 | Decay time (samples) 77 |

Controls the envelope decay time.

78 | 79 |
80 | 81 | 82 | Knee point (dB) 83 |

Controls the knee roll-off point, ie. the point above which the compression kicks in. 0 will have no effect, -90 will remove virtually all dynamic range.

84 | 85 |
86 | 87 | 88 | Input 89 | 90 | 91 | 92 | Output 93 | 94 | 95 | 96 | 97 | 98 |
99 |
100 | -------------------------------------------------------------------------------- /plugins/shaper-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Wave shaper 13 |

This plugin reshapes the wave by an exponential function, inspiration was taken from the Nord module of the same name.

14 |

If you are getting rubbish out then it's probably because the host isn't using the input/output range hints, which are very important for this plugin.

15 | 16 | -1.0f) { 21 | shape = 1.0f; 22 | } else if (shape < 0) { 23 | shape = -1.0f / shape; 24 | } else { 25 | shape = shapep; 26 | } 27 | 28 | for (pos = 0; pos < sample_count; pos++) { 29 | if (input[pos] < 0.0f) { 30 | output[pos] = -pow(-input[pos], shape); 31 | } else { 32 | output[pos] = pow(input[pos], shape); 33 | } 34 | } 35 | ]]> 36 | 37 | 38 | Waveshape 39 |

Positive values have an expanding effect, and negative values have a compressing effect.

40 | 41 |
42 | 43 | 44 | Input 45 | 46 | 47 | 48 | 49 | Output 50 | 51 | 52 |
53 |
54 | -------------------------------------------------------------------------------- /plugins/simple_comb-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | #include "ladspa-util.h" 11 | #define COMB_SIZE 0x4000 12 | #define COMB_MASK 0x3FFF 13 | 14 | 15 | 16 | 17 | Comb Filter 18 | 19 | 20 | sample_rate = s_rate; 21 | comb_tbl = malloc(sizeof(LADSPA_Data) * COMB_SIZE); 22 | comb_pos = 0; 23 | last_offset = 1000; 24 | 25 | 26 | 27 | int i; 28 | 29 | for (i = 0; i < COMB_SIZE; i++) { 30 | comb_tbl[i] = 0; 31 | } 32 | comb_pos = 0; 33 | last_offset = 1000; 34 | 35 | 36 | 37 | free(plugin_data->comb_tbl); 38 | 39 | 40 | comb_pos = comb_pos; 63 | plugin_data->last_offset = offset; 64 | ]]> 65 | 66 | 67 | Band separation (Hz) 68 | 69 |

Controls the distance between the filters peaks.

70 |
71 | 72 | 73 | Feedback 74 | 75 |

Feedback level, increases the distinctive wooshy phaser sound.

76 |
77 | 78 | 79 | Input 80 | 81 | 82 | 83 | Output 84 | 85 | 86 | 87 | 88 | 89 | 90 |
91 |
92 | -------------------------------------------------------------------------------- /plugins/sin_cos-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Sine + cosine oscillator 17 |

This is a simple oscillator that outputs sinewaves with a 90 degree phase shift between them.

18 |

The current implementation is very inefficient, but I will improve it later.

19 | 20 | 25 | 26 | 2.0 * M_PI) { 39 | phi -= 2.0 * M_PI; 40 | } 41 | 42 | plugin_data->phi = phi; 43 | plugin_data->last_om = target_om; 44 | ]]> 45 | 46 | 47 | Base frequency (Hz) 48 |

The base frequency of the output waves.

49 | 50 |
51 | 52 | 53 | Pitch offset 54 |

The pitch offset of the output waves. Final oscillator frequency is $base + 2^pitch$.

55 | 56 |
57 | 58 | 59 | Sine output 60 | 61 | 62 | 63 | Cosine output 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 | -------------------------------------------------------------------------------- /plugins/single_para-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "util/biquad.h" 12 | 13 | 14 | 15 | 16 | Single band parametric 17 |

A single band of a parametric filter.

18 | 19 | 24 | 25 | 28 | 29 | filter); 31 | ]]> 32 | 33 | 42 | 43 | 44 | Gain (dB) 45 |

The attenuation/gain of the eq.

46 | 47 |
48 | 49 | 50 | Frequency (Hz) 51 |

The centre frequency (ie. point of most/least attenuation).

52 |

Beware of high values for Frequency and Bandwidth, if the high pitch (Frequency * 2$^{Bandwidth}$) goes over half the sample rate you will get aliasing.

53 |

Note: if your host offers you a frequency range between 0 and 0.4 then it's not rendering the input parameter correctly, the input frequency will actually be that number multiplied by the sample rate (e.g. 44.1kHz).

54 | 55 |
56 | 57 | 58 | Bandwidth (octaves) 59 |

The pitch difference from the centre before the attenuation has reached half the gain.

60 | 61 |
62 | 63 | 64 | Input 65 | 66 | 67 | 68 | 69 | Output 70 | 71 | 72 | 73 | 74 | 75 |
76 |
77 | -------------------------------------------------------------------------------- /plugins/sinus_wavewrapper-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Sinus wavewrapper 13 |

Produces an unusual distortion effect, for a more amp like tone, see the valve saturation plugin (section \ref{valve}).

14 | 15 | 27 | 28 | 29 | Wrap degree 30 | 31 | 32 | 33 | 34 | Input 35 | 36 | 37 | 38 | 39 | Output 40 | 41 | 42 |
43 |
44 | -------------------------------------------------------------------------------- /plugins/smooth_decimate-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Smooth Decimator 17 | 18 | 24 | 25 | 29 | 30 | = 1.0f) { 39 | accum -= 1.0f; 40 | buffer_pos = (buffer_pos + 1) & 7; 41 | buffer[buffer_pos] = input[pos]; 42 | } 43 | smoothed = cube_interp(accum, buffer[(buffer_pos - 3) & 7], 44 | buffer[(buffer_pos - 2) & 7], 45 | buffer[(buffer_pos - 1) & 7], 46 | buffer[buffer_pos]); 47 | buffer_write(output[pos], LIN_INTERP(smooth, buffer[(buffer_pos - 3) & 7], smoothed)); 48 | } 49 | 50 | plugin_data->accum = accum; 51 | plugin_data->buffer_pos = buffer_pos; 52 | ]]> 53 | 54 | buffer); 56 | ]]> 57 | 58 | 59 | Resample rate 60 |

The rate at which the output signal will be resampled

61 | 62 |
63 | 64 | 65 | Smoothing 66 |

The amount of smoothing on the output signal.

67 | 68 |
69 | 70 | 71 | Input 72 | 73 | 74 | 75 | Output 76 | 77 | 78 | 79 | 80 | 81 | 82 |
83 |
84 | -------------------------------------------------------------------------------- /plugins/split-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Mono to Stereo splitter 13 |

Takes a mono input signal, and outputs it to both left and right channel, thus "stereophizing" it.

14 | 15 | 16 | unsigned long pos; 17 | 18 | for (pos = 0; pos < sample_count; pos++) { 19 | const LADSPA_Data in = input[pos]; 20 | 21 | out1[pos] = in; 22 | out2[pos] = in; 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Input 32 | 33 | 34 | 35 | 36 | Output 1 37 | 38 | 39 | 40 | 41 | Output 2 42 | 43 | 44 |
45 |
46 | -------------------------------------------------------------------------------- /plugins/step_muxer-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | Step Demuxer 19 |

Inputs up to 8 signals and switches between them on the output when then signal on the clock input goes high.

20 |

This plugin is untested, and may not work.

21 | 22 | 29 | 30 | 43 | 44 | ch_state); 46 | free(plugin_data->ch_gain); 47 | ]]> 48 | 49 | = 1.0f) { 76 | ch_gain[ch] = 1.0f; 77 | ch_state[ch] = STABLE; 78 | } 79 | 80 | // Channel is still being faded out 81 | } else if (ch_state[ch] == FADE_OUT) { 82 | ch_gain[ch] -= fade_inc; 83 | if (ch_gain[ch] <= 0.0f) { 84 | ch_gain[ch] = 0.0f; 85 | ch_state[ch] = STABLE; 86 | } 87 | } 88 | } 89 | 90 | // Check for clock signal 91 | if (last_clock <= 0.0f && clock[pos] > 0.0f) { 92 | ch_state[current_ch] = FADE_OUT; 93 | current_ch = (current_ch + 1) % 8; 94 | ch_state[current_ch] = FADE_IN; 95 | } 96 | } 97 | 98 | // Save state data 99 | plugin_data->current_ch = current_ch; 100 | plugin_data->last_clock = last_clock; 101 | ]]> 102 | 103 | 104 | Crossfade time (in ms) 105 | 106 | 107 | 108 | 109 | Clock 110 | 111 | 112 | 113 | Input 1 114 | 115 | 116 | 117 | Input 2 118 | 119 | 120 | 121 | Input 3 122 | 123 | 124 | 125 | Input 4 126 | 127 | 128 | 129 | Input 5 130 | 131 | 132 | 133 | Input 6 134 | 135 | 136 | 137 | Input 7 138 | 139 | 140 | 141 | Input 8 142 | 143 | 144 | 145 | Output 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 |
155 |
156 | -------------------------------------------------------------------------------- /plugins/svf-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | f = 2.0f * sin(M_PI * fc / (float)(fs * F_R)); 41 | sv->q = 2.0f * cos(pow(q, 0.1f) * M_PI * 0.5f); 42 | sv->qnrm = sqrt(sv->q/2.0+0.01); 43 | switch(t) { 44 | case F_LP: 45 | sv->op = &(sv->l); 46 | break; 47 | case F_HP: 48 | sv->op = &(sv->h); 49 | break; 50 | case F_BP: 51 | sv->op = &(sv->b); 52 | break; 53 | case F_BR: 54 | sv->op = &(sv->n); 55 | break; 56 | default: 57 | sv->op = &(sv->p); 58 | } 59 | } 60 | 61 | /* Run one sample through the SV filter. Filter is by andy@vellocet */ 62 | 63 | static inline float run_svf(sv_filter *sv, float in) { 64 | float out; 65 | int i; 66 | 67 | in = sv->qnrm * in ; 68 | for (i=0; i < F_R; i++) { 69 | // only needed for pentium chips 70 | in = flush_to_zero(in); 71 | sv->l = flush_to_zero(sv->l); 72 | // very slight waveshape for extra stability 73 | sv->b = sv->b - sv->b * sv->b * sv->b * 0.001f; 74 | 75 | // regular state variable code here 76 | // the notch and peaking outputs are optional 77 | sv->h = in - sv->l - sv->q * sv->b; 78 | sv->b = sv->b + sv->f * sv->h; 79 | sv->l = sv->l + sv->f * sv->b; 80 | sv->n = sv->l + sv->h; 81 | sv->p = sv->l - sv->h; 82 | 83 | out = *(sv->op); 84 | in = out; 85 | } 86 | 87 | return out; 88 | } 89 | 90 | ]]> 91 | 92 | 93 | 94 | State Variable Filter 95 |

An oversampled state variable filter with a few tweaks

96 |

Quite a nice State Variable Filter, tends to be unstable with high resonance and Q values, but good when kept under control.

97 | 98 | sample_rate = s_rate; 99 | 100 | svf = calloc(1, sizeof(sv_filter)); 101 | 102 | 103 | 104 | setup_svf(svf, 0, 0, 0, 0); 105 | 106 | 107 | 108 | free(plugin_data->svf); 109 | 110 | 111 | b * filt_res))); 118 | } 119 | ]]> 120 | 121 | 122 | Input 123 | 124 | 125 | 126 | 127 | Output 128 | 129 | 130 | 131 | 132 | Filter type (0=none, 1=LP, 2=HP, 3=BP, 4=BR, 5=AP) 133 | 134 |

Select between no filtering, low-pass, high-pass, band-pass, band-reject and all-pass.

135 |
136 | 137 | 138 | Filter freq 139 | 140 |

Cutoff frequency, beware of high values with low sample rates.

141 |
142 | 143 | 144 | Filter Q 145 | 146 |

The filters Q, or cutoff slope.

147 |
148 | 149 | 150 | Filter resonance 151 | 152 |

The filter's resonance, sort of separate from Q but very related (implemented with feedback).

153 |

Do not use with the bandpass mode.

154 |
155 | 156 | 157 | 158 |
159 |
160 | -------------------------------------------------------------------------------- /plugins/transient-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 18 | 19 | 20 | Transient mangler 21 | 22 | 23 | buffer = calloc(BUFFER_SIZE, sizeof(float)); 24 | fast_buffer_sum = 0.1; 25 | medi_buffer_sum = 0.1; 26 | slow_buffer_sum = 0.1; 27 | buffer_pos = 0; 28 | fast_track = 0.0; 29 | medi_track = 0.0; 30 | slow_track = 0.0; 31 | count = 0; 32 | sample_rate = s_rate; 33 | 34 | 35 | 36 | memset(buffer, 0, BUFFER_SIZE * sizeof(float)); 37 | fast_buffer_sum = 0.1; 38 | medi_buffer_sum = 0.1; 39 | slow_buffer_sum = 0.1; 40 | buffer_pos = 0; 41 | fast_track = 0.1; 42 | medi_track = 0.1; 43 | slow_track = 0.1; 44 | count = 0; 45 | sample_rate = sample_rate; 46 | 47 | 48 | buffer); 50 | ]]> 51 | 52 | slow_sum_size) { 73 | fast_track += (fast_buffer_sum/fast_sum_size - fast_track) 74 | * fast_track_lag; 75 | medi_track += (medi_buffer_sum/medi_sum_size - medi_track) 76 | * medi_track_lag; 77 | slow_track += (slow_buffer_sum/slow_sum_size - slow_track) 78 | * slow_track_lag; 79 | } 80 | 81 | // Attack 82 | ratio = (fast_track + ASTAB) / (medi_track + ASTAB); 83 | if (ratio * attack > 1.0f) { 84 | in *= ratio * attack; 85 | } else if (ratio * attack < -1.0f) { 86 | in /= ratio * -attack; 87 | } 88 | 89 | // Sustain 90 | ratio = (slow_track + SSTAB) / (medi_track + SSTAB); 91 | if (ratio * sustain > 1.0f) { 92 | in *= ratio * sustain; 93 | } else if (ratio * sustain < -1.0f) { 94 | in /= ratio * -sustain; 95 | } 96 | 97 | buffer_write(output[pos], in); 98 | buffer_pos = (buffer_pos + 1) % BUFFER_SIZE; 99 | } 100 | 101 | plugin_data->count = count; 102 | plugin_data->fast_track = fast_track; 103 | plugin_data->medi_track = medi_track; 104 | plugin_data->slow_track = slow_track; 105 | plugin_data->buffer_pos = buffer_pos; 106 | plugin_data->fast_buffer_sum = fast_buffer_sum; 107 | plugin_data->medi_buffer_sum = medi_buffer_sum; 108 | plugin_data->slow_buffer_sum = slow_buffer_sum; 109 | ]]> 110 | 111 | 112 | Attack speed 113 | 114 | 115 | 116 | 117 | Sustain time 118 | 119 | 120 | 121 | 122 | Input 123 | 124 | 125 | 126 | 127 | Output 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /plugins/u_law-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | μ-Law Compressor 17 |

Transforms the input signal according to the 18 | μ-law 19 | compression function, which increases the average 20 | dynamic range of the signal while preserving the 21 | peaks.

22 |

A μ-law compander pair is part of telephone 23 | transmission in the United State and Japan; elsewhere 24 | A-law companding is used.

25 | = 0) 33 | s = uloginv * log(1.0 + 255.0 * sabs); 34 | else 35 | s = -uloginv * log(1.0 + 255.0 * sabs); 36 | buffer_write(output[pos], s); 37 | } 38 | ]]> 39 | 40 | 41 | Input 42 | 43 | 44 | 45 | Output 46 | 47 |
48 |
49 | -------------------------------------------------------------------------------- /plugins/valve-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | Valve saturation 17 |

A model of valve (tube) distortion, lacking some of the harmonics you would get in a real tube amp, but sounds good nonetheless.

18 |

Taken from Ragnar Bendiksen's thesis: \url{http://www.notam02.no/~rbendiks/Diplom/Innhold.html}.

19 | 20 | 24 | 25 | itm1 = itm1; 61 | plugin_data->otm1 = otm1; 62 | ]]> 63 | 64 | 65 | Distortion level 66 |

How hard the signal is driven against the limit of the amplifier.

67 | 68 |
69 | 70 | 71 | Distortion character 72 |

The hardness of the sound, low for soft, high for hard.

73 | 74 |
75 | 76 | 77 | Input 78 | 79 | 80 | 81 | Output 82 | 83 | 84 | 85 | 86 | 87 |
88 |
89 | -------------------------------------------------------------------------------- /plugins/valve_rect-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | Valve rectifier 17 | 18 | 34 | 35 | 42 | 43 | avg); 45 | ]]> 46 | 47 | lp1tm1) { 55 | lp1tm1 = x; 56 | } else { 57 | lp1tm1 = 0.9999f * lp1tm1 + 0.0001f * x; 58 | } 59 | 60 | avgs -= avg[apos]; 61 | avgs += lp1tm1; 62 | avg[apos++] = lp1tm1; 63 | apos %= avg_size; 64 | 65 | lp2tm1 = 0.999f * lp2tm1 + avgs*avg_sizer * 0.001f; 66 | q = lp1tm1 * sag - lp2tm1 * 1.02f - 1.0f; 67 | if (q > -0.01f) { 68 | q = -0.01f; 69 | } else if (q < -1.0f) { 70 | q = -1.0f; 71 | } 72 | 73 | if (input[pos] == q) { 74 | fx = 1.0f / dist + q / (1.0f - f_exp(dist * q)); 75 | } else { 76 | fx = (input[pos] - q) / 77 | (1.0f - f_exp(-dist * (input[pos] - q))) + 78 | q / (1.0f - f_exp(dist * q)); 79 | } 80 | 81 | buffer_write(output[pos], fx); 82 | } 83 | 84 | plugin_data->lp1tm1 = lp1tm1; 85 | plugin_data->lp2tm1 = lp2tm1; 86 | plugin_data->avgs = avgs; 87 | plugin_data->apos = apos; 88 | ]]> 89 | 90 | 91 | Sag level 92 |

The level of power supply sag that will be caused by attacks.

93 | 94 |
95 | 96 | 97 | Distortion 98 |

How harsh the distortion caused by the sag will be.

99 | 100 |
101 | 102 | 103 | Input 104 | 105 | 106 | 107 | Output 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 |
118 |
119 | -------------------------------------------------------------------------------- /plugins/wave_terrain-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Wave Terrain Oscillator 14 |

A Wave Terrain oscillator, taken from Curtis Roads' example in {\em The Computer Music Tutorial}.

15 |

Inputs x and y move the cursor around on a 2D landscape "wavetable" that is used to generate the output. The function used is z = (x - y) * (x - 1) * (x + 1) * (y - 1) * (y + 1).

16 | 17 | 27 | 28 | 29 | x 30 | 31 | 32 | 33 | y 34 | 35 | 36 | 37 | z 38 | 39 |
40 |
41 | -------------------------------------------------------------------------------- /plugins/xfade-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | #include "ladspa-util.h" 12 | 13 | 14 | 15 | 16 | Crossfade 17 | 18 | 28 | 29 | 30 | Crossfade 31 |

Controls the degree to which the inputs are mixed into the output. A 32 | value of -1 means that the output is just the A input, and a value of 1.0 33 | means that it is just the B input.

34 | 35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | Input A left 43 | 44 | 45 | Input A right 46 | 47 | 48 | 49 | Input B left 50 | 51 | 52 | Input B right 53 | 54 | 55 | 56 | 57 | 58 | Output left 59 | 60 | 61 | Output right 62 | 63 |
64 | 65 | 66 | Crossfade (4 outs) 67 | 68 | 80 | 81 | 82 | Crossfade 83 |

Controls the degree to which the inputs are mixed into the output. A 84 | value of -1 means that the output is just the A input, and a value of 1.0 85 | means that it is just the B input.

86 | 87 |
88 | 89 | 90 | Input A left 91 | 92 | 93 | Input A right 94 | 95 | 96 | 97 | Input B left 98 | 99 | 100 | Input B right 101 | 102 | 103 | 104 | Output A left 105 | 106 | 107 | Output A right 108 | 109 | 110 | 111 | Output B left 112 | 113 | 114 | Output B right 115 | 116 |
117 |
118 | -------------------------------------------------------------------------------- /plugins/zm1-swh.lv2/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | z-1 14 |

A plugin that implements the $z^{-1}$ function (a single sample delay).

15 | 16 | 19 | 20 | 23 | 24 | xm1 = xm1; 34 | ]]> 35 | 36 | 37 | Input 38 | 39 | 40 | 41 | Output 42 | 43 | 44 | 45 |
46 |
47 | -------------------------------------------------------------------------------- /util/biquad.h: -------------------------------------------------------------------------------- 1 | #ifndef BIQUAD_H 2 | #define BIQUAD_H 3 | 4 | #define LN_2_2 0.34657359f // ln(2)/2 5 | 6 | #include "ladspa-util.h" 7 | 8 | #ifndef LIMIT 9 | #define LIMIT(v,l,u) (vu?u:v)) 10 | #endif 11 | 12 | #ifndef BIQUAD_TYPE 13 | #define BIQUAD_TYPE float 14 | #endif 15 | 16 | typedef BIQUAD_TYPE bq_t; 17 | 18 | /* Biquad filter (adapted from lisp code by Eli Brandt, 19 | http://www.cs.cmu.edu/~eli/) */ 20 | 21 | typedef struct { 22 | bq_t a1; 23 | bq_t a2; 24 | bq_t b0; 25 | bq_t b1; 26 | bq_t b2; 27 | bq_t x1; 28 | bq_t x2; 29 | bq_t y1; 30 | bq_t y2; 31 | } biquad; 32 | 33 | static inline void biquad_init(biquad *f) { 34 | f->x1 = 0.0f; 35 | f->x2 = 0.0f; 36 | f->y1 = 0.0f; 37 | f->y2 = 0.0f; 38 | } 39 | 40 | static inline void eq_set_params(biquad *f, bq_t fc, bq_t gain, bq_t bw, 41 | bq_t fs); 42 | static inline void eq_set_params(biquad *f, bq_t fc, bq_t gain, bq_t bw, 43 | bq_t fs) 44 | { 45 | bq_t w = 2.0f * M_PI * LIMIT(fc, 1.0f, fs/2.0f) / fs; 46 | bq_t cw = cosf(w); 47 | bq_t sw = sinf(w); 48 | bq_t J = pow(10.0f, gain * 0.025f); 49 | bq_t g = sw * sinhf(LN_2_2 * LIMIT(bw, 0.0001f, 4.0f) * w / sw); 50 | bq_t a0r = 1.0f / (1.0f + (g / J)); 51 | 52 | f->b0 = (1.0f + (g * J)) * a0r; 53 | f->b1 = (-2.0f * cw) * a0r; 54 | f->b2 = (1.0f - (g * J)) * a0r; 55 | f->a1 = -(f->b1); 56 | f->a2 = ((g / J) - 1.0f) * a0r; 57 | } 58 | 59 | static inline void ls_set_params(biquad *f, bq_t fc, bq_t gain, bq_t slope, 60 | bq_t fs); 61 | static inline void ls_set_params(biquad *f, bq_t fc, bq_t gain, bq_t slope, 62 | bq_t fs) 63 | { 64 | bq_t w = 2.0f * M_PI * LIMIT(fc, 1.0, fs/2.0) / fs; 65 | bq_t cw = cosf(w); 66 | bq_t sw = sinf(w); 67 | bq_t A = powf(10.0f, gain * 0.025f); 68 | bq_t b = sqrt(((1.0f + A * A) / LIMIT(slope, 0.0001f, 1.0f)) - ((A - 69 | 1.0f) * (A - 1.0))); 70 | bq_t apc = cw * (A + 1.0f); 71 | bq_t amc = cw * (A - 1.0f); 72 | bq_t bs = b * sw; 73 | bq_t a0r = 1.0f / (A + 1.0f + amc + bs); 74 | 75 | f->b0 = a0r * A * (A + 1.0f - amc + bs); 76 | f->b1 = a0r * 2.0f * A * (A - 1.0f - apc); 77 | f->b2 = a0r * A * (A + 1.0f - amc - bs); 78 | f->a1 = a0r * 2.0f * (A - 1.0f + apc); 79 | f->a2 = a0r * (-A - 1.0f - amc + bs); 80 | } 81 | 82 | static inline void hs_set_params(biquad *f, bq_t fc, bq_t gain, bq_t slope, 83 | bq_t fs); 84 | static inline void hs_set_params(biquad *f, bq_t fc, bq_t gain, bq_t slope, 85 | bq_t fs) 86 | { 87 | bq_t w = 2.0f * M_PI * LIMIT(fc, 1.0, fs/2.0) / fs; 88 | bq_t cw = cosf(w); 89 | bq_t sw = sinf(w); 90 | bq_t A = powf(10.0f, gain * 0.025f); 91 | bq_t b = sqrt(((1.0f + A * A) / LIMIT(slope, 0.0001f, 1.0f)) - ((A - 92 | 1.0f) * (A - 1.0f))); 93 | bq_t apc = cw * (A + 1.0f); 94 | bq_t amc = cw * (A - 1.0f); 95 | bq_t bs = b * sw; 96 | bq_t a0r = 1.0f / (A + 1.0f - amc + bs); 97 | 98 | f->b0 = a0r * A * (A + 1.0f + amc + bs); 99 | f->b1 = a0r * -2.0f * A * (A - 1.0f + apc); 100 | f->b2 = a0r * A * (A + 1.0f + amc - bs); 101 | f->a1 = a0r * -2.0f * (A - 1.0f - apc); 102 | f->a2 = a0r * (-A - 1.0f + amc + bs); 103 | } 104 | 105 | static inline void lp_set_params(biquad *f, bq_t fc, bq_t bw, bq_t fs) 106 | { 107 | bq_t omega = 2.0 * M_PI * fc/fs; 108 | bq_t sn = sin(omega); 109 | bq_t cs = cos(omega); 110 | bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn); 111 | 112 | const float a0r = 1.0 / (1.0 + alpha); 113 | f->b0 = a0r * (1.0 - cs) * 0.5; 114 | f->b1 = a0r * (1.0 - cs); 115 | f->b2 = a0r * (1.0 - cs) * 0.5; 116 | f->a1 = a0r * (2.0 * cs); 117 | f->a2 = a0r * (alpha - 1.0); 118 | } 119 | 120 | static inline void hp_set_params(biquad *f, bq_t fc, bq_t bw, bq_t fs) 121 | { 122 | bq_t omega = 2.0 * M_PI * fc/fs; 123 | bq_t sn = sin(omega); 124 | bq_t cs = cos(omega); 125 | bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn); 126 | 127 | const float a0r = 1.0 / (1.0 + alpha); 128 | f->b0 = a0r * (1.0 + cs) * 0.5; 129 | f->b1 = a0r * -(1.0 + cs); 130 | f->b2 = a0r * (1.0 + cs) * 0.5; 131 | f->a1 = a0r * (2.0 * cs); 132 | f->a2 = a0r * (alpha - 1.0); 133 | } 134 | 135 | static inline void bp_set_params(biquad *f, bq_t fc, bq_t bw, bq_t fs) 136 | { 137 | bq_t omega = 2.0 * M_PI * fc/fs; 138 | bq_t sn = sin(omega); 139 | bq_t cs = cos(omega); 140 | bq_t alpha = sn * sinh(M_LN2 / 2.0 * bw * omega / sn); 141 | 142 | const float a0r = 1.0 / (1.0 + alpha); 143 | f->b0 = a0r * alpha; 144 | f->b1 = 0.0; 145 | f->b2 = a0r * -alpha; 146 | f->a1 = a0r * (2.0 * cs); 147 | f->a2 = a0r * (alpha - 1.0); 148 | } 149 | 150 | static inline bq_t biquad_run(biquad *f, const bq_t x) { 151 | bq_t y; 152 | 153 | y = f->b0 * x + f->b1 * f->x1 + f->b2 * f->x2 154 | + f->a1 * f->y1 + f->a2 * f->y2; 155 | y = flush_to_zero(y); 156 | f->x2 = f->x1; 157 | f->x1 = x; 158 | f->y2 = f->y1; 159 | f->y1 = y; 160 | 161 | return y; 162 | } 163 | 164 | static inline bq_t biquad_run_fb(biquad *f, bq_t x, const bq_t fb) { 165 | bq_t y; 166 | 167 | x += f->y1 * fb * 0.98; 168 | y = f->b0 * x + f->b1 * f->x1 + f->b2 * f->x2 169 | + f->a1 * f->y1 + f->a2 * f->y2; 170 | y = flush_to_zero(y); 171 | f->x2 = f->x1; 172 | f->x1 = x; 173 | f->y2 = f->y1; 174 | f->y1 = y; 175 | 176 | return y; 177 | } 178 | 179 | #endif 180 | -------------------------------------------------------------------------------- /util/buffer.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swh/lv2/8b6d075a36f968d2e3011c6fcd9246b5b8103924/util/buffer.c -------------------------------------------------------------------------------- /util/buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef _BUFFER_H 2 | #define _BUFFER_H 3 | 4 | /* substract buffer b from a, save in c 5 | * 6 | * this could be sped up by vector operations 7 | */ 8 | 9 | static inline void buffer_sub(const float* a, const float *b, float *c, int cnt) { 10 | int i; 11 | float *h; 12 | h = c; 13 | for(i=0;i 2 | #include 3 | 4 | #include "db.h" 5 | 6 | float db_data[DB_TABLE_SIZE]; 7 | float lin_data[LIN_TABLE_SIZE]; 8 | 9 | void db_init() 10 | { 11 | unsigned int i; 12 | 13 | for (i=0; i LIN_TABLE_SIZE - 3) { 39 | return lin_data[LIN_TABLE_SIZE - 2]; 40 | } 41 | return cube_interp(ofs, lin_data[base-1], lin_data[base], lin_data[base+1], lin_data[base+2]); 42 | } 43 | 44 | static inline float f_db2lin_lerp(float db) 45 | { 46 | float scale = (db - DB_MIN) * (float)LIN_TABLE_SIZE / (DB_MAX - DB_MIN); 47 | int base = f_round(scale - 0.5f); 48 | float ofs = scale - base; 49 | 50 | if (base < 1) { 51 | return 0.0f; 52 | } else if (base > LIN_TABLE_SIZE - 3) { 53 | return lin_data[LIN_TABLE_SIZE - 2]; 54 | } 55 | return (1.0f - ofs) * lin_data[base] + ofs * lin_data[base+1]; 56 | } 57 | 58 | static inline float f_lin2db_cube(float lin) 59 | { 60 | float scale = (lin - LIN_MIN) * (float)DB_TABLE_SIZE / (LIN_MAX - LIN_MIN); 61 | int base = f_round(scale - 0.5f); 62 | float ofs = scale - base; 63 | 64 | if (base < 2) { 65 | return db_data[2] * scale * 0.5f - 23 * (2.0f - scale); 66 | } else if (base > DB_TABLE_SIZE - 3) { 67 | return db_data[DB_TABLE_SIZE - 2]; 68 | } 69 | return cube_interp(ofs, db_data[base-1], db_data[base], db_data[base+1], db_data[base+2]); 70 | } 71 | 72 | static inline float f_lin2db_lerp(float lin) 73 | { 74 | float scale = (lin - LIN_MIN) * (float)DB_TABLE_SIZE / (LIN_MAX - LIN_MIN); 75 | int base = f_round(scale - 0.5f); 76 | float ofs = scale - base; 77 | 78 | if (base < 2) { 79 | return db_data[2] * scale * 0.5f - 23.0f * (2.0f - scale); 80 | } else if (base > DB_TABLE_SIZE - 2) { 81 | return db_data[DB_TABLE_SIZE - 1]; 82 | } 83 | return (1.0f - ofs) * db_data[base] + ofs * db_data[base+1]; 84 | } 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /util/gsm/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, 2 | Technische Universitaet Berlin 3 | 4 | Any use of this software is permitted provided that this notice is not 5 | removed and that neither the authors nor the Technische Universitaet Berlin 6 | are deemed to have made any representations as to the suitability of this 7 | software for any purpose nor are held responsible for any defects of 8 | this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | 10 | As a matter of courtesy, the authors request to be informed about uses 11 | this software has found, about bugs in this software, and about any 12 | improvements that may be of general interest. 13 | 14 | Berlin, 28.11.1994 15 | Jutta Degener 16 | Carsten Bormann 17 | -------------------------------------------------------------------------------- /util/gsm/Makefile.am: -------------------------------------------------------------------------------- 1 | LIBTOOL=libtool 2 | RANLIB=ranlib 3 | 4 | noinst_HEADERS = gsm.h config.h private.h proto.h unproto.h 5 | noinst_LIBRARIES = libgsm.a 6 | 7 | CFILES = add.c decode.c gsm_decode.c gsm_encode.c long_term.c preprocess.c \ 8 | short_term.c code.c gsm_create.c gsm_destroy.c gsm_option.c lpc.c rpe.c table.c 9 | 10 | libgsm_a_SOURCES = $(CFILES) $(noinst_HEADERS) 11 | 12 | # Disable autoheader. 13 | AUTOHEADER=echo 14 | 15 | -------------------------------------------------------------------------------- /util/gsm/README: -------------------------------------------------------------------------------- 1 | GSM 06.10 13 kbit/s RPE/LTP speech codec 2 | ---------------------------------------- 3 | 4 | All the file in this directory were written by Jutta Degener 5 | and Carsten Borman for The Communications and Operating Systems 6 | Research Group (KBS) at the Technische Universitaet Berlin. 7 | 8 | Their work was released under the following license which is 9 | assumed to be compatible with The GNU Lesser General Public License. 10 | 11 | ---------------------------------------------------------------------------- 12 | 13 | Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, 14 | Technische Universitaet Berlin 15 | 16 | Any use of this software is permitted provided that this notice is not 17 | removed and that neither the authors nor the Technische Universitaet Berlin 18 | are deemed to have made any representations as to the suitability of this 19 | software for any purpose nor are held responsible for any defects of 20 | this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 21 | 22 | As a matter of courtesy, the authors request to be informed about uses 23 | this software has found, about bugs in this software, and about any 24 | improvements that may be of general interest. 25 | 26 | Berlin, 28.11.1994 27 | Jutta Degener (jutta@cs.tu-berlin.de) 28 | Carsten Bormann (cabo@cs.tu-berlin.de) 29 | 30 | ---------------------------------------------------------------------------- 31 | 32 | Jutta Degener and Carsten Bormann's work can be found on their homepage 33 | at: 34 | 35 | http://kbs.cs.tu-berlin.de/~jutta/toast.html 36 | 37 | -------------------------------------------------------------------------------- /util/gsm/code.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /* $Header: /home/cvs/giga/ladspa-swh/gsm/code.c,v 1.2 2003/03/07 23:26:13 swh Exp $ */ 8 | 9 | #include "config.h" 10 | #include 11 | 12 | 13 | #ifdef HAS_STDLIB_H 14 | #include 15 | #else 16 | # include "proto.h" 17 | extern char * memcpy P((char *, char *, int)); 18 | #endif 19 | 20 | #include "private.h" 21 | #include "gsm.h" 22 | #include "proto.h" 23 | 24 | /* 25 | * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER 26 | */ 27 | 28 | void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc), 29 | 30 | struct gsm_state * S, 31 | 32 | word * s, /* [0..159] samples IN */ 33 | 34 | /* 35 | * The RPE-LTD coder works on a frame by frame basis. The length of 36 | * the frame is equal to 160 samples. Some computations are done 37 | * once per frame to produce at the output of the coder the 38 | * LARc[1..8] parameters which are the coded LAR coefficients and 39 | * also to realize the inverse filtering operation for the entire 40 | * frame (160 samples of signal d[0..159]). These parts produce at 41 | * the output of the coder: 42 | */ 43 | 44 | word * LARc, /* [0..7] LAR coefficients OUT */ 45 | 46 | /* 47 | * Procedure 4.2.11 to 4.2.18 are to be executed four times per 48 | * frame. That means once for each sub-segment RPE-LTP analysis of 49 | * 40 samples. These parts produce at the output of the coder: 50 | */ 51 | 52 | word * Nc, /* [0..3] LTP lag OUT */ 53 | word * bc, /* [0..3] coded LTP gain OUT */ 54 | word * Mc, /* [0..3] RPE grid selection OUT */ 55 | word * xmaxc,/* [0..3] Coded maximum amplitude OUT */ 56 | word * xMc /* [13*4] normalized RPE samples OUT */ 57 | ) 58 | { 59 | int k; 60 | word * dp = S->dp0 + 120; /* [ -120...-1 ] */ 61 | word * dpp = dp; /* [ 0...39 ] */ 62 | 63 | static word e[50]; 64 | 65 | word so[160]; 66 | 67 | Gsm_Preprocess (S, s, so); 68 | Gsm_LPC_Analysis (S, so, LARc); 69 | Gsm_Short_Term_Analysis_Filter (S, LARc, so); 70 | 71 | for (k = 0; k <= 3; k++, xMc += 13) { 72 | 73 | Gsm_Long_Term_Predictor ( S, 74 | so+k*40, /* d [0..39] IN */ 75 | dp, /* dp [-120..-1] IN */ 76 | e + 5, /* e [0..39] OUT */ 77 | dpp, /* dpp [0..39] OUT */ 78 | Nc++, 79 | bc++); 80 | 81 | Gsm_RPE_Encoding ( S, 82 | e + 5, /* e ][0..39][ IN/OUT */ 83 | xmaxc++, Mc++, xMc ); 84 | /* 85 | * Gsm_Update_of_reconstructed_short_time_residual_signal 86 | * ( dpp, e + 5, dp ); 87 | */ 88 | 89 | { register int i; 90 | register longword ltmp; 91 | for (i = 0; i <= 39; i++) 92 | dp[ i ] = GSM_ADD( e[5 + i], dpp[i] ); 93 | } 94 | dp += 40; 95 | dpp += 40; 96 | 97 | } 98 | (void)memcpy( (char *)S->dp0, (char *)(S->dp0 + 160), 99 | 120 * sizeof(*S->dp0) ); 100 | } 101 | -------------------------------------------------------------------------------- /util/gsm/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /*$Header: /home/cvs/giga/ladspa-swh/gsm/config.h,v 1.1 2001/06/10 21:36:51 swh Exp $*/ 8 | 9 | #ifndef CONFIG_H 10 | #define CONFIG_H 11 | 12 | //*efine SIGHANDLER_T int /* signal handlers are void */ 13 | //*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */ 14 | 15 | #define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ 16 | //*efine HAS_LIMITS_H 1 /* /usr/include/limits.h */ 17 | #define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */ 18 | //*efine HAS_ERRNO_DECL 1 /* errno.h declares errno */ 19 | 20 | #define HAS_FSTAT 1 /* fstat syscall */ 21 | #define HAS_FCHMOD 1 /* fchmod syscall */ 22 | #define HAS_CHMOD 1 /* chmod syscall */ 23 | #define HAS_FCHOWN 1 /* fchown syscall */ 24 | #define HAS_CHOWN 1 /* chown syscall */ 25 | //*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */ 26 | 27 | #define HAS_STRING_H 1 /* /usr/include/string.h */ 28 | //*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */ 29 | 30 | #define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ 31 | #define HAS_UTIME 1 /* POSIX utime(path, times) */ 32 | //*efine HAS_UTIMES 1 /* use utimes() syscall instead */ 33 | #define HAS_UTIME_H 1 /* UTIME header file */ 34 | //*efine HAS_UTIMBUF 1 /* struct utimbuf */ 35 | //*efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */ 36 | 37 | #endif /* CONFIG_H */ 38 | -------------------------------------------------------------------------------- /util/gsm/decode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /* $Header: /home/cvs/giga/ladspa-swh/gsm/decode.c,v 1.1 2001/06/10 21:36:51 swh Exp $ */ 8 | 9 | #include 10 | 11 | #include "private.h" 12 | #include "gsm.h" 13 | #include "proto.h" 14 | 15 | /* 16 | * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER 17 | */ 18 | 19 | static void Postprocessing P2((S,s), 20 | struct gsm_state * S, 21 | register word * s) 22 | { 23 | register int k; 24 | register word msr = S->msr; 25 | register longword ltmp; /* for GSM_ADD */ 26 | register word tmp; 27 | 28 | for (k = 160; k--; s++) { 29 | tmp = GSM_MULT_R( msr, 28180 ); 30 | msr = GSM_ADD(*s, tmp); /* Deemphasis */ 31 | *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */ 32 | } 33 | S->msr = msr; 34 | } 35 | 36 | void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s), 37 | struct gsm_state * S, 38 | 39 | word * LARcr, /* [0..7] IN */ 40 | 41 | word * Ncr, /* [0..3] IN */ 42 | word * bcr, /* [0..3] IN */ 43 | word * Mcr, /* [0..3] IN */ 44 | word * xmaxcr, /* [0..3] IN */ 45 | word * xMcr, /* [0..13*4] IN */ 46 | 47 | word * s) /* [0..159] OUT */ 48 | { 49 | int j, k; 50 | word erp[40], wt[160]; 51 | word * drp = S->dp0 + 120; 52 | 53 | for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { 54 | 55 | Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp ); 56 | Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); 57 | 58 | for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; 59 | } 60 | 61 | Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s ); 62 | Postprocessing(S, s); 63 | } 64 | -------------------------------------------------------------------------------- /util/gsm/gsm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /*$Header: /home/cvs/giga/ladspa-swh/gsm/gsm.h,v 1.1 2001/06/10 21:36:51 swh Exp $*/ 8 | 9 | #ifndef GSM_H 10 | #define GSM_H 11 | 12 | #ifdef __cplusplus 13 | # define NeedFunctionPrototypes 1 14 | #endif 15 | 16 | #if __STDC__ 17 | # define NeedFunctionPrototypes 1 18 | #endif 19 | 20 | #ifdef _NO_PROTO 21 | # undef NeedFunctionPrototypes 22 | #endif 23 | 24 | #ifdef NeedFunctionPrototypes 25 | # include /* for FILE * */ 26 | #endif 27 | 28 | #undef GSM_P 29 | #if NeedFunctionPrototypes 30 | # define GSM_P( protos ) protos 31 | #else 32 | # define GSM_P( protos ) ( /* protos */ ) 33 | #endif 34 | 35 | /* 36 | * Interface 37 | */ 38 | 39 | typedef struct gsm_state * gsm; 40 | typedef short gsm_signal; /* signed 16 bit */ 41 | typedef unsigned char gsm_byte; 42 | typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ 43 | 44 | #define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */ 45 | 46 | #define GSM_PATCHLEVEL 10 47 | #define GSM_MINOR 0 48 | #define GSM_MAJOR 1 49 | 50 | #define GSM_OPT_VERBOSE 1 51 | #define GSM_OPT_FAST 2 52 | #define GSM_OPT_LTP_CUT 3 53 | #define GSM_OPT_WAV49 4 54 | #define GSM_OPT_FRAME_INDEX 5 55 | #define GSM_OPT_FRAME_CHAIN 6 56 | 57 | extern gsm gsm_create GSM_P((void)); 58 | extern void gsm_destroy GSM_P((gsm)); 59 | 60 | extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *)); 61 | extern int gsm_option GSM_P((gsm, int, int *)); 62 | 63 | extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *)); 64 | extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *)); 65 | 66 | extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *)); 67 | extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *)); 68 | 69 | #undef GSM_P 70 | 71 | #endif /* GSM_H */ 72 | -------------------------------------------------------------------------------- /util/gsm/gsm_create.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | static char const ident[] = "$Header: /home/cvs/giga/ladspa-swh/gsm/gsm_create.c,v 1.1 2001/06/10 21:36:51 swh Exp $"; 8 | 9 | #include "config.h" 10 | 11 | #ifdef HAS_STRING_H 12 | #include 13 | #else 14 | # include "proto.h" 15 | extern char * memset P((char *, int, int)); 16 | #endif 17 | 18 | #ifdef HAS_STDLIB_H 19 | # include 20 | #else 21 | # ifdef HAS_MALLOC_H 22 | # include 23 | # else 24 | extern char * malloc(); 25 | # endif 26 | #endif 27 | 28 | #include 29 | 30 | #include "gsm.h" 31 | #include "private.h" 32 | #include "proto.h" 33 | 34 | gsm gsm_create P0() 35 | { 36 | gsm r; 37 | 38 | r = (gsm)malloc(sizeof(struct gsm_state)); 39 | if (!r) return r; 40 | 41 | memset((char *)r, 0, sizeof(*r)); 42 | r->nrp = 40; 43 | 44 | return r; 45 | } 46 | -------------------------------------------------------------------------------- /util/gsm/gsm_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /* $Header: /home/cvs/giga/ladspa-swh/gsm/gsm_destroy.c,v 1.1 2001/06/10 21:36:51 swh Exp $ */ 8 | 9 | #include "gsm.h" 10 | #include "config.h" 11 | #include "proto.h" 12 | 13 | #ifdef HAS_STDLIB_H 14 | # include 15 | #else 16 | # ifdef HAS_MALLOC_H 17 | # include 18 | # else 19 | extern void free(); 20 | # endif 21 | #endif 22 | 23 | void gsm_destroy P1((S), gsm S) 24 | { 25 | if (S) free((char *)S); 26 | } 27 | -------------------------------------------------------------------------------- /util/gsm/gsm_option.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /* $Header: /home/cvs/giga/ladspa-swh/gsm/gsm_option.c,v 1.1 2001/06/10 21:36:51 swh Exp $ */ 8 | 9 | #include "private.h" 10 | 11 | #include "gsm.h" 12 | #include "proto.h" 13 | 14 | int gsm_option P3((r, opt, val), gsm r, int opt, int * val) 15 | { 16 | int result = -1; 17 | 18 | switch (opt) { 19 | case GSM_OPT_LTP_CUT: 20 | #ifdef LTP_CUT 21 | result = r->ltp_cut; 22 | if (val) r->ltp_cut = *val; 23 | #endif 24 | break; 25 | 26 | case GSM_OPT_VERBOSE: 27 | #ifndef NDEBUG 28 | result = r->verbose; 29 | if (val) r->verbose = *val; 30 | #endif 31 | break; 32 | 33 | case GSM_OPT_FAST: 34 | 35 | #if defined(FAST) && defined(USE_FLOAT_MUL) 36 | result = r->fast; 37 | if (val) r->fast = !!*val; 38 | #endif 39 | break; 40 | 41 | case GSM_OPT_FRAME_CHAIN: 42 | 43 | #ifdef WAV49 44 | result = r->frame_chain; 45 | if (val) r->frame_chain = *val; 46 | #endif 47 | break; 48 | 49 | case GSM_OPT_FRAME_INDEX: 50 | 51 | #ifdef WAV49 52 | result = r->frame_index; 53 | if (val) r->frame_index = *val; 54 | #endif 55 | break; 56 | 57 | case GSM_OPT_WAV49: 58 | 59 | #ifdef WAV49 60 | result = r->wav_fmt; 61 | if (val) r->wav_fmt = !!*val; 62 | #endif 63 | break; 64 | 65 | default: 66 | break; 67 | } 68 | return result; 69 | } 70 | -------------------------------------------------------------------------------- /util/gsm/preprocess.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /* $Header: /home/cvs/giga/ladspa-swh/gsm/preprocess.c,v 1.1 2001/06/10 21:36:51 swh Exp $ */ 8 | 9 | #include 10 | #include 11 | 12 | #include "private.h" 13 | 14 | #include "gsm.h" 15 | #include "proto.h" 16 | 17 | /* 4.2.0 .. 4.2.3 PREPROCESSING SECTION 18 | * 19 | * After A-law to linear conversion (or directly from the 20 | * Ato D converter) the following scaling is assumed for 21 | * input to the RPE-LTP algorithm: 22 | * 23 | * in: 0.1.....................12 24 | * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.* 25 | * 26 | * Where S is the sign bit, v a valid bit, and * a "don't care" bit. 27 | * The original signal is called sop[..] 28 | * 29 | * out: 0.1................... 12 30 | * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0 31 | */ 32 | 33 | 34 | void Gsm_Preprocess P3((S, s, so), 35 | struct gsm_state * S, 36 | word * s, 37 | word * so ) /* [0..159] IN/OUT */ 38 | { 39 | 40 | word z1 = S->z1; 41 | longword L_z2 = S->L_z2; 42 | word mp = S->mp; 43 | 44 | word s1; 45 | longword L_s2; 46 | 47 | longword L_temp; 48 | 49 | word msp, lsp; 50 | word SO; 51 | 52 | longword ltmp; /* for ADD */ 53 | ulongword utmp; /* for L_ADD */ 54 | 55 | register int k = 160; 56 | 57 | while (k--) { 58 | 59 | /* 4.2.1 Downscaling of the input signal 60 | */ 61 | SO = SASR( *s, 3 ) << 2; 62 | s++; 63 | 64 | assert (SO >= -0x4000); /* downscaled by */ 65 | assert (SO <= 0x3FFC); /* previous routine. */ 66 | 67 | 68 | /* 4.2.2 Offset compensation 69 | * 70 | * This part implements a high-pass filter and requires extended 71 | * arithmetic precision for the recursive part of this filter. 72 | * The input of this procedure is the array so[0...159] and the 73 | * output the array sof[ 0...159 ]. 74 | */ 75 | /* Compute the non-recursive part 76 | */ 77 | 78 | s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */ 79 | z1 = SO; 80 | 81 | assert(s1 != MIN_WORD); 82 | 83 | /* Compute the recursive part 84 | */ 85 | L_s2 = s1; 86 | L_s2 <<= 15; 87 | 88 | /* Execution of a 31 bv 16 bits multiplication 89 | */ 90 | 91 | msp = SASR( L_z2, 15 ); 92 | lsp = L_z2-((longword)msp<<15); /* gsm_L_sub(L_z2,(msp<<15)); */ 93 | 94 | L_s2 += GSM_MULT_R( lsp, 32735 ); 95 | L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/ 96 | L_z2 = GSM_L_ADD( L_temp, L_s2 ); 97 | 98 | /* Compute sof[k] with rounding 99 | */ 100 | L_temp = GSM_L_ADD( L_z2, 16384 ); 101 | 102 | /* 4.2.3 Preemphasis 103 | */ 104 | 105 | msp = GSM_MULT_R( mp, -28180 ); 106 | mp = SASR( L_temp, 15 ); 107 | *so++ = GSM_ADD( mp, msp ); 108 | } 109 | 110 | S->z1 = z1; 111 | S->L_z2 = L_z2; 112 | S->mp = mp; 113 | } 114 | -------------------------------------------------------------------------------- /util/gsm/proto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /*$Header: /home/cvs/giga/ladspa-swh/gsm/proto.h,v 1.1 2001/06/10 21:36:51 swh Exp $*/ 8 | 9 | #ifndef PROTO_H 10 | #define PROTO_H 11 | 12 | /*#if __cplusplus*/ 13 | # define NeedFunctionPrototypes 1 14 | /*#endif*/ 15 | 16 | #if __STDC__ 17 | # define NeedFunctionPrototypes 1 18 | #endif 19 | 20 | #ifdef _NO_PROTO 21 | # undef NeedFunctionPrototypes 22 | #endif 23 | 24 | #undef P /* gnu stdio.h actually defines this... */ 25 | #undef P0 26 | #undef P1 27 | #undef P2 28 | #undef P3 29 | #undef P4 30 | #undef P5 31 | #undef P6 32 | #undef P7 33 | #undef P8 34 | 35 | #if NeedFunctionPrototypes 36 | 37 | # define P( protos ) protos 38 | 39 | # define P0() (void) 40 | # define P1(x, a) (a) 41 | # define P2(x, a, b) (a, b) 42 | # define P3(x, a, b, c) (a, b, c) 43 | # define P4(x, a, b, c, d) (a, b, c, d) 44 | # define P5(x, a, b, c, d, e) (a, b, c, d, e) 45 | # define P6(x, a, b, c, d, e, f) (a, b, c, d, e, f) 46 | # define P7(x, a, b, c, d, e, f, g) (a, b, c, d, e, f, g) 47 | # define P8(x, a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h) 48 | 49 | #else /* !NeedFunctionPrototypes */ 50 | 51 | # define P( protos ) ( /* protos */ ) 52 | 53 | # define P0() () 54 | # define P1(x, a) x a; 55 | # define P2(x, a, b) x a; b; 56 | # define P3(x, a, b, c) x a; b; c; 57 | # define P4(x, a, b, c, d) x a; b; c; d; 58 | # define P5(x, a, b, c, d, e) x a; b; c; d; e; 59 | # define P6(x, a, b, c, d, e, f) x a; b; c; d; e; f; 60 | # define P7(x, a, b, c, d, e, f, g) x a; b; c; d; e; f; g; 61 | # define P8(x, a, b, c, d, e, f, g, h) x a; b; c; d; e; f; g; h; 62 | 63 | #endif /* !NeedFunctionPrototypes */ 64 | 65 | #endif /* PROTO_H */ 66 | -------------------------------------------------------------------------------- /util/gsm/table.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /* $Header: /home/cvs/giga/ladspa-swh/gsm/table.c,v 1.1 2001/06/10 21:36:51 swh Exp $ */ 8 | 9 | /* Most of these tables are inlined at their point of use. 10 | */ 11 | 12 | /* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP 13 | * CODER AND DECODER 14 | * 15 | * (Most of them inlined, so watch out.) 16 | */ 17 | 18 | #define GSM_TABLE_C 19 | #include "private.h" 20 | #include "gsm.h" 21 | 22 | /* Table 4.1 Quantization of the Log.-Area Ratios 23 | */ 24 | /* i 1 2 3 4 5 6 7 8 */ 25 | word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036}; 26 | word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144}; 27 | word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 }; 28 | word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 }; 29 | 30 | 31 | /* Table 4.2 Tabulation of 1/A[1..8] 32 | */ 33 | word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 }; 34 | 35 | 36 | /* Table 4.3a Decision level of the LTP gain quantizer 37 | */ 38 | /* bc 0 1 2 3 */ 39 | word gsm_DLB[4] = { 6554, 16384, 26214, 32767 }; 40 | 41 | 42 | /* Table 4.3b Quantization levels of the LTP gain quantizer 43 | */ 44 | /* bc 0 1 2 3 */ 45 | word gsm_QLB[4] = { 3277, 11469, 21299, 32767 }; 46 | 47 | 48 | /* Table 4.4 Coefficients of the weighting filter 49 | */ 50 | /* i 0 1 2 3 4 5 6 7 8 9 10 */ 51 | word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 }; 52 | 53 | 54 | /* Table 4.5 Normalized inverse mantissa used to compute xM/xmax 55 | */ 56 | /* i 0 1 2 3 4 5 6 7 */ 57 | word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 }; 58 | 59 | 60 | /* Table 4.6 Normalized direct mantissa used to compute xM/xmax 61 | */ 62 | /* i 0 1 2 3 4 5 6 7 */ 63 | word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; 64 | -------------------------------------------------------------------------------- /util/gsm/unproto.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5 | */ 6 | 7 | /*$Header: /home/cvs/giga/ladspa-swh/gsm/unproto.h,v 1.1 2001/06/10 21:36:51 swh Exp $*/ 8 | 9 | #ifdef PROTO_H /* sic */ 10 | #undef PROTO_H 11 | 12 | #undef P 13 | #undef P0 14 | #undef P1 15 | #undef P2 16 | #undef P3 17 | #undef P4 18 | #undef P5 19 | #undef P6 20 | #undef P7 21 | #undef P8 22 | 23 | #endif /* PROTO_H */ 24 | -------------------------------------------------------------------------------- /util/ls_filter.h: -------------------------------------------------------------------------------- 1 | #ifndef LS_FILTER_H 2 | #define LS_FILTER_H 3 | 4 | #include 5 | 6 | #define FILT_MIDI_2_FREQ(m) (m * 80.0f + 10.0f) 7 | #define FILT_MIDI_2_RESO(m) (m * 0.00787f) 8 | 9 | #define LSF_BW 0.9 10 | #define LSF_FB 0.9f 11 | 12 | typedef struct { 13 | biquad filt; 14 | biquad bp_filt; 15 | bq_t scale; 16 | bq_t resonance; 17 | } ls_filt; 18 | 19 | typedef enum { 20 | LS_FILT_TYPE_LP = 0, 21 | LS_FILT_TYPE_BP = 1, 22 | LS_FILT_TYPE_HP = 2 23 | } ls_filt_type; 24 | 25 | static inline void ls_filt_init(ls_filt *f) 26 | { 27 | biquad_init(&(f->filt)); 28 | biquad_init(&(f->bp_filt)); 29 | } 30 | 31 | static inline void ls_filt_setup(ls_filt *f, ls_filt_type t, bq_t cutoff, 32 | bq_t resonance, bq_t fs) 33 | { 34 | bp_set_params(&(f->bp_filt), cutoff, 0.7, fs); 35 | 36 | switch(t) { 37 | case LS_FILT_TYPE_LP: 38 | lp_set_params(&(f->filt), cutoff, 1.0 - resonance * LSF_BW, fs); 39 | break; 40 | case LS_FILT_TYPE_BP: 41 | bp_set_params(&(f->filt), cutoff, 1.0 - resonance * LSF_BW, fs); 42 | break; 43 | case LS_FILT_TYPE_HP: 44 | hp_set_params(&(f->filt), cutoff, 1.0 - resonance * LSF_BW, fs); 45 | break; 46 | default: 47 | /* oops, its not a known type - should really happen, but 48 | lets make the output silent just in case */ 49 | lp_set_params(&(f->filt), 1.0, 1.0, fs); 50 | break; 51 | } 52 | 53 | f->scale = 1.0f - resonance * 0.7f; 54 | f->resonance = resonance; 55 | } 56 | 57 | static inline bq_t ls_filt_run(ls_filt *f, bq_t in) 58 | { 59 | return biquad_run(&(f->filt), in) * f->scale + 60 | biquad_run_fb(&(f->bp_filt), in, f->resonance * LSF_FB) * 61 | f->resonance; 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /util/pitchscale.h: -------------------------------------------------------------------------------- 1 | #ifndef PITCHSCALE_H 2 | #define PITCHSCALE_H 3 | 4 | #include 5 | 6 | typedef fftwf_plan fft_plan; 7 | typedef float fftw_real; 8 | 9 | typedef struct { 10 | float *gInFIFO; 11 | float *gOutFIFO; 12 | float *gLastPhase; 13 | float *gSumPhase; 14 | float *gOutputAccum; 15 | float *gAnaFreq; 16 | float *gAnaMagn; 17 | float *gSynFreq; 18 | float *gSynMagn; 19 | float *gWindow; 20 | long gRover; 21 | } sbuffers; 22 | 23 | #define MAX_FRAME_LENGTH 4096 24 | 25 | #define true 1 26 | #define false 0 27 | 28 | void pitch_scale(sbuffers *buffers, const double pitchScale, const long 29 | fftFrameLength, const long osamp, const long numSampsToProcess, 30 | const double sampleRate, const float *indata, float *outdata, 31 | const int adding, const float gain); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /util/rms.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "rms.h" 3 | 4 | rms_env *rms_env_new() 5 | { 6 | rms_env *new = (rms_env *)calloc(1, sizeof(rms_env)); 7 | 8 | return new; 9 | } 10 | 11 | void rms_env_reset(rms_env *r) 12 | { 13 | unsigned int i; 14 | 15 | for (i=0; ibuffer[i] = 0.0f; 17 | } 18 | r->pos = 0; 19 | r->sum = 0.0f; 20 | } 21 | 22 | void rms_env_free(rms_env *r) 23 | { 24 | free(r); 25 | } 26 | -------------------------------------------------------------------------------- /util/rms.h: -------------------------------------------------------------------------------- 1 | #ifndef _RMS_H 2 | #define _RMS_H 3 | 4 | #include 5 | 6 | #define RMS_BUF_SIZE 64 7 | 8 | typedef struct { 9 | float buffer[RMS_BUF_SIZE]; 10 | unsigned int pos; 11 | float sum; 12 | } rms_env; 13 | 14 | rms_env *rms_env_new(); 15 | 16 | static inline float rms_env_process(rms_env *r, float x); 17 | 18 | void rms_env_reset(rms_env *r); 19 | 20 | void rms_env_free(rms_env *r); 21 | 22 | inline static float rms_env_process(rms_env *r, const float x) 23 | { 24 | r->sum -= r->buffer[r->pos]; 25 | r->sum += x; 26 | if (r->sum < 1.0e-6) { 27 | r->sum = 0.0f; 28 | } 29 | r->buffer[r->pos] = x; 30 | r->pos = (r->pos + 1) & (RMS_BUF_SIZE - 1); 31 | 32 | return sqrt(r->sum / (float)RMS_BUF_SIZE); 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /util/waveguide_nl.h: -------------------------------------------------------------------------------- 1 | #ifndef WAVEGUIDE_NL_H 2 | #define WAVEGUIDE_NL_H 3 | 4 | #include 5 | #include 6 | 7 | typedef struct { 8 | int size; 9 | float *buffer[2]; 10 | int ptr; 11 | int delay; 12 | float fc; 13 | float lp[2]; 14 | float a1a; 15 | float a1b; 16 | float zm1[2]; 17 | } waveguide_nl; 18 | 19 | waveguide_nl *waveguide_nl_new(int size, float fc, float da, float db) 20 | { 21 | waveguide_nl *wg = malloc(sizeof(waveguide_nl)); 22 | wg->size = size; 23 | wg->delay = size; 24 | wg->buffer[0] = calloc(size, sizeof(float)); 25 | wg->buffer[1] = calloc(size, sizeof(float)); 26 | wg->ptr = 0; 27 | wg->fc = fc; 28 | wg->lp[0] = 0.0f; 29 | wg->lp[1] = 0.0f; 30 | wg->zm1[0] = 0.0f; 31 | wg->zm1[1] = 0.0f; 32 | wg->a1a = (1.0f - da) / (1.0f + da); 33 | wg->a1b = (1.0f - db) / (1.0f + db); 34 | 35 | return wg; 36 | } 37 | 38 | inline void waveguide_nl_reset(waveguide_nl *wg) 39 | { 40 | memset(wg->buffer[0], 0, wg->size * sizeof(float)); 41 | memset(wg->buffer[1], 0, wg->size * sizeof(float)); 42 | wg->lp[0] = 0.0f; 43 | wg->lp[1] = 0.0f; 44 | wg->zm1[0] = 0.0f; 45 | wg->zm1[1] = 0.0f; 46 | } 47 | 48 | inline void waveguide_nl_free(waveguide_nl *wg) 49 | { 50 | if (!wg) { 51 | return; 52 | } 53 | free(wg->buffer[0]); 54 | free(wg->buffer[1]); 55 | free(wg); 56 | } 57 | 58 | inline void waveguide_nl_set_delay(waveguide_nl *wg, int delay) 59 | { 60 | if (delay > wg->size) { 61 | wg->delay = wg->size; 62 | } else if (delay < 1) { 63 | wg->delay = 1; 64 | } else { 65 | wg->delay = delay; 66 | } 67 | } 68 | 69 | inline void waveguide_nl_set_fc(waveguide_nl *wg, float fc) 70 | { 71 | wg->fc = fc; 72 | } 73 | 74 | inline void waveguide_nl_set_ap(waveguide_nl *wg, float da, float db) 75 | { 76 | wg->a1a = (1.0f - da) / (1.0f + da); 77 | wg->a1b = (1.0f - db) / (1.0f + db); 78 | } 79 | 80 | inline void waveguide_nl_process_lin(waveguide_nl *wg, float in0, float in1, float *out0, float *out1) 81 | { 82 | float tmp; 83 | 84 | *out0 = wg->buffer[0][(wg->ptr + wg->delay) % wg->size]; 85 | *out0 = wg->lp[0] * (wg->fc - 1.0f) + wg->fc * *out0; 86 | wg->lp[0] = *out0; 87 | tmp = *out0 * -(wg->a1a) + wg->zm1[0]; 88 | wg->zm1[0] = tmp * wg->a1a + *out0; 89 | *out0 = tmp; 90 | 91 | *out1 = wg->buffer[1][(wg->ptr + wg->delay) % wg->size]; 92 | *out1 = wg->lp[1] * (wg->fc - 1.0f) + wg->fc * *out1; 93 | wg->lp[1] = *out1; 94 | tmp = *out1 * -(wg->a1a) + wg->zm1[1]; 95 | wg->zm1[1] = tmp * wg->a1a + *out1; 96 | *out1 = tmp; 97 | 98 | wg->buffer[0][wg->ptr] = in0; 99 | wg->buffer[1][wg->ptr] = in1; 100 | wg->ptr--; 101 | if (wg->ptr < 0) { 102 | wg->ptr += wg->size; 103 | } 104 | } 105 | 106 | inline void waveguide_nl_process(waveguide_nl *wg, float in0, float in1, float *out0, float *out1) 107 | { 108 | float tmp; 109 | float a1; 110 | float b; 111 | 112 | *out0 = wg->buffer[0][(wg->ptr + wg->delay) % wg->size]; 113 | *out0 = wg->lp[0] * (wg->fc - 1.0f) + wg->fc * *out0; 114 | wg->lp[0] = *out0; 115 | b = (*out0 + 1.0) * 6.0f; 116 | if (b > 1.0f) { 117 | b = 1.0f; 118 | } else if (b < 0.0f) { 119 | b = 0.0f; 120 | } 121 | a1 = b * wg->a1a + (1.0f - b) * wg->a1b; 122 | tmp = *out0 * -a1 + wg->zm1[0]; 123 | wg->zm1[0] = tmp * a1 + *out0; 124 | *out0 = tmp; 125 | 126 | *out1 = wg->buffer[1][(wg->ptr + wg->delay) % wg->size]; 127 | *out1 = wg->lp[1] * (wg->fc - 1.0f) + wg->fc * *out1; 128 | wg->lp[1] = *out1; 129 | b = (*out1 + 1.0) * 6.0f; 130 | if (b > 1.0f) { 131 | b = 1.0f; 132 | } else if (b < 0.0f) { 133 | b = 0.0f; 134 | } 135 | a1 = b * wg->a1a + (1.0f - b) * wg->a1b; 136 | tmp = *out1 * -a1 + wg->zm1[1]; 137 | wg->zm1[1] = tmp * a1 + *out1; 138 | *out1 = tmp; 139 | 140 | wg->buffer[0][wg->ptr] = in0; 141 | wg->buffer[1][wg->ptr] = in1; 142 | wg->ptr--; 143 | if (wg->ptr < 0) { 144 | wg->ptr += wg->size; 145 | } 146 | } 147 | 148 | #endif 149 | -------------------------------------------------------------------------------- /xslt/manifest.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | @prefix : <http://lv2plug.in/ns/lv2core#> . 6 | @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 7 | @prefix swh: <http://plugin.org.uk/swh-plugins/> . 8 | @prefix dcterms: <http://purl.org/dc/terms/> . 9 | 10 | swh: a :Plugin ; 11 | :binary <> ; 12 | rdfs:seeAlso <plugin.ttl> ; 13 | dcterms:replaces <urn:ladspa:> . 14 | 15 | 16 | 17 | --------------------------------------------------------------------------------