public FactoryEDO5(int e, Type_Map pmap) { edo = e; map = pmap; primes = new int[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 }; range = new int[] { 36, 18, 12, 8, 4, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 }; pcnt = primes.Length; coord = new int[pcnt]; cost = new double[pcnt]; double bc = 0.15; for (int i = 0; i < pcnt; i++) { cost[i] = bc; bc = 1.2 * (bc + 0.1); } pstep = new int[pcnt]; for (int i = 0; i < pcnt; i++) { pstep[i] = (int)(0.5 + (((float)edo) * Math.Log((double)(primes[i])) / Math.Log(2.0))); } scale = new bool[edo]; for (int i = 0; i < edo; i++) { scale[i] = true; } }
public Patchwork(Type_Map pmap, Work w, int pvi) : base(pmap, w, pvi) { Rhythm origin = new Rhythm(w, map.duration); origin.singleton(); min_dur = 0.9 / (2.25 + (double)vi); Rhythm osplit = origin.splinter(min_dur, 2 + vi); Rhythm ostick = osplit.stick(0.2); Rhythm root = ostick.silence(min_dur, 0.0, 0.0, vi, min_dur); root = root.vary(min_dur, vi); double vprob = 0.1 + 0.6 * (double)vi / (double)(vi + 2); for (int i = 0; i < measure_count; i++) { if (map.rand.NextDouble() < vprob) { sequence[i] = root.vary(min_dur, vi); } else { sequence[i] = root; } } }
public FactoryEDO41(Type_Map map, bool[] pinc) : base(41, map, pinc) { commas = new Comma[2]; pumps = new Pump[2]; commas[0] = new Comma(this, new int[] { 2, 2, -1 }); pumps[0] = new Pump(commas[0], new int[] { 0, 24, 37, 20, 33 }); commas[1] = new Comma(this, new int[] { 1, -5 }); pumps[1] = new Pump(commas[0], new int[] { 0, 24, 11, 39, 26, 13 }); pumpStructure = new PumpStructureTwo(this, 1, 0); for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 19; i++) { scale[(15 + 13 * i) % edo] = true; } dichotomy = new bool[1, edo]; dichotomy[0, 0] = true; dichotomy[0, 13] = true; dichotomy[0, 28] = true; dichotomy[0, 24] = true; dichotomy[0, 17] = true; dichotomy[0, 11] = true; dichotomy[0, 30] = true; dichotomy[0, 33] = true; dichotomy[0, 8] = true; dichotomy[0, 20] = true; dichotomy[0, 21] = true; dichotomy[0, 9] = true; dichotomy[0, 32] = true; }
public FactoryEDO270(Type_Map map, bool[] pinc) : base(270, map, pinc) { synthetic = new bool[27]; for (int i = 0; i < 11; i++) { synthetic[(i * 10) % synthetic.Length] = true; } build_dichotomy(13); commas = new Comma[4]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { 2, 2, 1, 3 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 0, 1, 0, 3, -1 }); pumps[1] = new Pump(commas[0]); commas[2] = new Comma(this, new int[] { 1, 2, -4 }); pumps[2] = new Pump(commas[0]); commas[3] = new Comma(this, new int[] { 2, 1, 1, 0, 1 }); pumps[3] = new Pump(commas[0]); PumpStructure ps1 = new PumpStructureTwoAcross(this, 1, 3); PumpStructure ps2 = new PumpStructureSimple(this, 2); pumpStructure = new PumpStructureRandom(this); }
protected Pattern(Type_Map pmap, Work w, int pvi) { map = pmap; vi = pvi; measure_count = w.measure_count; sequence = new Rhythm[measure_count]; }
public FactoryEDO22(Type_Map map, bool[] pinc) : base(22, map, pinc) { commas = new Comma[2]; pumps = new Pump[2]; commas[0] = new Comma(this, new int[] { 3, 7, 0 }); int[] path = new int[] { 0, 13, 20, 11, 8, 3, 10, 1, 8, 15 }; pumps[0] = new Pump(commas[0], path); commas[1] = new Comma(this, new int[] { 3, 7, 0 }); int[] path1 = new int[] { 7, 20, 11, 18, 3, 16 }; pumps[1] = new Pump(commas[1], path1); pumpStructure = new PumpStructureRandom(this); //PumpStructure b53 = new PumpStructureBig(this, 2); //pumpStructure = new PumpStructureSum(this, a53, b53); /* * scale = new bool[11]; * scale[0] = true; * scale[3] = true; * scale[5] = true; * scale[7] = true; * scale[9] = true; */ for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 14; i++) { scale[(5 * i) % edo] = true; } dichotomy = new bool[3, edo]; dichotomy[0, 0] = true; dichotomy[0, 13] = true; // 3:2 dichotomy[0, 9] = true; // 4:3 dichotomy[0, 15] = true; // 8:5 dichotomy[0, 7] = true; // 5:4 dichotomy[0, 6] = true; // 6:5 dichotomy[0, 16] = true; // 5:3 dichotomy[0, 4] = true; // 9:8 = 8:7 dichotomy[0, 18] = true; // 16:9 = 7:4 dichotomy[0, 11] = true; // 7:5 = 10:7 dichotomy[0, 5] = true; // 7:6 dichotomy[0, 17] = true; // 12:7 //dichotomy[0, 48] = true; //dichotomy[0, 5] = true; //dichotomy[0, 44] = true; //dichotomy[0, 9] = true; }
public FactoryEDO441(Type_Map map, bool[] pinc) : base(441, map, pinc) { scale = new bool[63]; for (int i = 0; i < 14; i++) { scale[(i * 22) % 63] = true; } pumpStructure = new PumpStructureRandom(this); }
public FactoryEDO10(Type_Map map, bool[] pinc) : base(10, map, pinc) { pumpStructure = new PumpStructureNull(this); dichotomy = new bool[edo]; dichotomy[0] = true; dichotomy[2] = true; dichotomy[3] = true; dichotomy[4] = true; dichotomy[6] = true; dichotomy[7] = true; dichotomy[8] = true; }
public FactoryEDO59(Type_Map map, bool[] pinc) : base(59, map, pinc) { commas = new Comma[1]; pumps = new Pump[1]; commas[0] = new Comma(this, new int[] { 5, -3, 0 }); pumps[0] = new Pump(commas[0], new int[] { 21, 56, 37, 13, 48, 24, 5, 40 }); pumpStructure = new PumpStructureSimple(this, 0); for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 15; i++) { scale[(8 * i) % edo] = true; } /* * for (int i = 0; i < 42; i++) * { * scale[(31 * i) % edo] = true; * } */ /* * scale = new bool[59]; * for (int i = 0; i < 17; i++) * { * scale[(7 * i) % 59] = true; * } */ /* * scale[0] = true; * scale[6] = true; * scale[12] = true; * scale[18] = true; * scale[25] = true; */ dichotomy = new bool[1, edo]; dichotomy[0, 0] = true; dichotomy[0, 36] = true; dichotomy[0, 24] = true; dichotomy[0, 19] = true; dichotomy[0, 40] = true; dichotomy[0, 16] = true; dichotomy[0, 43] = true; }
public Crosstalk(Type_Map pmap, Work w, int pvi) : base(pmap, w, pvi) { Rhythm origin = new Rhythm(w, map.duration); origin.singleton(); min_dur = 0.9 / (2.25 + (double)vi); Rhythm osplit = origin.splinter(min_dur, 2 + vi); Rhythm ostick = osplit.stick(0.2); Rhythm root = ostick.silence(min_dur, 0.0, 0.0, vi, min_dur); assign(root, 0, measure_count); }
public void phase_histogram(Type_Map map) { if (map.dimension == 1) { return; } int row_size = map.row_size; int row_cnt = map.size / map.row_size; Dictionary <double, int>[] pvals = new Dictionary <double, int> [row_cnt]; for (int i = 0; i < row_cnt; i++) { pvals[i] = new Dictionary <double, int>(); } Dictionary <double, int> pval; for (int i = 0; i < vertex_count; i++) { int loc = vertices[i].measure.location; pval = pvals[loc / row_size]; double d = vertices[i].vector.histd(); if (pval.ContainsKey(d)) { pval[d] = pval[d] + 1; } else { pval[d] = 1; } } StreamWriter file; FileStream pfs = File.OpenWrite(file_prefix + "phasegram.txt"); // work.voices[0].mute = true; file = new System.IO.StreamWriter(pfs); for (int i = 0; i < row_size; i++) { file.WriteLine(string.Format("phase {0}", i)); pval = pvals[i]; foreach (KeyValuePair <double, int> kvp in pval) { file.WriteLine(string.Format("{0} at {1}", kvp.Value, kvp.Key)); } } pfs.Flush(); }
public MatrixRepeat(Type_Map pmap, Work w, int pvi, Rhythm[] roots) : base(pmap, w, pvi) { min_dur = 1.2 / (3.0 + (double)vi); Rhythm root = roots[0].vary(min_dur, vi); Rhythm[] path = new Rhythm[measure_count / map.row_size]; // path[0] = root; for (int i = 0; i < path.Length; i++) { //path[i] = path[i-1].vary(min_dur, vi); path[i] = roots[i].vary(min_dur, vi).vary(min_dur, vi); } int[] frow = new int[map.row_size]; int[] brow = new int[map.row_size]; for (int i = 0; i < map.row_size; i++) { frow[i] = 0; brow[i] = 0; } int fi = 0; int bi = measure_count - 1; while (fi <= bi) { if (map.rand.NextDouble() < 0.5) { int i = fi % map.row_size; sequence[fi] = path[frow[i]]; fi++; if (map.rand.NextDouble() < 0.25) { frow[i]++; } } else { int i = bi % map.row_size; sequence[bi] = path[brow[i]]; bi--; if (map.rand.NextDouble() < 0.25) { brow[i]++; } } } }
public FactoryEDO87(Type_Map map, bool[] pinc) : base(87, map, pinc) { commas = new Comma[6]; pumps = new Pump[6]; commas[0] = new Comma(this, new int[] { 5, -6, 0 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 2, 15, 0 }); pumps[1] = new Pump(commas[1]); commas[2] = new Comma(this, new int[] { -2, 1, -2, 1 }); pumps[2] = new Pump(commas[2]); commas[3] = new Comma(this, new int[] { 1, -1, -1, -1 }); pumps[3] = new Pump(commas[3]); commas[4] = new Comma(this, new int[] { -2, -4, 0, 1 }); pumps[4] = new Pump(commas[4]); commas[5] = new Comma(this, new int[] { -3, 1, -1, -1, 1 }); pumps[5] = new Pump(commas[5], // new int[] {0, 28, 45, 19, 66, 15, 51 }); new int[] { 0, 28, 45, 19, 66, 15, 51 }); pumpStructure = new PumpStructureRandom(this); //PumpStructure b87 = new PumpStructureBig(this, 3); //pumpStructure = new PumpStructureSum(this, a87, b87); /* * scale = new bool[29]; * for(int i = 0; i<5; i++) * { * scale[(7 * i) % 29] = true; * } */ /* * scale = new bool[3]; * scale[0] = true; * scale[1] = true; */ dichotomy = new bool[3, edo]; dichotomy[0, 0] = true; dichotomy[0, 51] = true; dichotomy[0, 36] = true; dichotomy[0, 28] = true; dichotomy[0, 59] = true; dichotomy[0, 23] = true; dichotomy[0, 64] = true; dichotomy[0, 15] = true; dichotomy[0, 72] = true; }
public Pattern(Type_Map pmap, Work w, int pvi, Rhythm[] root) { map = pmap; vi = pvi; measure_count = w.measure_count; sequence = new Rhythm[measure_count]; min_dur = 3.0 / (1.5 + (double)vi); face = map.size / map.row_size; Rhythm lroot = null; if (face == 1) { //lroot = new Rhythm(w, vi); lroot = root[0]; } lroot = lroot.vary(min_dur, vi); int fstart = 0; int fend = (measure_count / face) - 1; while (fstart <= fend) { if (face > 1) { assign(root[fstart], 0 + fstart * face, map.row_size + fstart * face); if (fend > fstart) { assign(root[fstart], 0 + fend * face, map.row_size + fend * face); } } else { lroot = lroot.vary(min_dur, vi); min_dur *= 0.98; sequence[fstart] = lroot; if (fend > fstart) { sequence[fend] = sequence[fstart]; } } fstart++; fend--; } }
public Patchwork(Type_Map pmap, Work w, int pvi, Rhythm[] roots) : base(pmap, w, pvi) { min_dur = 0.9 / (2.25 + (double)vi); Rhythm root = roots[0].vary(min_dur, vi); double vprob = 0.1 + 0.6 * (double)vi / (double)(vi + 2); for (int i = 0; i < measure_count; i++) { if (map.rand.NextDouble() < vprob) { sequence[i] = root.vary(min_dur, vi); } else { sequence[i] = root; } } }
public FactoryEDO43(Type_Map map, bool[] pinc) : base(43, map, pinc) { commas = new Comma[2]; pumps = new Pump[2]; pumpStructure = new PumpStructureNull(this); dichotomy = new bool[1, edo]; dichotomy[0, 0] = true; dichotomy[0, 18] = true; dichotomy[0, 25] = true; dichotomy[0, 14] = true; dichotomy[0, 29] = true; dichotomy[0, 11] = true; dichotomy[0, 32] = true; dichotomy[0, 7] = true; dichotomy[0, 36] = true; }
public Matrix(Type_Map pmap, Work w, int pvi, Rhythm[] roots) : base(pmap, w, pvi) { min_dur = 1.2 / (3.0 + (double)vi); Rhythm root = roots[0].vary(min_dur, vi); Rhythm[] frow = new Rhythm[map.row_size]; Rhythm[] brow = new Rhythm[map.row_size]; for (int i = 0; i < map.row_size; i++) { frow[i] = root.vary(min_dur, vi); brow[i] = frow[i]; } int fi = 0; int bi = measure_count - 1; while (fi <= bi) { if (map.rand.NextDouble() < 0.5) { int i = fi % map.row_size; sequence[fi] = frow[i]; fi++; if (map.rand.NextDouble() < 0.05) { frow[i] = frow[i].vary(min_dur, vi); } } else { int i = bi % map.row_size; sequence[bi] = brow[i]; bi--; if (map.rand.NextDouble() < 0.05) { brow[i] = brow[i].vary(min_dur, vi); } } } }
public FactoryEDO55(Type_Map map, bool[] pinc) : base(55, map, pinc) { scale = new bool[11]; for (int i = 0; i < 5; i++) { scale[(i * 7) % 11] = true; } pumpStructure = new PumpStructureRandom(this); dichotomy = new bool[edo]; dichotomy[0] = true; dichotomy[32] = true; dichotomy[23] = true; dichotomy[18] = true; dichotomy[37] = true; dichotomy[14] = true; dichotomy[41] = true; dichotomy[9] = true; dichotomy[46] = true; }
public FactoryEDO32(Type_Map map, bool[] pinc) : base(32, map, pinc) { commas = new Comma[1]; pumps = new Pump[1]; commas[0] = new Comma(this, new int[] { 6, -5, 0 }); pumps[0] = new Pump(commas[0], new int[] { 22, 31, 8, 17, 26, 3 }); pumpStructure = new PumpStructureSimple(this, 0); for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 18; i++) { scale[(i * 9) % 32] = true; } }
public FactoryEDO12(Type_Map map, bool[] pinc) : base(12, map, pinc) { commas = new Comma[2]; pumps = new Pump[2]; commas[0] = new Comma(this, new int[] { 4, -1 }); pumps[0] = new Pump(commas[0], new int[] { 0, 7, 2, 9, 4 }); commas[1] = new Comma(this, new int[] { 0, 3 }); pumps[1] = new Pump(commas[1]); pumpStructure = new PumpStructureRandom(this); /* * for (int i = 0; i < edo; i++) * { * scale[i] = false; * } * * for (int i = 0; i < 7; i++) * { * scale[(5 + 7 * i) % edo] = true; * } */ augmented = new bool[4]; augmented[0] = true; augmented[1] = true; dichotomy = new bool[1, edo]; dichotomy[0, 0] = true; dichotomy[0, 7] = true; dichotomy[0, 5] = true; dichotomy[0, 4] = true; dichotomy[0, 8] = true; dichotomy[0, 3] = true; dichotomy[0, 9] = true; dichotomy[0, 2] = true; dichotomy[0, 10] = true; }
public FactoryEDO50(Type_Map map, bool[] pinc) : base(50, map, pinc) { commas = new Comma[2]; pumps = new Pump[2]; commas[1] = new Comma(this, new int[] { 4, -1, 0 }); pumps[1] = new Pump(commas[1], new int[] { 37, 16, 45, 24, 3 }); pumpStructure = new PumpStructureRandom(this); //scale = new bool[25]; for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 19; i++) { scale[(29 * i) % scale.Length] = true; } dichotomy = new bool[2, edo]; dichotomy[0, 0] = true; dichotomy[0, 29] = true; dichotomy[0, 21] = true; dichotomy[0, 16] = true; dichotomy[0, 34] = true; dichotomy[0, 37] = true; dichotomy[0, 13] = true; dichotomy[1, 0] = true; dichotomy[1, 29] = true; dichotomy[1, 21] = true; }
public Work(Type_Map m) { map = m; file_prefix = map.file_prefix; FileStream tfs = File.OpenWrite(file_prefix + "trace.txt"); trace = new System.IO.StreamWriter(tfs); //vectorFactory = new GeneralFactory(generators, intervals); bool[] primes = new bool[6]; primes[0] = true; primes[1] = true; primes[2] = true; primes[3] = true; //primes[4] = true; //primes[5] = true; vectorFactory = new FactoryEDO171(map, primes); vectorFactory.show_pattern(); vectorFactory.scaleSearch(); rand = map.rand; measure_count = map.size; voice_count = 4; vertex_count = 0; vertices = new Vertex[500 * voice_count * measure_count]; Rhythm origin = new Rhythm(this, map.duration); origin.singleton(); double min_dur = 2.0; Rhythm osplit = origin.splinter(min_dur, 9); Rhythm ostick = osplit.stick(0.3); Rhythm osplit2 = ostick.splinter(min_dur, 9); Rhythm ostick2 = osplit2.stick(0.2); Rhythm root = ostick2.silence(min_dur, 0.0, 0.0, 2, min_dur / 1.5); root = root.vary(min_dur, 0); root = root.vary(min_dur, 0); root = root.vary(min_dur, 0); Rhythm[] rows = new Rhythm[measure_count]; rows[0] = root; for (int ri = 1; ri < rows.Length; ri++) { rows[ri] = rows[ri - 1].vary(min_dur, 0); } voices = new Voice[voice_count]; for (int i = 0; i < voice_count; i++) { voices[i] = new Voice(this, i, map, rows); } /* * for (int i = 0; i < voice_count-1; i++) * { * //for (int j = i + 1; j < voice_count; j++) * * { * voices[i].above(voices[i+1]); * } * } */ Voice.stack(voices); tfs.Flush(); }
public Voice(Work w, int voice, Type_Map tm, Rhythm[] rootr) { work = w; map = tm; vi = voice; root = (3 * vi) / 4; rootlf = -0.1 + 0.5 * (double)vi; temp_factor = 1.0; measure_count = work.measure_count; measures = new Measure[measure_count]; //pattern = new Pattern(tm, w, voice, rootr); pattern = new MatrixRepeat(tm, w, voice, rootr); int row_size = map.row_size; for (int i = 0; i < measure_count; i++) { measures[i] = new Measure(this, map, i); measures[i].temp_factor = 1.0; // - 0.15 * Math.Cos(2.0 * Math.PI * ((double)(i)) / ((double)map.size)); // measures[i].temp_factor = 1.25 // - 0.5 * (double)(i % map.row_size) / (double)(map.row_size); } int row = measure_count / row_size; sequence_count = work.measure_count; sequence = new Measure[sequence_count]; /* * int pace = 1; * for (int pi = 0; pi < vi; pi++) * { * pace *= 2; * } */ if (true) { //spiny_seq(); /* * int breps = 1; * for(int i = 0; i < vi; i++) * { * breps *= 4; * } * int lreps = 256 / breps; * * int si = 0; * * for (int bi = 0; bi < breps; bi++) * { * for (int mi = 0; mi < 4; mi++) * { * for (int li = 0; li < lreps; li++) * { * sequence[si] = measures[2*mi]; * sequence[si + 1] = measures[2 * mi + 1]; * si += 2; * } * } * } */ for (int i = 0; i < sequence_count; i++) { sequence[i] = measures[i]; //int j = i / row_size; //int ri = i % row_size; /* * int rj = ((j * pace) / row_size) % row; */ //sequence[i] = measures[(ri + ((j + voice + 1)/4) *row_size ) % measure_count]; //sequence[i] = measures[(i % row + ((i/row) * pace) / row) % measure_count]; /* * sequence[4 * i] = measures[i]; * sequence[4 * i + 1] = measures[i]; * sequence[(4 * i + 6) % sequence_count] = measures[i]; * sequence[(4 * i + 7) % sequence_count ] = measures[i]; */ } for (int i = 0; i < sequence_count; i++) { sequence[(i + 1) % sequence_count].after(sequence[i]); } } else { for (int i = 0; i < sequence_count; i++) { sequence[i] = measures[i % 16]; } for (int i = 0; i < measure_count; i++) { measures[(i + 1) % measure_count].after(measures[i]); } } Measure[] alignment = new Measure[2]; Measure[] palignment = new Measure[2]; for (int i = 0; i < measure_count; i++) { alignment[0] = measures[i]; palignment[0] = measures[(i + measure_count - 1) % measure_count]; int range = 1; for (int d = 0; d < map.dimension; d++) { Measure other = measures[(i + range) % measure_count]; alignment[1] = other; palignment[1] = measures[(i + range - 1) % measure_count]; palign(alignment, palignment); measures[i].acrossp(other); range = range * row_size; } } //for (int i = 0; i < row; i++) //{ //sequence[8 * i] = measures[2 * i]; //sequence[8 * i + 1] = measures[2 * i]; //sequence[8 * i + 2] = measures[2 * i + 1]; //sequence[8 * i + 3] = measures[2 * i + 1]; //sequence[8 * i + 4] = measures[2 * i]; //sequence[8 * i + 5] = measures[2 * i + 1]; //sequence[8 * i + 6] = measures[2 * i + 1]; //sequence[8 * i + 7] = measures[2 * i]; //sequence[(i) % sequence_count] = measures[i]; //sequence[(4 * i + 1) % sequence_count] = measures[i]; //sequence[(4 * i + 6) % sequence_count] = measures[i]; //sequence[(4 * i + 7) % sequence_count] = measures[i]; /* * for(int j=0; j<row_size; j++) * { * Measure m = measures[i * row_size + j]; * switch (j) * { * case 0: * sequence[(2 * i * row_size) % sequence_count] = m; * sequence[(2 * i * row_size + 4) % sequence_count] = m; * break; * case 1: * sequence[(2 * i * row_size + 2) % sequence_count] = m; * sequence[(2 * i * row_size + 6) % sequence_count] = m; * break; * case 2: * sequence[(2 * i * row_size + 5) % sequence_count] = m; * sequence[(2 * i * row_size + 9) % sequence_count] = m; * break; * case 3: * sequence[(2 * i * row_size + 7) % sequence_count] = m; * sequence[(2 * i * row_size + 11) % sequence_count] = m; * break; * } */ // sequence[(i * row_size + j) % sequence_count] = measures[i * row_size + j]; // sequence[((2 * i) * row_size + j) % sequence_count] = measures[i * row_size + j]; // sequence[((2 * i + 1) * row_size + j) % sequence_count] = measures[i * row_size + j]; // sequence[((3 * i + vi) * row_size + j) % sequence_count] = measures[i * row_size + j]; // sequence[((3 * i + 1 + vi) * row_size + j) % sequence_count] = measures[i * row_size + j]; // sequence[((3 * i + 2 + vi) * row_size + j) % sequence_count] = measures[i * row_size + j]; //} /* * sequence[(2 * i + vi) % sequence_count] = measures[i]; * sequence[(2 * i + vi + 1) % sequence_count] = measures[i]; */ /* * sequence[(2 * i + vi + 3) % sequence_count] = measures[i]; * sequence[(2 * i + vi + 6) % sequence_count] = measures[i]; */ // } }
public FactoryEDO34(Type_Map map, bool[] pinc) : base(34, map, pinc) { commas = new Comma[3]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { 4, 2, 0 }); pumps[0] = new Pump(commas[0], new int[] { 23, 9, 20, 6, 26, 3 }); commas[1] = new Comma(this, new int[] { 5, -6, 0 }); pumps[1] = new Pump(commas[1]); pumps[2] = new Pump(commas[0], new int[] { 0, 20, 6, 17, 3, 23 }); int[] path = new int[9]; for (int i = 0; i < 9; i++) { path[i] = (10 + i * 11) % 34; } commas[2] = new Comma(this, new int[] { -1, 8, 0 }); pumps[3] = new Pump(commas[0], path); pumpStructure = new PumpStructureRandom(this); /* * for (int i = 0; i < edo; i++) * { * scale[i] = false; * } * * for(int i = 0; i<19; i++) * { * scale[(i * 11) % edo] = true; * } */ /* * scale[0] = true; * scale[3] = true; * scale[6] = true; * scale[17] = true; * scale[20] = true; * scale[23] = true; */ /* * scale = new bool[17]; * for (int i = 0; i < 6; i++) * { * scale[(20 * i) % 17] = true; * } */ dichotomy = new bool[1, edo]; dichotomy[0, 0] = true; dichotomy[0, 9] = true; dichotomy[0, 25] = true; dichotomy[0, 11] = true; dichotomy[0, 23] = true; dichotomy[0, 14] = true; dichotomy[0, 20] = true; // dichotomy[0, 31] = true; // dichotomy[0, 3] = true; dichotomy[0, 28] = true; dichotomy[0, 6] = true; dichotomy[0, 29] = true; dichotomy[0, 5] = true; }
public FactoryEDO118(Type_Map map, bool[] pinc) : base(118, map, pinc) { commas = new Comma[4]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { 8, 1, 0 }); pumps[0] = new Pump(commas[0] , new int[] { 89, 40, 109, 60, 11, 80, 31, 100, 51 } ); commas[1] = new Comma(this, new int[] { 2, 15, 0 }); pumps[1] = new Pump(commas[1]); commas[2] = new Comma(this, new int[] { 6, -14, 0 }); pumps[2] = new Pump(commas[2], new int[] { 0, 80, 42, 73, 35, 66, 28, 59, 21, 101, 14, 94, 7, 87 }); commas[3] = new Comma(this, new int[] { 14, -13, 0 }); int[] pkp = new int[14]; for (int i = 0; i < 14; i++) { pkp[i] = ((14 + i) * 31) % 118; } pumps[3] = new Pump(commas[3], pkp); //new int[] //{0, 31, 62, 93, 6, 37, 68, 99, 12, 43, 74, 105, 18, 49 }); //PumpStructure a118 = new PumpStructureSimple(this, 1); //PumpStructure b118 = new PumpStructureBig(this, 2); //pumpStructure = new PumpStructureSum(this, a118, b118); pumpStructure = new PumpStructureRandom(this); /* * for (int i = 0; i < edo; i++) * { * scale[i] = false; * } * for (int i = 0; i < 17; i++) * { * scale[(69 * i) % edo] = true; * } */ /* * for (int i = 0; i < 42; i++) * { * scale[(31 * i) % edo] = true; * } */ /* * scale = new bool[59]; * for (int i = 0; i < 17; i++) * { * scale[(7 * i) % 59] = true; * } */ /* * scale[0] = true; * scale[6] = true; * scale[12] = true; * scale[18] = true; * scale[25] = true; */ dichotomy = new bool[2, edo]; dichotomy[0, 0] = true; dichotomy[0, 69] = true; dichotomy[0, 49] = true; dichotomy[0, 38] = true; dichotomy[0, 80] = true; dichotomy[0, 31] = true; dichotomy[0, 87] = true; dichotomy[0, 18] = true; dichotomy[0, 100] = true; dichotomy[0, 20] = true; dichotomy[0, 98] = true; dichotomy[1, 0] = true; dichotomy[1, 69] = true; dichotomy[1, 49] = true; }
public void olFactoryEDO5(int e, Type_Map tmap) { map = tmap; int ccnt = 3; comma3 = new int[ccnt]; comma5 = new int[ccnt]; comma7 = new int[ccnt]; scale = new bool[edo]; for (int i = 0; i < edo; i++) { scale[i] = true; } pumpStructure = new PumpStructureNull(this); switch (edo) { case 10: comma3[0] = 4; comma5[0] = 2; comma3[1] = 1; comma5[1] = -2; commas = new Comma[2]; pumps = new Pump[2]; commas[0] = new Comma(this, new int[] { 4, -2, -1 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 4, 2, 0 }); pumps[1] = new Pump(commas[1]); pumpStructure = new PumpStructureSimple(this, 0); break; case 12: comma3[0] = 4; comma5[0] = -1; comma3[1] = 0; comma5[1] = 3; commas = new Comma[2]; pumps = new Pump[2]; commas[0] = new Comma(this, new int[] { 4, -1, 0 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 0, 3, 0 }); pumps[1] = new Pump(commas[1]); PumpStructure a = new PumpStructureSimple(this, 0); PumpStructure b = new PumpStructureBig(this, 1); pumpStructure = new PumpStructureSum(this, a, b); break; case 15: commas = new Comma[2]; pumps = new Pump[2]; commas[0] = new Comma(this, new int[] { 5, 0, 0 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 0, 3, 0 }); pumps[1] = new Pump(commas[1]); pumpStructure = new PumpStructureSimple(this, 0); break; case 22: comma3[0] = 4; comma5[0] = 2; comma3[1] = 1; comma5[1] = -5; commas = new Comma[3]; pumps = new Pump[3]; commas[0] = new Comma(this, new int[] { 4, 2, 0 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 1, -5, 0 }); pumps[1] = new Pump(commas[1]); commas[2] = new Comma(this, new int[] { 5, -3, 0 }); pumps[2] = new Pump(commas[2]); pumpStructure = new PumpStructureSimple(this, 2); break; case 34: break; case 41: commas = new Comma[4]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { -2, 2, 0, -1 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 6, 1, -6 }); commas[2] = new Comma(this, new int[] { -5, 0, 0, 2 }); commas[3] = new Comma(this, new int[] { 2, -5, 3 }); //pumps[1] = new Pump(commas[1], new int[] { 27, 36, 4, 13, 22, 31, 40 }); pumps[1] = new Pump(commas[3], new int[] { 0, 28, 20, 7, 31, 18, 10, 38, 21, 8 }); pumpStructure = new PumpStructureSimple(this, 1); for (int i = 0; i < edo; i++) { scale[i] = false; } /* * for (int i = 0; i < 14; i++) * { * scale[(9 * i) % edo] = true; * } */ scale[0] = true; scale[7] = true; scale[8] = true; scale[10] = true; scale[17] = true; scale[18] = true; scale[20] = true; scale[21] = true; scale[28] = true; scale[30] = true; scale[31] = true; scale[38] = true; scale[39] = true; /* * scale[0] = true; * scale[7] = true; * scale[12] = true; * scale[19] = true; * scale[24] = true; * scale[29] = true; * scale[36] = true; */ /* * scale = new bool[24]; * scale[0] = true; * scale[3] = true; * scale[6] = true; * scale[9] = true; * scale[13] = true; * scale[17] = true; * scale[20] = true; */ break; case 50: commas = new Comma[3]; pumps = new Pump[3]; commas[1] = new Comma(this, new int[] { 4, -1, 0 }); pumps[1] = new Pump(commas[1]); pumpStructure = new PumpStructureSimple(this, 1); break; case 53: break; case 65: commas = new Comma[4]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { 15, 10 }); pumps[0] = new Pump(commas[0], new int[] { 0, 38, 11, 32, 5, 26, 64, 37, 58, 31, 52, 25, 63, 19, 57, 13, 51, 24, 45, 18, 39, 12, 50, 6, 44 }); pumpStructure = new PumpStructureSimple(this, 0); scale = new bool[13]; for (int i = 0; i < 5; i++) { scale[(6 * i) % 13] = true; } break; case 72: commas = new Comma[4]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { -5, 0, 0, 2 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 0, -3, 3, -1 }); pumps[1] = new Pump(commas[1]); commas[2] = new Comma(this, new int[] { -2, -2, 1, 0 }); pumps[2] = new Pump(commas[2]); commas[3] = new Comma(this, new int[] { 5, -6 }); pumps[3] = new Pump(commas[3], new int[] { 0, 19, 38, 57, 4, 23, 42 }); //PumpStructure a12 = new PumpStructureBig(this, 0); //PumpStructure b12 = new PumpStructureSimple(this, 2); //pumpStructure = // a; // new PumpStructureSum(this, a12, b12); pumpStructure = new PumpStructureSimple(this, 3); scale = new bool[19]; scale[0] = true; scale[4] = true; scale[8] = true; scale[11] = true; scale[15] = true; break; case 84: commas = new Comma[1]; pumps = new Pump[1]; commas[0] = new Comma(this, new int[] { 3, 7 }); pumps[0] = new Pump(commas[0], new int[] { 0, 27, 54, 19, 46, 73, 38, 65, 8, 35 }); pumpStructure = new PumpStructureSimple(this, 0); for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 13; i++) { scale[(35 + 19 * i) % edo] = true; } break; case 140: comma3[0] = 0; comma5[0] = 3; comma7[0] = 5; comma3[1] = 5; comma5[1] = -6; for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 32; i++) { scale[(13 * i) % edo] = true; } break; case 159: commas = new Comma[3]; pumps = new Pump[3]; commas[0] = new Comma(this, new int[] { 0, 0, 9, 6 }); pumps[0] = new Pump(commas[0]); pumpStructure = new PumpStructureSimple(this, 0); break; case 270: commas = new Comma[3]; pumps = new Pump[3]; commas[0] = new Comma(this, new int[] { 6, 4, -3, -3 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 9, -8, 4, -2 }); pumps[1] = new Pump(commas[1]); commas[2] = new Comma(this, new int[] { 3, -2, 1, -2 }); pumps[2] = new Pump(commas[2]); pumpStructure = new PumpStructureSimple(this, 2); for (int i = 0; i < edo; i++) { scale[i] = false; } for (int i = 0; i < 44; i++) { scale[(43 * i) % edo] = true; } break; default: break; } icnt = 5 * edo; }
public Measure(Voice ve, Type_Map map, int loc) { voice = ve; location = loc; duration = map.duration; stretch = 1.0; int di = map.duri[loc]; duri = di; itype = 0; int type = 30; if (ve.vi > -1) { int row = location / 16; int within = location % 12; int phase = within / 2; int pick = 0; switch (phase) { case 0: case 2: pick = row; break; default: pick = (row + 1) % 18; break; } double min_dur = 0.23 / (1.5 + (double)ve.vi); double tphase = ((double)location) / ((double)map.size); walk(ve.pattern.sequence[location]); /*walk(new Rhythm(ve.work, * ve.work.rand, * map.duration, * min_dur, * 7 + 2 * ve.vi, * map.mphase[location], * map.vphase[location], * ve.vi, * min_dur * (1.3 + 0.0 * Math.Cos(2.0 * Math.PI * * (5.0 * tphase * tphase - 3.0 * tphase * tphase * tphase ) * ) * ) * ) * ); */ //walk(map.rhythms[ve.vi, map.mtype[loc]]); } else if (ve.vi == 0) { walk(voice.rhythms[4 + location % 4]); } else { switch (type) { case 0: vertex_count = 8; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.5, 0.0); vertices[1] = make_vertex(0.5, 0.5); vertices[2] = make_vertex(0.5, 1.0); vertices[3] = make_vertex(0.5, 1.5); vertices[4] = make_vertex(0.5, 2.0); vertices[5] = make_vertex(0.5, 2.5); vertices[6] = make_vertex(0.5, 3.0); vertices[7] = make_vertex(0.5, 3.5); break; case 1: vertex_count = 10; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.25, 0.0); vertices[1] = make_vertex(0.25, 0.25); vertices[2] = make_vertex(0.5, 0.5); vertices[3] = make_vertex(0.25, 1.0); vertices[4] = make_vertex(0.25, 1.25); vertices[5] = make_vertex(0.5, 1.5); vertices[6] = make_vertex(0.25, 2.0); vertices[7] = make_vertex(0.25, 2.25); vertices[8] = make_vertex(0.5, 2.5); vertices[9] = make_vertex(1.0, 3.0); break; case 2: vertex_count = 8; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.5, 0.0); vertices[1] = make_vertex(0.5, 0.5); vertices[2] = make_vertex(0.5, 1.0); vertices[3] = make_vertex(0.5, 1.5); vertices[4] = make_vertex(0.5, 2.0); vertices[5] = make_vertex(0.25, 2.5); vertices[6] = make_vertex(0.25, 2.75); vertices[7] = make_vertex(0.5, 3.0); break; case 3: vertex_count = 4; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.9375, 0.0); vertices[1] = make_vertex(0.9375, 1.0); vertices[2] = make_vertex(0.9375, 2.0); vertices[3] = make_vertex(0.9375, 3.0); break; case 4: vertex_count = 6; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.5, 0.0); vertices[1] = make_vertex(0.5, 0.5); vertices[2] = make_vertex(1.0, 1.0); vertices[3] = make_vertex(0.5, 2.0); vertices[4] = make_vertex(0.5, 2.5); vertices[5] = make_vertex(1.0, 3.0); break; case 5: vertex_count = 5; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.5, 0.0); vertices[1] = make_vertex(0.5, 0.5); vertices[2] = make_vertex(1.0, 1.0); vertices[3] = make_vertex(1.0, 2.0); vertices[4] = make_vertex(1.0, 3.0); break; case 6: vertex_count = 5; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.3333, 0.0); vertices[1] = make_vertex(0.6666, 0.3333); vertices[2] = make_vertex(1.0, 1.0); vertices[3] = make_vertex(1.0, 2.0); vertices[4] = make_vertex(1.0, 3.0); break; case 7: vertex_count = 3; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(1.0, 0.0); vertices[1] = make_vertex(2.0, 1.0); vertices[2] = make_vertex(1.0, 3.0); break; case 8: vertex_count = 3; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(1.5, 0.0); vertices[1] = make_vertex(2.0, 1.5); vertices[2] = make_vertex(0.5, 3.5); break; case 9: vertex_count = 4; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.5, 0.0); vertices[1] = make_vertex(0.5, 0.5); vertices[2] = make_vertex(2.0, 1.0); vertices[3] = make_vertex(1.0, 3.0); break; case 14: vertex_count = 5; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.9, 0.0); vertices[1] = make_vertex(0.9, 0.9); vertices[2] = make_vertex(0.3, 1.8); vertices[3] = make_vertex(0.3, 2.1); vertices[4] = make_vertex(0.3, 2.4); break; case 15: vertex_count = 8; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.375, 0.0); vertices[1] = make_vertex(0.125, 0.375); vertices[2] = make_vertex(0.5, 0.5); vertices[3] = make_vertex(0.375, 1.0); vertices[4] = make_vertex(0.125, 1.375); vertices[5] = make_vertex(0.5, 1.5); vertices[6] = make_vertex(0.75, 2.0); vertices[7] = make_vertex(0.75, 2.75); break; case 20: vertex_count = 4; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.9375, 0.0); vertices[1] = make_vertex(0.9375, 1.0); vertices[2] = make_vertex(0.9375, 2.0); vertices[3] = make_vertex(0.9375, 3.0); break; case 21: vertex_count = 4; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.4375, 0.0); vertices[1] = make_vertex(1.4375, 0.5); vertices[2] = make_vertex(0.4375, 2.0); vertices[3] = make_vertex(1.4375, 2.5); break; case 22: vertex_count = 2; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.9375, 0.0); vertices[1] = make_vertex(2.9375, 1.0); break; case 23: vertex_count = 3; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(0.9375, 0.0); vertices[1] = make_vertex(0.9375, 1.0); vertices[2] = make_vertex(1.9375, 2.0); break; case 24: vertex_count = 2; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(1.9375, 0.0); vertices[1] = make_vertex(1.9375, 2.0); break; case 25: vertex_count = 2; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(2.9375, 0.0); vertices[1] = make_vertex(0.4375, 3.5); break; case 26: vertex_count = 1; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(3.9375, 0.0); break; case 27: vertex_count = 1; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(2.9375, 0.0); break; case 28: vertex_count = 1; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(1.9375, 0.0); break; case 30: vertex_count = 6; vertices = new Vertex[vertex_count]; for (int rep = 0; rep < 2; rep++) { vertices[3 * rep + 0] = make_vertex(1.4375, 4 * rep + 0.0); vertices[3 * rep + 1] = make_vertex(1.4375, 4 * rep + 1.5); vertices[3 * rep + 2] = make_vertex(0.9375, 4 * rep + 3.0); } break; case 31: vertex_count = 3; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(4.0 / 3.0 - 0.0625, 0.0); vertices[1] = make_vertex(4.0 / 3.0 - 0.0625, 4.0 / 3.0); vertices[2] = make_vertex(4.0 / 3.0 - 0.0625, 8.0 / 3.0); break; case 32: vertex_count = 2; vertices = new Vertex[vertex_count]; vertices[0] = make_vertex(1.0 - 0.0625, 2.0); vertices[1] = make_vertex(1.0 - 0.0625, 3.0); break; default: throw new System.InvalidOperationException("bad measure type"); } } for (int i = 1; i < vertex_count; i++) { Parallel p = new Parallel(vertices[i - 1], vertices[i]); vertices[i].before[vertices[i - 1]] = p; vertices[i - 1].after[vertices[i]] = p; } }
public FactoryEDO5(int e, Type_Map pmap, bool[] pinc) : this(e, pmap) { pumpStructure = new PumpStructureNull(this); included = pinc; for (int i = 0; i < pcnt; i++) { if (i < included.Length && included[i]) { coord[i] = range[i]; } } icnt = 5 * edo; intervals = new double[icnt]; string[] why = new string[icnt]; double[] best = new double[icnt]; for (int i = 0; i < icnt; i++) { intervals[i] = 0.00001; } sdichotomy = new bool[edo]; for (int i = 0; i < edo; i++) { sdichotomy[i] = true; } bool done = false; while (!done) { int interval = 0; double ji = 0.0; for (int i = 0; i < pcnt; i++) { interval += pstep[i] * coord[i]; ji += coord[i] * Math.Log((double)(primes[i])); } if (interval < 0) { interval = -interval; ji = -ji; } if (interval < icnt) { double scale = ((double)edo) * ji / Math.Log(2); double tempered = (double)interval; double err = Math.Abs(scale - tempered); double c = err * err * 60.0; for (int i = 0; i < pcnt; i++) { c += cost[i] * coord[i] * coord[i]; } intervals[interval] += 1.0 / (c * c); if (best[interval] == 0.0 || c < best[interval]) { best[interval] = c; why[interval] = "["; for (int i = 0; i < included.Length; i++) { why[interval] += string.Format("{0} ", coord[i]); } why[interval] += ">"; } } bool inc = false; for (int i = 0; i < pcnt && !inc; i++) { if (i < included.Length && included[i]) { coord[i]--; if (coord[i] < -range[i]) { coord[i] = range[i]; } else { inc = true; } } } done = !inc; } string cfilename = map.file_prefix + "intervals.txt"; StreamWriter cfile = new System.IO.StreamWriter(cfilename); intervals[0] = 0.0; for (int i = 1; i < icnt; i++) { intervals[i] = 1.0 / intervals[i]; // multiple hits lowers cost cfile.WriteLine(string.Format("{0}: {1}; {2} ", i, intervals[i], why[i])); } cfile.Close(); }
public FactoryEDO7(Type_Map map, bool[] pinc) : base(7, map, pinc) { pumpStructure = new PumpStructureRandom(this); }
public FactoryEDO342(Type_Map map, bool[] pinc) : base(342, map, pinc) { build_dichotomy(11); commas = new Comma[4]; pumps = new Pump[4]; commas[0] = new Comma(this, new int[] { 2, 2, -7, 4 }); pumps[0] = new Pump(commas[0]); commas[1] = new Comma(this, new int[] { 8, 1 }); pumps[1] = new Pump(commas[1], new int[] { 0, 142, 284, 84, 226, 26, 168, 310, 110 }); commas[2] = new Comma(this, new int[] { -4, -3, -2, 2 }); pumps[2] = new Pump(commas[2], new int[] { 0, 142, 32, 98, 240, 55, 197, 87, 153, 310, 110 }); commas[3] = new Comma(this, new int[] { 3, 0, 0, -6 }); pumps[3] = new Pump(commas[3]); PumpStructure a342 = new PumpStructureSimple(this, 1); PumpStructure b342 = new PumpStructureBig(this, 2); pumpStructure = new PumpStructureSimple(this, 2); /* * scale = new bool[114]; * for(int i = 0; i < 5; i++) * { * scale[(i * 43) % 114] = true; * } */ /* * for (int i = 0; i < edo; i++) * { * scale[i] = false; * } * * scale[0] = true; * scale[11] = true; * scale[32] = true; * scale[44] = true; * scale[55] = true; * scale[66] = true; * scale[87] = true; * scale[98] = true; * scale[110] = true; * scale[131] = true; * scale[142] = true; * scale[153] = true; * scale[174] = true; * scale[186] = true; * scale[197] = true; * scale[208] = true; * scale[229] = true; * scale[240] = true; * scale[252] = true; * scale[263] = true; * scale[284] = true; * scale[287] = true; * scale[298] = true; * scale[310] = true; * scale[331] = true; */ /* * for (int i = 0; i < 24; i++) * { * scale[(71 * i) % edo] = true; * } */ /* * dichotomy = new bool[edo]; * * dichotomy[0] = true; * dichotomy[200] = true; * dichotomy[142] = true; * dichotomy[58] = true; * dichotomy[284] = true; * dichotomy[43] = true; * dichotomy[299] = true; * dichotomy[157] = true; * dichotomy[185] = true; */ }