From 4a2538c647438ff17c391ccee2239bb18c1d3e04 Mon Sep 17 00:00:00 2001 From: Nova deViator Date: Wed, 9 Sep 2015 16:41:44 +0200 Subject: [PATCH] scd/snd_lines.scd --- scd/snd_lines.scd | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scd/snd_lines.scd b/scd/snd_lines.scd index 1914afc..5b923d4 100644 --- a/scd/snd_lines.scd +++ b/scd/snd_lines.scd @@ -10,9 +10,9 @@ ********************************************************** */ -( // function procLines: process lines and store/return List +postln("~~~ function ~procLinesFunc ..."); ~procLinesFunc = { // process lines, return na array arg location = PathName(thisProcess.nowExecutingPath).pathOnly +/+ "../dev/silicon_lines.txt"; var siLines = FileReader.read(path: location, skipBlanks:true, skipEmptyLines:true); @@ -36,6 +36,7 @@ siLinesData = List.newClear(0); + processItem = { |item, i, reverse=false, layer=0, tscale=1, toffset=0| if((item[1].asInt > threshold) && (item[0].asInt < 6741) && (item[0].asInt > 3950), { @@ -115,7 +116,8 @@ }; -// process lines, store to a List +// process lines, store to a List +postln("~~~ process lines, store to a list: ~siLinesData, sort ..."); ~siLinesData = ~procLinesFunc.value; // sort 2D @@ -125,31 +127,24 @@ - - // FUNCTION: display linesData list in a view/window +postln("~~~ function ~viewLinesFunc ..."); ~viewLinesFunc = { arg siLinesData = ~siLinesData; // all we need is a List of data - var intensity, minutes, seconds, freq1, freq2, midi1, midi2, red, green, blue; - var layer, alpha; - - // some drawing variables + var intensity, layer, alpha, peny, penx, color, time, swin; var threshold = 0; var linewidth = 3; var spectrumheight = 750; var colorpenlen = 40; var alphamin = 10; - var peny, penx; - var color; - var time, time_end = 60*37+5; - - // View/Window starts here - var w = Window("TempSpectre", Rect(600, 5, width:560, height:spectrumheight)); - postln(~siLinesData); + var time_end = 60*37+5; - w.view.background_(Color.black); - w.drawFunc = { + // View/Window starts here + swin = Window("TempSpectre", Rect(600, 5, width:560, height:spectrumheight)); + + swin.view.background_(Color.black); + swin.drawFunc = { Pen.smoothing_(false); Pen.translate(0,0); @@ -182,16 +177,16 @@ }); // end of siLinesData.do }; // end of drawFunc{} - w.refresh; - w.front; + swin.refresh; + swin.front; }; // end of viewLines function -) +/* ( // DEBUG/test: // display table of all data to post window ~siLinesData.do({ |item, i| @@ -206,7 +201,7 @@ post("\n"); }); ) - +*/ @@ -214,7 +209,7 @@ // or ideally expanded to an animated timeline // and included in main window...: // show a window/view with lines - score -~viewLinesFunc.value; +// ~viewLinesFunc.value; @@ -261,12 +256,17 @@ SynthDef(\siliconSynth, { |freq = 440, amp = 0.2, attack = 1, release = 1| postln("~~~ loading mainTimeline routine"); +post(" "); ~mainTimeline = Routine({ var delta, playhead, frequency, amp, step=0, nextdelta, nextplayhead, nextfrequency, nextamp, - frequency_alt, nextfrequency_alt; + frequency_alt, nextfrequency_alt, siLines; + + siLines = ~siLinesData; + postln(siLines); + postln("debug"); while {