Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DreamHouse.scd: replaced code on request by author #1067

Merged
merged 1 commit into from
Mar 31, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 93 additions & 41 deletions examples/pieces/DreamHouse.scd
Original file line number Diff line number Diff line change
@@ -1,45 +1,97 @@
//Sam Pluta - 2007
//A poor simulation of LaMonte's Dream House, found on Church St. in New York
//No matter what you think of this patch, you should go check out the real thing!
//Sam Pluta - 2014
//A poor simulation of LaMonte Young's outstanding Dream House installation, found on Church St. in New York
//Go check out the real thing!
//If you want to understand the math, read the actual title of the piece
//This will not be good in headphones - use speakers and walk around the room


SynthDef("YoungPartial",{arg freq, amp, gate=1;
var out, env;

env = EnvGen.kr(Env.asr(0,1,0), gate);

out = SinOsc.ar(freq, 0, amp)*env;

Out.ar(0, Pan2.ar(out, Rand(-1,1)));
}).load(s);


(
c=0;
d=IdentitySet.new;
(224..288).do{arg i;
if((((i*(9/8))/((i*(9/8)).floor))==1.0)&&((i*(9/8))<289),{
d.add(i);
d.add((i*(9/8)).asInteger);
c=c+1;
});
if((i.isPrime),{
d.add(i);
c=c+1;
});
if(i%2==1.0,{
if(((i/2).asInteger.isPrime),{
d.add(i);
c=c+1;
})
});
if(i%4==1.0,{
if(((i/4).asInteger.isPrime),{
d.add(i);
c=c+1;
})
});
if(i%8==1.0,{
if(((i/8).asInteger.isPrime),{
d.add(i);
c=c+1;
})
});
};
d=d.asArray;
d.sort;
d=d*10;
d.do{arg item, i;
{ Out.ar(2.rand, SinOsc.ar(item, 0, 0.006), ((2/d.size)*i-1).postln) }.play; //if you have more than 2 speakers, change the 2.rand to n.rand, where n is the number of speakers you have
}
)
var scManta, partials, freqs, sins, textStrings, notesOn, partialsOn, lastSin, differenceList, differenceText, win, octaves, spec;

partials=IdentitySet.new; //create a new set

//add the 9:7:4 base
partials.add(4.dup);partials.add(7.dup);partials.add(9.dup);

//add the main band of partials
(224..288).do{arg i;
if((i.isPrime),{
partials.add(i.dup);
});
};

partials.add(["29*(3**2)", 261]); partials.add(["31*(3**2)", 279]);

//reinforce the base frequencies within the 9:7 major third of the primary band
partials.add(["2**8", 2**8]);partials.add(["7*(2**5)",7*(2**5)]);partials.add(["9*(2**5)",9*(2**5)]);

partials.add(31.dup);partials.add(29.dup);partials.add(61.dup);partials.add(59.dup);partials.add(113.dup);

//add 119
partials.add(["17*7",119]);

//add the upper band of partials
//these are put in different octaves so that they are symetrical with the lower band
partials.add(["71*(2**3)",71*(2**3)]);partials.add(["17*(2**5)", 17*(2**5)]);
partials.add(["67*(2**4)",67*(2**4)]);partials.add(["137*(2**3)",137*(2**3)]);partials.add(["131*(2**4)",131*(2**4)]);partials.add(["139*(2**4)",139*(2**4)]);

partials=partials.asArray.sort({arg a, b; a[1]<b[1]});

partials.postln;


freqs = partials.flop[1]*7.5;
//freqs.postln;

sins = List.new;
notesOn = List.new;

partialsOn = partials.size;

octaves = List.newClear(partials.size);

spec = ControlSpec(1, 1.28, \exponential);

partials.do{arg item,i;
10.do{arg i2;
if(item[1]/(7/2*(2**i2))>=1,{
octaves.put(i, [i2, spec.unmap(item[1]/(7/2*(2**i2)))]);
})
}
};

textStrings = List.new;
win = Window("Dreamhouse", Window.screenBounds);
freqs.size.do{arg i;
textStrings.add(StaticText(win, Rect(Window.screenBounds.width/10*octaves[i][0], Window.screenBounds.height-100*(1-octaves[i][1]), Window.screenBounds.width/10, 20)).font_(Font("Monaco", 9)));
textStrings[i].string = partials[i].asString+" "+freqs[i].asString;
};

differenceText = StaticText(win, Rect(Window.screenBounds.width*3/4, Window.screenBounds.height*5/8, Window.screenBounds.width/5, Window.screenBounds.height/8));

win.front;

win.onClose_(
{
sins.do{arg item; item.set(\gate, 0)};
};
);

freqs.do{arg item, i;
sins.add(Synth("YoungPartial",[\freq, item, \amp, 1/freqs.size]));
notesOn.add(true);

};

)