Skip to content

Commit

Permalink
white bg
Browse files Browse the repository at this point in the history
  • Loading branch information
nebogeo committed Feb 15, 2017
1 parent 2312052 commit c04d629
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 6 deletions.
10 changes: 5 additions & 5 deletions quipupixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def prerender(primary,filename,store):
def render(primary,filename):
h = int(primary.longest_pendant(0))+10;
h = min(h,max_height)
im = Image.new("RGB", (primary.num_pendants()*3,h), "black")
im = Image.new("RGB", (primary.num_pendants()*3,h), "white")

pixels=np.array(im)
primary.render(pixels,0,0,0)
Expand Down Expand Up @@ -282,7 +282,7 @@ def find_row(rows,w,maxw):
return len(rows)-1

def fit(store):
widest=2000 # max width of a row
widest=1750 # max width of a row
rows = [0]
for r in store.values():
row = find_row(rows,r[2],widest)
Expand Down Expand Up @@ -316,8 +316,8 @@ def run(filename):
return False

primary = parse_to_pendant_tree(quipu)
# reset_entropy()
# primary.calc_entropy()
reset_entropy()
primary.calc_entropy()

return render(primary,filename)

Expand Down Expand Up @@ -416,7 +416,7 @@ def batch_run(filenames):
prerun(filename,store)

size = fit(store)
im = Image.new("RGB", size, "black")
im = Image.new("RGB", size, "white")

for filename in filenames:
if filename in store:
Expand Down
79 changes: 78 additions & 1 deletion sc/version 0.3/squipu-experiments-json-01.scd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ loadRelative("scquipu-lib.scd");
~data = ~getQuipuData.("../../json/UR067.json".resolveRelative);
~data = ~getQuipuData.("../../json/UR068.json".resolveRelative);

~data = ~getQuipuData.("../../json/UR051.json".resolveRelative);
~data = ~getQuipuData.("../../json/UR015.json".resolveRelative);


(
Expand All @@ -51,7 +53,7 @@ SynthDef(\gabor, { |out, freq = 440, sustain = 1, pan, amp = 0.1|
returnFromParents = func.value(dict, level, index, returnFromParents);
dict[\children].do { |each, i| ~traverse.(each, func, level + 1, i, returnFromParents) };
};
);
)

~traverse.(~data, { |x| x[\colours].postln }); // test

Expand Down Expand Up @@ -174,6 +176,81 @@ Tdef(\x, {












/* combinations */
Server.default.makeGui

(
Tdef(\x, {
var pani = ('R':-1, 'V':1, 'U':0);
var plyi = ('S': 0, 'Z': 1, 'U': 0.5);
var dict = (
'S': (note: 0, sustain: 0.01, instrument: \gabor, sustain: 0.04),
'Z': (note: 6, sustain: 0.01, instrument: \gabor, sustain: 0.04),
'U': (note: 23, sustain: 0.01, instrument: \gabor, sustain: 0.04)
);
var knotdict = (
'8': (note: 0, sustain: 0.1, instrument: \gabor, sustain: 0.04),
'L': (note: 6, sustain: 0.1, instrument: \gabor, sustain: 0.1),
'S': (note: 23, sustain: 0.1, instrument: \gabor, sustain: 0.01)
);
~traverse.(~data, { |x, level|
var colours = x[\colours], note, pan, len, ply;
var dur;
var knots = x[\knots];
var knotpos = 0;

//x[\value].postln;
dur = 1/2 ** (level - 1);
dur = (dur / 10);
dur.wait;
if(colours.notEmpty) {
pan = pani[x[\pendant_attach]];
ply = plyi[x[\pendant_ply]];
len = x[\pendant_length] ? 25 / 25;
note = x[\colours] / 255 * 36 + 12;
(
note:note,
dur: dur,
instrument: \sin,
amp: 0.1/3,
pan: pan,
legato:len * 1.5,
ply: ply
).play;
};

"knots-------".postln;
knots.do { |k|
var event, spin;
var pos = k[\position];
pos = pos - knotpos;
knotpos = pos;

spin = k[\spin];
event = knotdict[k[\type]];
k[\type].postln;
event = event ?? { (note: 10, sustain: 0.05, instrument: \gabor, sustain: 0.04) };
event.play;
(pos/100).wait;
};

})
}).play
)





/*
ENTROPY
Expand Down

0 comments on commit c04d629

Please sign in to comment.