aboutsummaryrefslogtreecommitdiff
path: root/sc4pd
diff options
context:
space:
mode:
Diffstat (limited to 'sc4pd')
-rwxr-xr-xsc4pd/make-files.txt3
-rw-r--r--sc4pd/pd/lfclipnoise.pd15
-rw-r--r--sc4pd/pd/lfnoise1.pd6
-rw-r--r--sc4pd/pd/lfnoise2.pd17
-rw-r--r--sc4pd/pd/logistic.pd24
-rw-r--r--sc4pd/source/Crackle.cpp4
-rw-r--r--sc4pd/source/Logistic.cpp205
-rw-r--r--sc4pd/source/main.cpp5
8 files changed, 266 insertions, 13 deletions
diff --git a/sc4pd/make-files.txt b/sc4pd/make-files.txt
index 5952f9a..e652215 100755
--- a/sc4pd/make-files.txt
+++ b/sc4pd/make-files.txt
@@ -5,4 +5,5 @@ SRCS= \
BrownNoise.cpp ClipNoise.cpp GrayNoise.cpp WhiteNoise.cpp \
PinkNoise.cpp Dust2.cpp Crackle.cpp Rand.cpp TRand.cpp TExpRand.cpp \
IRand.cpp TIRand.cpp CoinGate.cpp support.cpp LinRand.cpp NRand.cpp\
- ExpRand.cpp LFClipNoise.cpp LFNoise0.cpp LFNoise1.cpp LFNoise2.cpp \ No newline at end of file
+ ExpRand.cpp LFClipNoise.cpp LFNoise0.cpp LFNoise1.cpp LFNoise2.cpp \
+ Logistic.cpp \ No newline at end of file
diff --git a/sc4pd/pd/lfclipnoise.pd b/sc4pd/pd/lfclipnoise.pd
index a4c3496..63f2eb7 100644
--- a/sc4pd/pd/lfclipnoise.pd
+++ b/sc4pd/pd/lfclipnoise.pd
@@ -1,10 +1,13 @@
#N canvas 0 0 450 300 10;
-#X obj 89 115 print~;
-#X obj 141 88 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
#X floatatom 246 97 5 0 0 0 - - -;
-#X obj 89 48 LFClipNoise~ 1000;
#X obj 246 55 LFClipNoise 10;
+#X obj 139 179 dac~;
+#X obj 89 154 *~ 0.1;
+#X obj 161 124 LFClipNoise~ 1001;
+#X obj 89 48 LFClipNoise~ 999;
+#X obj 161 151 *~ 0.1;
#X connect 1 0 0 0;
-#X connect 3 0 0 0;
-#X connect 4 0 2 0;
+#X connect 3 0 2 0;
+#X connect 4 0 6 0;
+#X connect 5 0 3 0;
+#X connect 6 0 2 1;
diff --git a/sc4pd/pd/lfnoise1.pd b/sc4pd/pd/lfnoise1.pd
index e6a261c..6e401f1 100644
--- a/sc4pd/pd/lfnoise1.pd
+++ b/sc4pd/pd/lfnoise1.pd
@@ -6,12 +6,12 @@
#X obj 246 143 timer;
#X obj 246 123 t b b;
#X floatatom 246 168 5 0 0 0 - - -;
-#X obj 246 55 LFNoise0 10;
#X obj 89 48 LFNoise1~ 100;
+#X obj 246 55 LFNoise1 10;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 4 1 3 1;
-#X connect 6 0 2 0;
-#X connect 7 0 0 0;
+#X connect 6 0 0 0;
+#X connect 7 0 2 0;
diff --git a/sc4pd/pd/lfnoise2.pd b/sc4pd/pd/lfnoise2.pd
new file mode 100644
index 0000000..3874d41
--- /dev/null
+++ b/sc4pd/pd/lfnoise2.pd
@@ -0,0 +1,17 @@
+#N canvas 0 0 450 300 10;
+#X obj 89 115 print~;
+#X obj 141 88 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 246 97 5 0 0 0 - - -;
+#X obj 246 143 timer;
+#X obj 246 123 t b b;
+#X floatatom 246 168 5 0 0 0 - - -;
+#X obj 246 55 LFNoise2 10;
+#X obj 89 48 LFNoise2~ 100;
+#X connect 1 0 0 0;
+#X connect 2 0 4 0;
+#X connect 3 0 5 0;
+#X connect 4 0 3 0;
+#X connect 4 1 3 1;
+#X connect 6 0 2 0;
+#X connect 7 0 0 0;
diff --git a/sc4pd/pd/logistic.pd b/sc4pd/pd/logistic.pd
new file mode 100644
index 0000000..2bb42d6
--- /dev/null
+++ b/sc4pd/pd/logistic.pd
@@ -0,0 +1,24 @@
+#N canvas 0 0 450 300 10;
+#X obj 89 115 print~;
+#X floatatom 246 97 5 0 0 0 - - -;
+#X obj 246 143 timer;
+#X obj 246 123 t b b;
+#X floatatom 246 168 5 0 0 0 - - -;
+#X obj 246 55 Logistic 1 0.5;
+#X obj 246 17 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 74 159 dac~;
+#X obj 89 134 Logistic~ 1000 4 0.4;
+#X obj 116 90 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 89 48 Logistic~ 1000 4 0.4;
+#X connect 1 0 3 0;
+#X connect 2 0 4 0;
+#X connect 3 0 2 0;
+#X connect 3 1 2 1;
+#X connect 5 0 1 0;
+#X connect 6 0 5 0;
+#X connect 8 0 7 1;
+#X connect 9 0 0 0;
+#X connect 10 0 0 0;
+#X connect 10 0 7 0;
diff --git a/sc4pd/source/Crackle.cpp b/sc4pd/source/Crackle.cpp
index a86ea18..0bc9ae0 100644
--- a/sc4pd/source/Crackle.cpp
+++ b/sc4pd/source/Crackle.cpp
@@ -74,7 +74,7 @@ FLEXT_LIB_DSP_V("Crackle~",Crackle_ar);
Crackle_ar::Crackle_ar(int argc, t_atom *argv)
: m_y1(0.3f),m_y2(0.f)
{
- FLEXT_ADDMETHOD_(0,"set",m_set);
+ FLEXT_ADDMETHOD_(0,"parameter",m_set);
//parse arguments
AtomList Args(argc,argv);
m_paramf=sc_getfloatarg(Args,0);
@@ -139,7 +139,7 @@ Crackle_kr::Crackle_kr(int argc, t_atom *argv)
: m_y1(0.3f),m_y2(0.f)
{
FLEXT_ADDBANG(0,m_perform);
- FLEXT_ADDMETHOD_(0,"set",m_set);
+ FLEXT_ADDMETHOD_(0,"parameter",m_set);
//parse arguments
AtomList Args(argc,argv);
diff --git a/sc4pd/source/Logistic.cpp b/sc4pd/source/Logistic.cpp
new file mode 100644
index 0000000..9a475e0
--- /dev/null
+++ b/sc4pd/source/Logistic.cpp
@@ -0,0 +1,205 @@
+/* sc4pd
+ Logistic, Logistic~
+
+ Copyright (c) 2004 Tim Blechmann.
+
+ This code is derived from:
+ SuperCollider real time audio synthesis system
+ Copyright (c) 2002 James McCartney. All rights reserved.
+ http://www.audiosynth.com
+
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Based on:
+ PureData by Miller Puckette and others.
+ http://www.crca.ucsd.edu/~msp/software.html
+ FLEXT by Thomas Grill
+ http://www.parasitaere-kapazitaeten.net/ext
+ SuperCollider by James McCartney
+ http://www.audiosynth.com
+
+ Coded while listening to: Fred Frith: Gravity
+
+*/
+
+#include <flext.h>
+#include "SC_PlugIn.h"
+#include "support.hpp"
+
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406)
+#error You need at least FLEXT version 0.4.6
+#endif
+
+
+/* ------------------------ Logistic~ -------------------------------*/
+
+class Logistic_ar:
+ public flext_dsp
+{
+ FLEXT_HEADER(Logistic_ar,flext_dsp);
+
+public:
+ Logistic_ar(int argc, t_atom *argv);
+
+protected:
+ virtual void m_signal(int n, t_sample *const *in, t_sample *const *out);
+ virtual void m_dsp(int n, t_sample *const *in, t_sample *const *out);
+
+ void m_set(float f)
+ {
+ m_freq = sc_min(f,m_sr);
+ }
+
+ void m_param(float f)
+ {
+ m_paramf = f;
+ }
+
+private:
+ int m_freq;
+ float m_paramf;
+
+ int m_sr;
+ double m_y1;
+ int m_counter;
+
+ FLEXT_CALLBACK_F(m_set);
+ FLEXT_CALLBACK_F(m_param);
+};
+
+FLEXT_LIB_DSP_V("Logistic~",Logistic_ar);
+
+Logistic_ar::Logistic_ar(int argc, t_atom *argv)
+{
+ FLEXT_ADDMETHOD_(0,"set",m_set);
+ FLEXT_ADDMETHOD_(0,"parameter",m_set);
+
+ //parse arguments
+ AtomList Args(argc,argv);
+
+ m_freq = sc_getfloatarg(Args,0);
+ m_paramf = sc_getfloatarg(Args,1);
+ m_y1 = sc_getfloatarg(Args,2);
+
+ m_sr=48000; // this is just a guess (i'll think about this later)
+
+ AddOutSignal();
+}
+
+void Logistic_ar::m_dsp(int n, t_sample *const *in,
+ t_sample *const *out)
+{
+ m_sr = Samplerate();
+ m_paramf = sc_min(m_paramf,m_sr);
+}
+
+
+void Logistic_ar::m_signal(int n, t_sample *const *in,
+ t_sample *const *out)
+{
+ t_sample *nout = *out;
+
+ if(m_sr == m_paramf)
+ {
+ /* it might be possible to implement this without the branch */
+
+ double y1 = m_y1;
+ double paramf = m_paramf;
+ for (int i = 0; i!= n;++i)
+ {
+ (*(nout)++)= y1 = paramf * y1 * (1.0 - y1);
+ }
+ m_y1 = y1;
+ }
+ else
+ {
+ double y1 = m_y1;
+ double paramf = m_paramf;
+ int counter = m_counter;
+ int remain = n;
+ do
+ {
+ if (counter<=0)
+ {
+ counter = (int)(m_sr / sc_max(m_freq, .001f));
+ counter = sc_max(1, counter);
+ y1 = paramf * y1 * (1.0 - y1);
+ }
+
+ int nsmps = sc_min(remain, counter);
+ remain -= nsmps;
+ counter -= nsmps;
+
+ for (int i = 0; i!= nsmps;++i)
+ {
+ (*(nout)++)=y1;
+ }
+ }
+ while(remain);
+ m_y1 = y1;
+ m_counter = counter;
+ }
+}
+
+
+/* ------------------------ Logistic ---------------------------------*/
+
+class Logistic_kr:
+ public flext_base
+{
+ FLEXT_HEADER(Logistic_kr,flext_base);
+
+public:
+ Logistic_kr(int argc, t_atom *argv);
+
+protected:
+ void m_perform();
+
+ void m_param(float f)
+ {
+ m_paramf = f;
+ }
+
+private:
+ float m_paramf;
+ double m_y1;
+
+ FLEXT_CALLBACK(m_perform);
+ FLEXT_CALLBACK_F(m_param);
+};
+
+FLEXT_LIB_V("Logistic",Logistic_kr);
+
+Logistic_kr::Logistic_kr(int argc, t_atom *argv)
+{
+ FLEXT_ADDMETHOD_(0,"parameter",m_param);
+ FLEXT_ADDBANG(0,m_perform);
+
+ //parse arguments
+ AtomList Args(argc,argv);
+
+ m_paramf = sc_getfloatarg(Args,0);
+ m_y1 = sc_getfloatarg(Args,1);
+
+ AddOutFloat();
+}
+
+void Logistic_kr::m_perform()
+{
+ m_y1 = m_paramf * m_y1 * (1.0 - m_y1);
+ ToOutFloat(0,m_y1);
+}
diff --git a/sc4pd/source/main.cpp b/sc4pd/source/main.cpp
index 0ce8b16..6294cbb 100644
--- a/sc4pd/source/main.cpp
+++ b/sc4pd/source/main.cpp
@@ -57,7 +57,7 @@ void sc4pd_library_setup()
"PinkNoise(~), \n Crackle(~), Rand(~), TRand(~), "
"TExpRand(~), IRand(~), TIRand(~),\n CoinGate, "
"LinRand(~), NRand(~), ExpRand(~), LFClipNoise(~),\n"
- " LFNoise0(~), LFNoise1(~), LFNoise2\n");
+ " LFNoise0(~), LFNoise1(~), LFNoise2(~), Logistic(~)\n");
//initialize objects
FLEXT_DSP_SETUP(Dust_ar);
@@ -130,6 +130,9 @@ void sc4pd_library_setup()
FLEXT_DSP_SETUP(LFNoise2_ar);
FLEXT_SETUP(LFNoise2_kr);
+
+ FLEXT_DSP_SETUP(Logistic_ar);
+ FLEXT_SETUP(Logistic_kr);
}
FLEXT_LIB_SETUP(sc4pd,sc4pd_library_setup);