diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2011-07-30 20:40:34 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@iem.at> | 2015-10-14 15:23:30 +0200 |
commit | 2ae5d551c7b67fe5ff413e85d1e68eb1a063993a (patch) | |
tree | a0eb54d184ebbbf98b4a9cd9f00861108b3bc5a9 /stksitar~ | |
parent | 66aa65d08587324b679556b7b50f5db434b8167c (diff) |
added template-style README and LICENSE and purged cruft in prep for porting to the library template
svn path=/trunk/externals/unauthorized/; revision=15171
Diffstat (limited to 'stksitar~')
-rw-r--r-- | stksitar~/INSTALL | 13 | ||||
-rw-r--r-- | stksitar~/Makefile | 37 | ||||
-rw-r--r-- | stksitar~/README | 22 | ||||
-rw-r--r-- | stksitar~/mstksitar~.cc | 39 | ||||
-rw-r--r-- | stksitar~/sitar-freqs | 166 | ||||
-rw-r--r-- | stksitar~/sitar.cc | 100 | ||||
-rw-r--r-- | stksitar~/sitar.h | 43 | ||||
-rw-r--r-- | stksitar~/stksitar~-help.pd | 73 | ||||
-rw-r--r-- | stksitar~/stksitar~.cc | 119 |
9 files changed, 0 insertions, 612 deletions
diff --git a/stksitar~/INSTALL b/stksitar~/INSTALL deleted file mode 100644 index 09c76b3..0000000 --- a/stksitar~/INSTALL +++ /dev/null @@ -1,13 +0,0 @@ -install STK in /usr/local/stk
-or change STK paths in the makefile
-to your STK's location.
-
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/stksitar~
-
-make
-
-make install
-
-open help-stksitar~.pd
diff --git a/stksitar~/Makefile b/stksitar~/Makefile deleted file mode 100644 index ed218f9..0000000 --- a/stksitar~/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -NAME=stksitar~ -CSYM=stksitar_tilde -STK_HOME=/usr/local/stk - -current: pd_linux - -pd_linux: $(NAME).pd_linux - -.SUFFIXES: .pd_linux - -LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ - -Wall -W -Wshadow -Wstrict-prototypes -Werror \ - -Wno-unused -Wno-parentheses -Wno-switch - -LINUXCCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ - -Wall -W -Wshadow -Werror \ - -Wno-unused -Wno-parentheses -Wno-switch -g - -LINUXINCLUDE = -I../../src -I/usr/local/include - -.cc.pd_linux: sitar.o - g++ -O3 -Wall -D__OS_Linux_ -g -I$(STK_HOME)/include -c sitar.cc - g++ $(LINUXCCFLAGS) $(LINUXINCLUDE) -I$(STK_HOME)/include -o $*.o -c $*.cc - g++ --export-dynamic -shared -o $*.pd_linux *.o $(STK_HOME)/src/libstk.a -lc -lm -lpthread - strip --strip-unneeded $*.pd_linux - rm -f *.o ../$*.pd_linux - ln -s $*/$*.pd_linux .. - -test: - g++ -O3 -Wall -D__OS_Linux_ -g -I$(STK_HOME)/include -c sitar.cc - g++ -O3 -Wall -D__OS_Linux_ -g -I$(STK_HOME)/include -o mstksitar~ sitar.o $(STK_HOME)/src/stklib.a mstksitar~.cc - -clean: - rm -f *.o *.pd_* so_locations - -install: - cp help-*.pd *-freqs ../../doc/5.reference diff --git a/stksitar~/README b/stksitar~/README deleted file mode 100644 index 39766e1..0000000 --- a/stksitar~/README +++ /dev/null @@ -1,22 +0,0 @@ -***************************************************************************** -Version 0.2 -embedding Perry Cook's ragamatic in Pure Data -copyright 2001 by Perry Cook -copyleft 2001 by Yves Degoyon -tarballs and updates available @ http://ydegoyon.free.fr - -stksitar~ : embeds STK sitar simulation in Pure Data. - -To install stksitar~, follow the steps from INSTALL - -This software is published under GPL terms. - -This is software with ABSOLUTELY NO WARRANTY. -Use it at your OWN RISK. It's possible to damage e.g. hardware or your hearing -due to a bug or for other reasons. -We do not warrant that the program is free of infringement of any third-party -patents. - -***************************************************************************** - - diff --git a/stksitar~/mstksitar~.cc b/stksitar~/mstksitar~.cc deleted file mode 100644 index 62edef6..0000000 --- a/stksitar~/mstksitar~.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* stksitar~ -- apply a stksitar effect - * requires libDSP library - * Copyleft 2001 Yves Degoyon. - * Permission is granted to use this software for any purpose provided you - * keep this copyright notice intact. - * - * THE AUTHOR AND HIS EXPLOITERS MAKE NO WARRANTY, EXPRESS OR IMPLIED, - * IN CONNECTION WITH THIS SOFTWARE. - * -*/ - -#include "sitar.h" -#include "unistd.h" -#include "RtWvOut.h" - -sitar *x_stksitar = NULL; - -int main( int argc, char** argv ) -{ - - // int count=0; - - x_stksitar = new sitar( 50.0 ); - if ( x_stksitar == NULL ) - { - printf( "mstksitar~: cannot build sitar instrument from STK" ); - exit(-1); - } - - x_stksitar->noteOn( 400.0, 0.25 ); // start sound - while (1) - { - double dare; - - dare = (float) x_stksitar->tick(); - printf( "%f\n", dare ); - fwrite( (void*)&dare, sizeof(float), 1, stderr ); - } -} diff --git a/stksitar~/sitar-freqs b/stksitar~/sitar-freqs deleted file mode 100644 index d8c6fd8..0000000 --- a/stksitar~/sitar-freqs +++ /dev/null @@ -1,166 +0,0 @@ -329.630000; -349.230000; -415.300000; -440.000000; -329.630000; -329.630000; -293.660000; -293.660000; -329.630000; -261.630000; -261.630000; -261.630000; -293.660000; -329.630000; -329.630000; -293.660000; -261.630000; -293.660000; -329.630000; -349.230000; -329.630000; -293.660000; -329.630000; -329.630000; -349.230000; -349.230000; -415.300000; -415.300000; -349.230000; -329.630000; -349.230000; -415.300000; -440.000000; -440.000000; -493.880000; -349.230000; -261.630000; -293.660000; -329.630000; -349.230000; -329.630000; -329.630000; -329.630000; -329.630000; -293.660000; -261.630000; -293.660000; -261.630000; -293.660000; -261.630000; -293.660000; -329.630000; -349.230000; -415.300000; -349.230000; -415.300000; -415.300000; -440.000000; -493.880000; -440.000000; -349.230000; -415.300000; -440.000000; -440.000000; -415.300000; -415.300000; -440.000000; -293.660000; -329.630000; -329.630000; -349.230000; -415.300000; -440.000000; -415.300000; -440.000000; -440.000000; -493.880000; -493.880000; -440.000000; -493.880000; -523.250000; -493.880000; -523.250000; -659.260000; -659.260000; -698.460000; -880.000000; -880.000000; -880.000000; -880.000000; -659.260000; -698.460000; -659.260000; -698.460000; -659.260000; -659.260000; -659.260000; -523.250000; -659.260000; -698.460000; -880.000000; -440.000000; -493.880000; -415.300000; -440.000000; -415.300000; -440.000000; -493.880000; -329.630000; -329.630000; -349.230000; -415.300000; -349.230000; -415.300000; -415.300000; -440.000000; -349.230000; -293.660000; -293.660000; -329.630000; -293.660000; -261.630000; -261.630000; -261.630000; -261.630000; -293.660000; -261.630000; -261.630000; -293.660000; -329.630000; -349.230000; -329.630000; -293.660000; -293.660000; -293.660000; -329.630000; -329.630000; -329.630000; -349.230000; -415.300000; -440.000000; -415.300000; -415.300000; -440.000000; -493.880000; -523.250000; -493.880000; -523.250000; -493.880000; -440.000000; -493.880000; -415.300000; -440.000000; -493.880000; -523.250000; -523.250000; -523.250000; -523.250000; -659.260000; -698.460000; -880.000000; -880.000000; -880.000000; -880.000000; -880.000000; -880.000000; diff --git a/stksitar~/sitar.cc b/stksitar~/sitar.cc deleted file mode 100644 index 291c5f2..0000000 --- a/stksitar~/sitar.cc +++ /dev/null @@ -1,100 +0,0 @@ - /******************************************/ -/* Karplus-Strong sitar string model */ -/* by Perry Cook, 1995-96 */ -/* */ -/* There exist at least two patents, */ -/* assigned to Stanford, bearing the */ -/* names of Karplus and/or Strong. */ -/******************************************/ - -#include "sitar.h" - -sitar :: sitar(StkFloat lowestFreq) -{ - length = (long) (SRATE / lowestFreq + 1); - loopGain = (StkFloat) 0.999; - loopFilt = new OneZero(); - loopFilt->setZero(0.01); - delayLine = new DelayA(0.5 * length, length); - delay = length/2; - delayTarg = delay; - envelope = new ADSR(); - noise = new Noise; - envelope->setAllTimes(0.001,0.04,0.0,0.5); - this->clear(); -} - -sitar :: ~sitar() -{ - delete loopFilt; - delete delayLine; - delete envelope; - delete noise; -} - -void sitar :: clear() -{ - loopFilt->clear(); - delayLine->clear(); -} - -void sitar :: setFreq(StkFloat frequency) -{ - delayTarg = (SRATE / frequency); - delay = delayTarg * (1.0 + (0.05 * noise->tick())); - delayLine->setDelay(delay); - loopGain = (StkFloat) 0.995 + (frequency * (StkFloat) 0.000001); - if (loopGain>1.0) loopGain = (StkFloat) 0.9995; -} - -void sitar :: pluck(StkFloat amplitude) -{ - envelope->keyOn(); -} - -void sitar :: noteOn(StkFloat freq, StkFloat amp) -{ - this->setFreq(freq); - this->pluck(amp); - amPluck = 0.05 * amp; -#if defined(_debug_) - printf("sitar : NoteOn: Freq=%lf Amp=%lf\n",freq,amp); -#endif -} - -void sitar :: noteOff(StkFloat amp) -{ - loopGain = (StkFloat) 1.0 - amp; -#if defined(_debug_) - printf("sitar : NoteOff: Amp=%lf\n",amp); -#endif -} - -StkFloat sitar :: tick() -{ - StkFloat temp; - - temp = delayLine->lastOut(); - if (fabs(temp) > 1.0) { - loopGain = 0.1; - this->noteOff(0.9); - delay = delayTarg; - delayLine->setDelay(delay); - } - - temp *= loopGain; - - if (fabs(delayTarg - delay) > 0.001) { - if (delayTarg < delay) - delay *= 0.99999; - else - delay *= 1.00001; - delayLine->setDelay(delay); - } - - lastOutput_ = delayLine->tick(loopFilt->tick(temp) - + (amPluck * envelope->tick() * noise->tick())); - - return lastOutput_; -} - diff --git a/stksitar~/sitar.h b/stksitar~/sitar.h deleted file mode 100644 index 1144c86..0000000 --- a/stksitar~/sitar.h +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************/ -/* Karplus-Strong Sitar1 string model */ -/* by Perry Cook, 1995-96 */ -/* */ -/* There exist at least two patents, */ -/* assigned to Stanford, bearing the */ -/* names of Karplus and/or Strong. */ -/******************************************/ - -#if !defined(__sitar_h) -#define __sitar_h - -#include "Instrmnt.h" -#include "DelayA.h" -#include "OneZero.h" -#include "Noise.h" -#include "ADSR.h" - -class sitar : public Instrmnt -{ -protected: - DelayA *delayLine; - OneZero *loopFilt; - ADSR *envelope; - Noise *noise; - long length; - StkFloat loopGain; - StkFloat amPluck; - StkFloat delay; - StkFloat delayTarg; -public: - sitar(StkFloat lowestFreq); - ~sitar(); - void clear(); - virtual void setFreq(StkFloat frequency); - void pluck(StkFloat amplitude); - virtual void noteOn(StkFloat freq, StkFloat amp); - virtual void noteOff(StkFloat amp); - virtual StkFloat tick(); -}; - -#endif - diff --git a/stksitar~/stksitar~-help.pd b/stksitar~/stksitar~-help.pd deleted file mode 100644 index 986edd0..0000000 --- a/stksitar~/stksitar~-help.pd +++ /dev/null @@ -1,73 +0,0 @@ -#N canvas 33 1 784 529 10; -#X obj 112 311 dac~; -#X obj 115 248 stksitar~; -#X obj 114 278 *~; -#X floatatom 147 278 5 0 0; -#X msg 162 172 stop; -#X floatatom 196 200 5 52 100000; -#X floatatom 238 248 5 5 35; -#X text 247 335 stksitar~ : Object to embed stk-based sitar synthesis -; -#X text 247 360 Comments and bugs @ ydegoyon@free.fr; -#X msg 113 346 \; pd dsp 1; -#X msg 179 346 \; pd dsp 0; -#X msg 24 34 bang; -#X msg 93 99 play; -#X msg 113 173 play; -#X obj 195 248 / 100; -#X text 276 279 Master level; -#X obj 23 99 metro 2000; -#X floatatom 52 75 5 0 0; -#X obj 134 78 / 1000; -#X obj 134 98 + 0.05; -#X floatatom 182 98 5 0 0; -#X obj 217 278 loadbang; -#X text 301 258 ( min=0.05 \, max=0.35 \, default = 0.25 ); -#X text 303 248 Strength of plucking; -#X text 239 205 ( min=52Hz \, default=250 Hz ); -#X text 241 195 Frequency; -#X obj 231 77 qlist; -#X msg 274 76 read sitar-freqs; -#X msg 231 55 next; -#X msg 274 55 rewind; -#X text 247 348 Originally written by Perry Cook for STK/ragamatic -; -#X obj 386 76 loadbang; -#X msg 189 278 40; -#X obj 24 75 + 0; -#X text 21 12 Ready for meditation ??; -#X text 240 398 And now another message from Nancy Reagan : "Drugs -destroy your brain"; -#X obj 134 59 random 200; -#X obj 24 57 random 1000; -#X connect 1 0 2 0; -#X connect 2 0 0 0; -#X connect 2 0 0 1; -#X connect 3 0 2 1; -#X connect 4 0 1 0; -#X connect 5 0 1 1; -#X connect 6 0 14 0; -#X connect 11 0 16 0; -#X connect 11 0 37 0; -#X connect 12 0 1 0; -#X connect 13 0 1 0; -#X connect 14 0 1 2; -#X connect 16 0 12 0; -#X connect 16 0 28 0; -#X connect 16 0 36 0; -#X connect 16 0 37 0; -#X connect 17 0 16 1; -#X connect 18 0 19 0; -#X connect 19 0 20 0; -#X connect 19 0 1 2; -#X connect 21 0 32 0; -#X connect 26 0 5 0; -#X connect 26 1 29 0; -#X connect 27 0 26 0; -#X connect 28 0 26 0; -#X connect 29 0 26 0; -#X connect 31 0 27 0; -#X connect 32 0 3 0; -#X connect 33 0 17 0; -#X connect 36 0 18 0; -#X connect 37 0 33 0; diff --git a/stksitar~/stksitar~.cc b/stksitar~/stksitar~.cc deleted file mode 100644 index bfa7a54..0000000 --- a/stksitar~/stksitar~.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* stksitar~ -- STK-based sitar synthesis - * requires STK library - * Copyleft 2001 Yves Degoyon. - * Permission is granted to use this software for any purpose provided you - * keep this copyright notice intact. - * - * THE AUTHOR AND HIS EXPLOITERS MAKE NO WARRANTY, EXPRESS OR IMPLIED, - * IN CONNECTION WITH THIS SOFTWARE. - * -*/ - -#include "m_pd.h" -#include "sitar.h" - -#define DEFAULT_FREQ 250.0 -#define DEFAULT_PLUCK 0.25 - -typedef struct _stksitar -{ - t_object x_obj; - sitar *x_stksitar; - t_int x_on; - t_float x_freq; - t_float x_pluck; -} t_stksitar; - -static t_class *stksitar_class; - -static void *stksitar_new(void) -{ - t_stksitar *x = (t_stksitar *)pd_new(stksitar_class); - x->x_freq = DEFAULT_FREQ; - x->x_pluck = DEFAULT_PLUCK; - outlet_new(&x->x_obj, &s_signal); - inlet_new( &x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("freq") ); - inlet_new( &x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("pluck") ); - if( (x->x_stksitar = new sitar( 50.0 )) == NULL ) { - post( "stksitar~: cannot build sitar instrument from STK" ); - return NULL; - } else { - return (x); - } -} - -static void stksitar_freq(t_stksitar* x, t_float ffreq) -{ - if ( ffreq < 50.0 ) - { - post("stksitar~ : wrong frequency" ); - return; - } - x->x_stksitar->setFreq( (StkFloat) ffreq ); - x->x_freq = ffreq; -} - -static void stksitar_pluck(t_stksitar* x, t_float fpluck) -{ - if ( fpluck < 0.05 || fpluck > 0.35 ) - { - post("stksitar~ : wrong pluck argument" ); - return; - } - x->x_stksitar->pluck( (StkFloat) fpluck ); - x->x_pluck = fpluck; -} - -static void stksitar_play(t_stksitar* x) -{ - x->x_on = 1; // activate sound - x->x_stksitar->noteOn( x->x_freq, x->x_pluck ); // start sound -} - -static void stksitar_stop(t_stksitar* x) -{ - x->x_on = 0; // deactivate sound -} - -static t_int *stksitar_perform(t_int *w) -{ - t_float *out = (t_float *)(w[1]); - int n = (int)(w[2]); - t_stksitar* x = (t_stksitar*)(w[3]); - - while ( n-- ) - { - if ( x->x_on ) - { - double dare; - - dare = (float)x->x_stksitar->tick(); - // post( "synthesis : %f", dare ); - *out=dare; - } - else - { - *(out) = 0.0; - } - out++; - } - - return (w+4); -} - -static void stksitar_dsp(t_stksitar *x, t_signal **sp) -{ - dsp_add(stksitar_perform, 3, sp[0]->s_vec, sp[0]->s_n, x); -} - -extern "C" void stksitar_tilde_setup(void) -{ - stksitar_class = class_new(gensym("stksitar~"), (t_newmethod)stksitar_new, 0, - sizeof(t_stksitar), 0, A_NULL); - class_sethelpsymbol(stksitar_class, gensym("help-stksitar~.pd")); - class_addmethod(stksitar_class, (t_method)stksitar_dsp, gensym("dsp"), A_NULL); - class_addmethod(stksitar_class, (t_method)stksitar_play, gensym("play") , A_NULL); - class_addmethod(stksitar_class, (t_method)stksitar_stop, gensym("stop") , A_NULL); - class_addmethod(stksitar_class, (t_method)stksitar_freq, gensym("freq") , A_DEFFLOAT, A_NULL); - class_addmethod(stksitar_class, (t_method)stksitar_pluck, gensym("pluck") , A_DEFFLOAT, A_NULL); -} |