You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

297 lines
8.5KB

  1. ~seed = 11735;
  2. ~dir = thisProcess.nowExecutingPath.dirname;
  3. PathName.new(~dir).files.do({arg path; if((path.fileName != "main.scd") && (path.fileName != "stepper_control.scd"), {path.fileName.loadRelative})});
  4. ~bergerTiling = ~berger.value(500, 500, true);
  5. ~bergerCreateSynths.value;
  6. ~bergerRelTiling = ~berger.value(400, 400, false);
  7. ~bergerMusic = ~bergerMusicify.value(~bergerRelTiling, 0, 0, 383, 383, 8, 3, 3.5, ~seed);
  8. ~bergerSound = ~bergerSonify.value(~bergerMusic);
  9. ~bergerSound.play;
  10. ~bergerTranscribe.value(~bergerMusic);
  11. ~visualize.value(~berger.value(100, 100), 0, 0, scale: 1, name: "berger")
  12. s.record(~dir +/+ ".." +/+ "recs" +/+ "berger_knuth.wav", duration: (30 * 60));
  13. ~robinsonTiling = ~robinson.value(8);
  14. ~robinsonCreateSynths.value;
  15. ~robinsonMusic = ~robinsonMusicify.value(~robinsonTiling, 0, 0, 200, 200, 6, 3, 3.5, ~seed);
  16. ~robinsonSound = ~robinsonSonify.value(~robinsonMusic);
  17. ~robinsonSound.play;
  18. ~robinsonTranscribe.value(~robinsonMusic);
  19. ~visualize.value(~robinsonTiling, 0, 0, 200, 200, scale: 1, name: "robinson");
  20. s.record(~dir +/+ ".." +/+ "recs" +/+ "robinson.wav", duration: (30 * 60));
  21. //Potential TODO: add (de)crescendo markings and update synthdef to have the fades
  22. ~penroseTiling = ~penrose.value(120, 5, ~seed);
  23. ~penroseCreateSynths.value;
  24. ~penroseMusic = ~penroseMusicify.value(~penroseTiling, 0, 0, 99, 99, 6, 3, 3.5, ~seed);
  25. ~penroseSound = ~penroseSonify.value(~penroseMusic);
  26. ~penroseSound.play;
  27. ~penroseTranscribe.value(~penroseMusic);
  28. ~visualize.value(~penroseTiling, 0, 0, name: "penrose");
  29. s.record(~dir +/+ ".." +/+ "recs" +/+ "penrose.wav", duration: (30 * 60));
  30. ~ammannTiling = ~ammann.value(645, 105);
  31. ~ammannCreateSynths.value;
  32. ~ammannMusic = ~ammannMusicify.value(~ammannTiling, 0, 0, 640, 100, 7, 3, 3.5, ~seed);
  33. ~ammannSound = ~ammannSonify.value(~ammannMusic);
  34. ~ammannSound.play;
  35. ~ammannTranscribe.value(~ammannMusic);
  36. ~visualize.value(~ammann.value(200, 200), 0, 0, name: "ammann")
  37. s.record(~dir +/+ ".." +/+ "recs" +/+ "ammann.wav", duration: 300);
  38. ~kariTiling = ~kari_culik.value(500, 500, 0, 0, true);
  39. ~kariCreateSynths.value;
  40. ~kariMusic = ~kariMusicify.value(~kariTiling, 30, 30, 320, 320, ~seed);
  41. ~kariSound = ~kariSonify.value(~kariMusic);
  42. ~kariSound.play;
  43. ~kariTranscribe.value(~kariMusic);
  44. ~visualize.value(~kari_culik.value(200, 200, 0, 5, true), 0, 0, scale: 1, name: "kari");
  45. s.record(~dir +/+ ".." +/+ "recs" +/+ "kari_culik.wav", duration: 300);
  46. ~jaendelTiling = ~jaendel.value(14, 0, 0, 0);
  47. ~jaendelCreateSynths.value;
  48. ~jaendelMusic = ~jaendelMusicify.value(~jaendelTiling, 15, 15, 548 * 2 * 1, 64 * 1);
  49. ~jaendelSound = ~jaendelSonify.value(~jaendelMusic, 0, 1, 55);
  50. ~jaendelSound.play;
  51. ~jaendelTranscribe.value(~jaendelMusic);
  52. ~visualize.value(~jaendelTiling, 0, 0, name: "jaendel");
  53. s.record(~dir +/+ ".." +/+ "recs" +/+ "jaendel_rao.wav", duration: 300);
  54. //~~~~~~~~~crypto visualizer code
  55. //check to make sure that jaendel is offset by at least 13
  56. (
  57. ~genVisualCrypto = {arg dir,
  58. seed = 11735,
  59. genTilings = false,
  60. genSecrets = true,
  61. genOTP = true,
  62. genShadowArray0 = true,
  63. genShadowArray1 = true,
  64. genIMGData = true,
  65. writeIMGs = true,
  66. visualize = false;
  67. var path, bergerTiling, robinsonTiling, penroseTiling, ammannTiling, kariTiling, jaendelTiling, tilings, offsets,
  68. secrets, otp, shadowArray0, shadowArray1, shadowImg0, shadowImg1;
  69. path = dir +/+ ".." +/+ "visualizations" +/+ seed;
  70. File.mkdir(path);
  71. if(genTilings, {
  72. var texts, file;
  73. //for final tilings
  74. bergerTiling = ~berger.value(500, 500, true);
  75. robinsonTiling = ~robinson.value(8);
  76. penroseTiling = ~penrose.value(140, 5, ~seed);
  77. ammannTiling = ~ammann.value(500, 140);
  78. kariTiling = ~kari_culik.value(500, 500, 0, 0, true);
  79. jaendelTiling = ~jaendel.value(13, 0, 0, 0);
  80. //array form
  81. texts = ["from oracles ", "subsets of infinite orders ", "on undecidable questions "];
  82. tilings = [
  83. [jaendelTiling, kariTiling, texts[0]],
  84. [ammannTiling, texts[1], penroseTiling],
  85. [texts[2], robinsonTiling, bergerTiling]
  86. ];
  87. //write tiling data
  88. file = File((path +/+ "tiling_data_with_text.txt").standardizePath, "w");
  89. file.write(tilings.asCompileString);
  90. file.close;
  91. }, {
  92. //read tilings
  93. tilings = File.readAllString((path +/+ "tiling_data_with_text.txt").standardizePath);
  94. tilings = tilings.interpret;
  95. });
  96. "tilings generated".postln;
  97. if(genSecrets, {
  98. var file;
  99. offsets = [
  100. [[15, 15], [30, 30], [0, 0]],
  101. [[0, 0], [0, 0], [0, 0]],
  102. [[0, 0], [0, 0], [0, 0]]
  103. ];
  104. //gen secrets
  105. secrets = ~genSecrets.value(tilings, offsets);
  106. //write secrets
  107. file = File((path +/+ "/secrets.txt").standardizePath, "w");
  108. file.write(secrets.asCompileString);
  109. file.close
  110. }, {
  111. //read secrets
  112. secrets = File.readAllString((path +/+ "/secrets.txt").standardizePath);
  113. secrets = secrets.interpret
  114. });
  115. "secrets generated".postln;
  116. if(genOTP, {
  117. var file;
  118. //gen on time pad
  119. otp = ~genOneTimePad.value(secrets[0][0].size, secrets[0][0][0].size);
  120. //write otp
  121. file = File((path +/+ "/otp.txt").standardizePath, "w");
  122. file.write(otp.asCompileString);
  123. file.close
  124. }, {
  125. //read otp
  126. otp = File.readAllString((path +/+ "/otp.txt").standardizePath);
  127. otp = otp.interpret
  128. });
  129. "otp generated".postln;
  130. if(genShadowArray0, {
  131. var file;
  132. //gen first shadow array
  133. shadowArray0 = ~genShadowArray0.value(secrets, otp);
  134. //write first shadow array
  135. file = File((path +/+ "/shadow_data_0.txt".standardizePath), "w");
  136. file.write(shadowArray0.asCompileString);
  137. file.close
  138. }, {
  139. //read first shadow array
  140. shadowArray0 = File.readAllString((path +/+ "/shadow_data_0.txt").standardizePath).interpret;
  141. });
  142. "shadow0 generated".postln;
  143. if(genShadowArray1, {
  144. var file;
  145. //gen second shadow array
  146. shadowArray1 = ~genShadowArray1.value(otp, shadowArray0.size, shadowArray0.size);
  147. //write second shadow array
  148. file = File((path +/+ "/shadow_data_1.txt".standardizePath), "w");
  149. file.write(shadowArray1.asCompileString);
  150. file.close
  151. }, {
  152. //read second shadow array
  153. shadowArray1 = File.readAllString((path +/+ "/shadow_data_1.txt").standardizePath).interpret;
  154. });
  155. "shadow1 generated".postln;
  156. if(genIMGData, {
  157. shadowImg0 = ~genShadowImage.value(shadowArray0);
  158. shadowImg1 = ~genShadowImage.value(shadowArray1);
  159. });
  160. if(writeIMGs, {
  161. shadowImg0.write((path +/+ "/shadow_img_0_final.png").standardizePath , quality: 100);
  162. shadowImg1.write((path +/+ "/shadow_img_1_final.png").standardizePath , quality: 100);
  163. });
  164. "imgs generated".postln;
  165. if(visualize, {
  166. ~visualize.value([shadowImg0, shadowImg1]);
  167. });
  168. };
  169. )
  170. (
  171. ~genVisualCrypto.value(
  172. dir: ~dir,
  173. seed: ~seed,
  174. genTilings: false,
  175. genSecrets: false,
  176. genOTP: false,
  177. genShadowArray0: false,
  178. genShadowArray1: true,
  179. genIMGData: true,
  180. writeIMGs: true,
  181. visualize: false
  182. )
  183. )
  184. (
  185. ~genVisualCrypto.value(
  186. dir: ~dir,
  187. seed: ~seed,
  188. genTilings: true,
  189. genSecrets: true,
  190. genOTP: true,
  191. genShadowArray0: true,
  192. genShadowArray1: true,
  193. genIMGData: true,
  194. writeIMGs: true,
  195. visualize: false
  196. )
  197. )
  198. (
  199. ~genVisualCrypto.value(
  200. dir: ~dir,
  201. seed: ~seed,
  202. genTilings: false,
  203. genSecrets: false,
  204. genOTP: false,
  205. genShadowArray0: false,
  206. genShadowArray1: true,
  207. genIMGData: true,
  208. writeIMGs: true,
  209. visualize: false
  210. )
  211. )
  212. ~ammannTiling.flat.asSet.postln
  213. ///////////////////////// older code for examples
  214. ~visualize.value(~berger.value(5, 5), 0, 0, scale: 6, name: "berger")
  215. ~visualize.value(~berger.value(20, 15), 0, 0, scale: 6, name: "berger")
  216. ~visualize.value(~berger.value(48, 36), 0, 0, scale: 10, name: "berger")
  217. ~visualize.value(~berger.value(48 * 2, 36 * 2), 0, 0, scale: 5, name: "berger")
  218. ~visualize.value(~robinsonTiling, 0, 0, 48, 36, scale: 10, name: "robinson");
  219. ~visualize.value(~robinsonTiling, 0, 0, 48 * 2, 36 * 2, scale: 5, name: "robinson");
  220. ~visualize.value(~penrose.value(50), 0, 0, 48, 36, scale: 10, name: "penrose");
  221. ~visualize.value(~penrose.value(100), 0, 0, 48 * 2, 36 * 2, scale: 5, name: "penrose");
  222. ~visualize.value(~ammann.value(200, 100), 0, 0, 48, 36, scale: 10, name: "ammann")
  223. ~visualize.value(~ammann.value(200, 100), 0, 0, 48 * 2, 36 * 2, scale: 5, name: "ammann")
  224. ~visualize.value(~kari_culik.value(36, 48, 0, 5, true), 0, 0, scale: 10, name: "kari");
  225. ~visualize.value(~kari_culik.value(36 * 2, 48 * 2, 0, 5, true), 0, 0, scale: 5, name: "kari");
  226. ~visualize.value(~jaendel.value(8, 2, 0, 0), 20, 20, 48, 36, scale: 10, name: "jaendel");
  227. ~visualize.value(~jaendel.value(8, 2, 0, 0), 20, 20, 48 * 2, 36 * 2, scale: 5, name: "jaendel");
  228. ///////////////////////// length calculations
  229. 1356 / 60
  230. //approx. 22.5
  231. //6 sections
  232. 436 * 4 / 60
  233. //approx 19 - 29
  234. //10 sections
  235. 614 * 2 / 60
  236. //approx 20.5
  237. //20 sections
  238. 1385 / 60
  239. //approx 23
  240. //20 sections
  241. 915 / 50
  242. //approx 18 to 22
  243. //10 sections
  244. 270 * 4 / 90
  245. //approx 12
  246. //8 sections