[
Cottle examples]
7. Intervals
7 Assignment seven
// 7.1 intervals
s = Server.internal;
s.boot;
(
{
f = 400; //fundamental
r = 2/1; //ratio for second note in interval
Mix.ar(FSinOsc.ar([f, f*r]))*0.4
}.scope;
)
//7.2 intervals
// Since the internal server by default has only 2 output channels,
// I have to use different buses for synthesis and display. I'll also route
// the first 2 channels to the left and right outputs.
// This illustrates basic audio signal routing: synthesis in one chain on
// an internal bus, then routing to the hardware out afterward.
(
{
f = 200; // I'm lowering the base frequency so you can see the waveshapes better.
r = 2/1;
a = FSinOsc.ar(f, 0, 0.4);
b = FSinOsc.ar(f*r, 0, 0.4);
[a, b, a+b]
}.scope(3, 10);
// read 2 channels from buses 10 and 11 and play out to buses 0 and 1
{ In.ar(10, 2) }.play(s, 0);
)
//7.3 chord plot
// Again, no plot. Using scope instead.
{ Mix.ar(FSinOsc.ar([200, 300], 0, 0.3)) }.scope;
//7.4 interval plots
{ Mix.ar(FSinOsc.ar([200, 200*4/3], 0, 0.3)) }.scope;
{ Mix.ar(FSinOsc.ar([200, 200*5/4], 0, 0.3)) }.scope;
{ Mix.ar(FSinOsc.ar([200, 200*8/5], 0, 0.3)) }.scope;
{ Mix.ar(FSinOsc.ar([200, 200*64/45], 0, 0.3)) }.scope;
//7.5 audio frequencies
{ Saw.ar(MouseX.kr(1, 1200), 0.5) }.scope;
//7.6 ratios from LF to audio rate
(
{
var freq, ratioNum, ratioDenum; //declare two variables
ratioNum = 3; //assign numerator
ratioDenum = 2; //assign denominator
freq = MouseX.kr(1, 110); //freq is mouse control
LFSaw.ar(
[freq, freq*(ratioNum/ratioDenum)],
0,
0.3)
}.scope;
)