Commits

dan mackinlay committed ca4a757

removing supporting Instr and Help from the project, since that all relates to the previous version

Comments (0)

Files changed (5)

phenosynth/Help/Phenosynth.htm

-
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
- <hmtl>
- 
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Style-Type" content="text/css">
-<title></title>
-<meta name="Generator" content="Cocoa HTML Writer">
-<meta name="CocoaVersion" content="824.42">
-<style type="text/css">
-p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
-p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
-p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
-p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
-p.p5 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
-p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
-p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
-p.p8 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
-p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #d40000}
-p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
-p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
-p.p12 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
-p.p13 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
-p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #d40000}
-p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
-span.s1 {font: 18.0px Helvetica}
-span.s2 {color: #1200c4}
-span.s3 {color: #1200c4}
-span.s4 {color: #000000}
-span.s5 {color: #1200c4}
-span.s6 {color: #d40000}
-span.s7 {font: 12.0px Helvetica; color: #000000}
-span.s8 {color: #0000ff}
-span.s9 {color: #1200c4}
-span.Apple-tab-span {white-space:pre}
-</style>
-</head>
- <body>
- 
-<p class="p1"><span class="s1"><b>JsonParser<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b></span><b> JsonParser is a parser class for JSON-serialized documents</b><span class="s1"><b><span class="Apple-tab-span">	</span></b></span></p>
-<p class="p2"><br></p>
-<p class="p1"><b>Inherits from: </b><b> Object </b></p>
-<p class="p3"><br></p>
-<p class="p1"> JSON is a lightweight format for serializing data and communication between languages. It supports hierarchical embedding of list and dictionary types and is spoken natively by browsers. This class supports decoding of strings using a single tokenization/parsing pass, which uses less memory than a two-pass process, but isn't as svelte as an evented stream decoder. Ah well.</p>
-<p class="p2"><br></p>
-<p class="p1"><b>See also:</b>  httpCOLON//json.org for the spec. </p>
-<p class="p2"><br></p>
-<p class="p4"><b>Other Issues</b></p>
-<p class="p2"><br></p>
-<p class="p1"> Note that a full JSON implementation appears to imply utf-8 encoding, which supercollider is coy about its support for. This parser is a little over-liberal with regard to missing or surplus commas.</a></p>
-<p class="p2"><br></p>
- 
-<p class="p4"><b>Creation / Class Methods</b></p>
-<p class="p5"><br></p>
- <p class="p5"><br></p>
- 
-<p class="p11"><b>Accessing Instance and Class Variables</b></p>
-<p class="p7"><span class="Apple-tab-span">	</span></p>
- <p class="p11"><b> you must instantiate to use the parser, as state is stored in the instance. </b></p>
-<p class="p12"><br></p>
-<p class="p6"> Instantiation takes no arguments; pass the string you want to decode to the <strong>decode</strong> method of an instance. All other methods should be considered private. The parser object is re-usable if you wish to keep it around to decode multiple strings.</p>
-<p class="p7"><span class="Apple-tab-span">	</span></p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>decode (jsonstr)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> The public interface of the instance is this method. It sets up state then invokes sub parsers to walk through the string.</p>
- 
-<p class="p8"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><b>    jsonstr </b>-  the string of JSON to parse.. Default value is nil.</p>
- 
-<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
-<p class="p9"><span class="s4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// Example</p>
-<p class="p10"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
- <p class="p10"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>    JsonParser.new.decode("[1,2,3]").postln ;</p> <p class="p10"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>    </p> <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>parseValue (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) Parse unspecified object - first consume whitespace until unambiguous token found - then delegate to parser based on that token. TODO</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>advanceCursor (inc )</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) advance the cursor by a specified increment - usually 1, since that is the length of most tokens.</p>
- 
-<p class="p8"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><b>    inc </b>-  cursor increment. Default value is 1.</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>toCurrentToken (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) This method increments the cursor to the next non-whitespace character so that we are pointing to a real token.</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>eatWhiteSpace (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) if there is whitespace under the  cursor, fast forward until there is not.</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>parseObject (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) The token under the cursor is the opening curly brace of an object. parse it and successive characters accordingly </p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>parseAtom (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) The token under the cursor must be the start of [true|false|null].</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>parseArray (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) The token under the is the opening brace of an array. Parse the successive characters as list contents.</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>parseString (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) The token under the cursor is the first quote of a string. Parse the accordingly. (this string parser is a rule unto itself; there is a smaller bestiary of tokens inside strings than in lists or arrays, so we do it all by hand.</p>
- <p class="p5"><br></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span>parseNumber (this)</b></p>
- 
-<p class="p6"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b> (Private.) The token under the cursor is the start of a number. Eat tokens so long as they are plausibly numeric, then try to parse them using the asFloat method. Could do with better handling of malformed numbers (with multiple decimal points, minus signs, exponents etc)</p>
- <p class="p5"><br></p>
- </body> </html>

phenosynth/Instr/judges.scd

-Instr.new( //toy listener comparing signal with a 500Hz sine
-  "phenosynth.judges.default",
-  {|in, evalPeriod = 1|
-    LagUD.ar(
-      Convolution.ar(in, SinOsc.ar(500), 1024, 0.5).abs,
-      evalPeriod/8,
-      evalPeriod
-    );
-  }, [
-    \audio,
-    \evalperiod
-  ]
-);
-Instr.new(
-  "phenosynth.judges.conv_comparator",
-  { |in, evalPeriod = 1, reference|
-    A2K.kr(LagUD.ar(
-      Convolution.ar(in, reference, 1024, 0.5).abs,
-      evalPeriod/8,
-      evalPeriod
-    ));
-    }, [
-      \audio,
-      \evalperiod,
-      \audio
-    ]
-);
-
-Instr.new(
-  "phenosynth.judges.fft_comparator",
-  {|in, evalPeriod = 1, reference, t_reset=0|
-  var othersig, testsig, comparison, sigfft, offt;
-  
-  testsig  = LeakDC.ar(in);
-  othersig = LeakDC.ar(reference);
-  
-  // Take a narrow-band FFT of the signals since we're interested in time-domain features rather than freq precision
-  // (use buffers of ~64 or 128 size - NB 32 is too small - kills the server)
-  sigfft = FFT(LocalBuf(2048), testsig);
-  offt =   FFT(LocalBuf(2048), othersig);
-  
-  comparison = FFTDiffMags.kr(sigfft, offt);
-
-  // Divide by the server's control rate to scale the output nicely
-  comparison = comparison / ControlRate.ir;
-  
-  // Default coefficient of 1.0 = no leak. When t_reset briefly hits nonzero, the integrator drains.
-  Integrator.kr(comparison, if(t_reset>0, 0, 1));
-});
-
-Instr.new(
-  "phenosynth.judges.fft_soft_comparator",
-  {|in, evalPeriod = 1, reference, t_reset=0|
-  var othersig, testsig, comparison, sigfft, offt;
-  
-  testsig  = LeakDC.ar(in);
-  othersig = LeakDC.ar(reference);
-  
-  // Take a narrow-band FFT of the signals since we're interested in time-domain features rather than freq precision
-  // (use buffers of ~64 or 128 size - NB 32 is too small - kills the server)
-  sigfft = FFT(LocalBuf(2048), testsig);
-  offt =   FFT(LocalBuf(2048), othersig);
-  
-  // Smear the FFT a little to avoid being trapped in bins
-  sigfft = PV_MagSmear(sigfft, 5);
-    offt = PV_MagSmear(  offt, 5);
-
-  comparison = FFTDiffMags.kr(sigfft, offt);
-
-  // Divide by the server's control rate to scale the output nicely
-  comparison = comparison / ControlRate.ir;
-  
-  // Default coefficient of 1.0 = no leak. When t_reset briefly hits nonzero, the integrator drains.
-  Integrator.kr(comparison, if(t_reset>0, 0, 1));
-});
-

phenosynth/Instr/reporter.scd

-Instr(
-  "phenosynth.reporter",
-  {|in, evalPeriod=1, phenoID|
-    var totalFitness;
-    totalFitness = A2K.kr(Mix.ar(in));
-    SendTrig.kr(
-      LFPulse.kr((evalPeriod.reciprocal)/2),
-      phenoID, 
-      totalFitness
-    );
-    Silence.ar;
-  },
-  [\audio, \noncontrol, \noncontrol],
-  \audio
-);

phenosynth/Instr/util.scd

-//pipe an input to the output for bus listening.
-Instr(
-  "phenosynth.thru",
-  {|in|
-    in;
-  },
-  [\audio],
-  \audio
-);

phenosynth/Instr/vox.scd

-Instr.new(
-  "phenosynth.vox.default",
-  {|gate = 1,
-    time = 1, //envelope scale factor - fit fitness functions to this?
-    pitch = 440.0,
-    ffreq = 600.0,    
-    rq = 0.5|
-    var env;
-    env = EnvGen.kr(
-      Env.asr(time/2, 1, time/2, 'linear'),
-      gate: gate//,
-      //doneAction: 2
-    );
-    Resonz.ar(
-      Saw.ar(pitch),
-      ffreq,   //cutoff
-      rq       //inverse bandwidth
-    )*env;
-  }, #[
-    \gate,
-    [0.1, 10.0, \exponential],
-    [40.0, 10000.0, \exponential],
-    [40.0, 10000.0, \exponential],
-    [0.01, 1.0, \exponential]
-  ] //, \audio
-);
-Instr.new(
-  "phenosynth.vox.graindrone",
-  {|sample = 0,
-    gate = 1,
-    time = 1, //envelope scale factor - fit fitness functions to this?
-    pitch = 1,
-    pointer = 0.0,
-    gain = 0.5,
-    pan = 0.0,
-    windowSize = 0.1,
-    ffreq = 600.0,    
-    rq = 0.5|
-    var env, outMono, outMix;
-    var bufnum = sample.bufnumIr;
-    sample.load();
-    env = EnvGen.kr(
-      Env.asr(time/2, 1, time/2, 'linear'),
-      gate: gate,
-      doneAction: 2
-    );
-    outMono = Resonz.ar(
-      Warp1.ar(
-        1,          // num channels (Class docs claim only mono works)
-        bufnum,     // buffer
-        pointer,    // start pos
-        pitch,      // pitch shift
-        windowSize, // window size (sec?)
-        -1,         // envbufnum (-1=Hanning)
-        4,          // overlap
-        0.1,        // rand ratio
-        2,          // interp (2=linear)
-        gain        // mul
-      ),
-      ffreq,   //cutoff
-      rq       //inverse bandwidth
-    );
-    Pan2.ar(
-      in: outMono,  // in
-      pos: pan,     // field pos
-      level: env    // level, enveloped
-    );
-  }, #[
-    nil,
-    \gate,
-    [0.01, 100, \exponential],
-    \freqScale,
-    [0.0, 1.0],
-    [0.01, 2, \exponential],
-    \pan,
-    [0.001, 1, \exponential],
-    \ffreq,
-    [0.001, 2, \exponential]
-  ], \audio
-);