scd/snd_lines.scd

master
Nova deViator 2015-09-09 16:41:44 +02:00
parent 75d1d3f952
commit 4a2538c647
1 changed files with 23 additions and 23 deletions

View File

@ -10,9 +10,9 @@
********************************************************** */ ********************************************************** */
(
// function procLines: process lines and store/return List // function procLines: process lines and store/return List
postln("~~~ function ~procLinesFunc ...");
~procLinesFunc = { // process lines, return na array ~procLinesFunc = { // process lines, return na array
arg location = PathName(thisProcess.nowExecutingPath).pathOnly +/+ "../dev/silicon_lines.txt"; arg location = PathName(thisProcess.nowExecutingPath).pathOnly +/+ "../dev/silicon_lines.txt";
var siLines = FileReader.read(path: location, skipBlanks:true, skipEmptyLines:true); var siLines = FileReader.read(path: location, skipBlanks:true, skipEmptyLines:true);
@ -36,6 +36,7 @@
siLinesData = List.newClear(0); siLinesData = List.newClear(0);
processItem = { |item, i, reverse=false, layer=0, tscale=1, toffset=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), { 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; ~siLinesData = ~procLinesFunc.value;
// sort 2D // sort 2D
@ -125,31 +127,24 @@
// FUNCTION: display linesData list in a view/window // FUNCTION: display linesData list in a view/window
postln("~~~ function ~viewLinesFunc ...");
~viewLinesFunc = { ~viewLinesFunc = {
arg siLinesData = ~siLinesData; // all we need is a List of data arg siLinesData = ~siLinesData; // all we need is a List of data
var intensity, minutes, seconds, freq1, freq2, midi1, midi2, red, green, blue; var intensity, layer, alpha, peny, penx, color, time, swin;
var layer, alpha;
// some drawing variables
var threshold = 0; var threshold = 0;
var linewidth = 3; var linewidth = 3;
var spectrumheight = 750; var spectrumheight = 750;
var colorpenlen = 40; var colorpenlen = 40;
var alphamin = 10; var alphamin = 10;
var peny, penx; var time_end = 60*37+5;
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);
w.view.background_(Color.black); // View/Window starts here
w.drawFunc = { swin = Window("TempSpectre", Rect(600, 5, width:560, height:spectrumheight));
swin.view.background_(Color.black);
swin.drawFunc = {
Pen.smoothing_(false); Pen.smoothing_(false);
Pen.translate(0,0); Pen.translate(0,0);
@ -182,16 +177,16 @@
}); // end of siLinesData.do }); // end of siLinesData.do
}; // end of drawFunc{} }; // end of drawFunc{}
w.refresh; swin.refresh;
w.front; swin.front;
}; // end of viewLines function }; // end of viewLines function
)
/*
( // DEBUG/test: ( // DEBUG/test:
// display table of all data to post window // display table of all data to post window
~siLinesData.do({ |item, i| ~siLinesData.do({ |item, i|
@ -206,7 +201,7 @@
post("\n"); post("\n");
}); });
) )
*/
@ -214,7 +209,7 @@
// or ideally expanded to an animated timeline // or ideally expanded to an animated timeline
// and included in main window...: // and included in main window...:
// show a window/view with lines - score // 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"); postln("~~~ loading mainTimeline routine");
post(" ");
~mainTimeline = Routine({ ~mainTimeline = Routine({
var delta, playhead, frequency, amp, step=0, var delta, playhead, frequency, amp, step=0,
nextdelta, nextplayhead, nextfrequency, nextamp, nextdelta, nextplayhead, nextfrequency, nextamp,
frequency_alt, nextfrequency_alt; frequency_alt, nextfrequency_alt, siLines;
siLines = ~siLinesData;
postln(siLines);
postln("debug");
while { while {