columns2.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
  3. * http://www.trevorwishart.co.uk
  4. * http://www.composersdesktop.com
  5. *
  6. This file is part of the CDP System.
  7. The CDP System is free software; you can redistribute it
  8. and/or modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The CDP System is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the CDP System; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18. 02111-1307 USA
  19. *
  20. */
  21. #include <columns.h>
  22. void helpm(void),helpM(void),helpg(void),helpr(void),helpl(void),help(void);
  23. /********************************** HELPM **********************************/
  24. void helpm(void)
  25. {
  26. fprintf(stderr,
  27. " ------------------------ MATHEMATICAL OPERATIONS ---------------------------\n"
  28. "| g find Greatest | i find Intervals (MIDI) |\n"
  29. "| l find Least | im@ Multiply Intervals by @ |\n"
  30. "| t find Total | ia@ Add @ to Intervals |\n"
  31. "| p find Product | ra RAtios btwn succesive values |\n"
  32. "| M find Mean | iv generate Intermediate Values |\n"
  33. "| R[@] find Reciprocals (1/N) (<|>) | iL@ Limit Intervals to < max @ |\n"
  34. "| with @, find @/N | il@ Limit Intervals to > min @ |\n"
  35. "| a@ Add @ (<|>) | |\n"
  36. "| m@ Multiply by @ (<|>) | Ra@ Add Random value between +-@ |\n"
  37. "| d@ Divide by @ (<|>) | RA@ Add Random value between 0 & @ |\n"
  38. "| P@ +ve values to Power @ (<|>) | Rm@ Multiply by Randval between 0-@ |\n"
  39. "| | Rs@ Random Scatter[@=0-1] ascending |\n"
  40. "|(<|>) means these can apply to vals | vals over intervals between vals |\n"
  41. "| < or > threshold on command-line. | |\n"
  42. "| | s[@] Stack values from 0 (overlap @) |\n"
  43. "| A@ Approximate to multiplies of @ | sl@ Change Slope by factor @ |\n"
  44. "| fl@ ensure all vals >= floor-val @ | sd[@] Sum abs Differences (zigzag) |\n"
  45. "| li@ ensure all vals <= limit-val @ | (@=overlap e.g.splicelen) |\n"
  46. "| | so@ Sum, minus Overlaps |\n"
  47. "| THRESHOLD VALUE IS INDICATED BY an | @=overlap (e.g.splicelen) |\n"
  48. "| extra parameter on command line.. | sn@ Sum N-wise. N = @ |\n"
  49. "| e.g. {3 means <3 ; }7 means >7 | |\n"
  50. " -------------------- FOR FURTHER HELP TRY -l -M -g -R ----------------------\n");
  51. exit(1);
  52. }
  53. /************************************ HELPL ***********************************/
  54. void helpl(void)
  55. {
  56. fprintf(stderr,
  57. " ------------------------ LIST REORDER OR EDIT --------------------------\n"
  58. "| c Count vals (<||>threshold) | e@ Eliminate value @ (+-error) |\n"
  59. "| mg@ Mark values > @ | eg@ Eliminate vals Greater than @ |\n"
  60. "| ml@ Mark values < @ | el@ Eliminate vals Less than @ |\n"
  61. "| cl Count lines | ed@ Eliminate Duplicates |\n"
  62. "| o Order list | within range @ |\n"
  63. "| rr Reverse list | ee Eliminate Even items |\n"
  64. "| Ro[@] Randomise Order (X@) | Re@ Eliminate @ items at Random |\n"
  65. "| dl@ Duplicate List @ times | bg@ Vals > @ reduced to Bound @ |\n"
  66. "| dv@ Duplicate each Val @ times | bl@ Vals < @ raised to Bound @ |\n"
  67. "| | N@ partitioN to @ files,in blocks |\n"
  68. "| sk@ get 1 value & SKip @ | Nr@ partitioN to @ fils,in rotation|\n"
  69. "| sK@ get @ values, SKip 1 | C Concatenate files |\n"
  70. "| cc columnate | |\n");
  71. fprintf(stderr,
  72. "| As Alphabetic Sort | S@ Separate @ columns to @ files |\n"
  73. "| F@ Format vals in @ cols | J Join as columns in 1 file |\n"
  74. "| s[@] Stack values from 0 | I Interleave: columns->list |\n"
  75. "| (overlap @) | E[@] vals End to End in 2 columns |\n"
  76. "| Mr[@] Avoid midi-pitch-class | (@ = column2 overshoot of |\n"
  77. "| repetition (within @ notes)| next value in column 1) |\n"
  78. "| fr[@] Avoid frq-pitch-class | v[@] rank by VOTE: ie. by no. of |\n"
  79. "| repetition (within @ notes)| times each number(+-@) occurs |\n"
  80. "| ir@ Repeat Intervals @ times | V@ rank frqs by VOTE |\n"
  81. "| starting from last entry | @ = semitone range for equalfrq|\n"
  82. "| F@ format in @ columns | G@ reGROUP: take every @th item |\n"
  83. "| | from 0, then ditto from 1 etc. |\n"
  84. "| THRESHOLD IS EXTRA PARAM ON CMDLINE... E.G. {3 MEANS <3 ; }7 MEANS >7 |\n"
  85. " ------------------ FOR FURTHER HELP TRY -m -M -g -R --------------------\n");
  86. exit(1);
  87. }
  88. /*********************************** HELPM ***********************************/
  89. void helpM(void)
  90. {
  91. fprintf(stderr,
  92. " ---------------------------- MUSICAL OPERATIONS ----------------------------\n"
  93. "| Mh MIDI to Hz | sd[@] Sum abs Differences (zigzag) |\n"
  94. "| Mt MIDI to Text | (@=overlap e.g. splicelen) |\n"
  95. "| hM hz to MIDI | sl@ Change slope by factor @ |\n"
  96. "| tM Text to MIDI | so@ Sum, minus Overlaps: @=overlap |\n"
  97. "| th Text to Hz | (e.g.splicelen) |\n"
  98. "| | Mm@ Major->Minor,(MIDI) @ = key |\n"
  99. "| q@ Quantise over @ | mM@ Minor->Major,(MIDI) @ = key |\n"
  100. "| i get Intervals (e.g. MIDI) | TM[@] Temper MIDI data. (With @, to a |\n"
  101. "| Ir Interval(semitones)-> frqratio| @-note equal-tempered scale |\n"
  102. "| ra RAtios between succesive vals | based on concert-C) |\n"
  103. "| iM motivically-Invert MIDI | Th[@] Temper Hz data. (With @, to a |\n"
  104. "| ih motivically-Invert Hz | @-note equal-tempered scale |\n"
  105. "| rm@ motivically-ROtate by @ | based on concert-C) |\n");
  106. fprintf(stderr,
  107. "| B plain Bob : 8 bells | do@ Duplicate vals at @ Octaves |\n"
  108. "| At@ Accel Time-seq from event- | (MIDI) |\n"
  109. "| -separation val1 in file | dO@ Duplicate vals at @ Octaves |\n"
  110. "| to val2 in file, total dur @ | (FREQUENCIES) |\n"
  111. "| (optional: starttime val3) | Mr[@] Avoid midi-pitchclass repeats |\n"
  112. "| Tc@ times from crotchet count | (within @ notes) |\n"
  113. "| in file, and tempo @ | fr[@] Avoid frq-pitchclass repeats |\n"
  114. "| Tl@ Times from crotchet lengths | (within @ notes) |\n"
  115. "| H@ Generate @ Harmonics | V@ rank frqs by VOTE |\n"
  116. "| Hr@ Generate @ Subharmonics | (no. of occcurences) |\n"
  117. "| Hg[@] Group frqs as Harmonics: | @ = semitone range within which |\n"
  118. "| @=tuning tolerance (semitones)| frqs judged to be equivalent |\n"
  119. "| (default .01) | td@ Take set of snd-durations and |\n"
  120. "| Ad@ Accel Durations from val1 to | produce list of start-times, to |\n"
  121. "| val2 in file, with total dur @| give density of @ snds always. |\n"
  122. "| DB convert dB levels to gain vals| st@ sample to time (@ = srate) |\n"
  123. "| db convert gain levels to dB | |\n"
  124. " -------------------- FOR FURTHER HELP TRY -m -l -g -R ----------------------\n");
  125. exit(1);
  126. }
  127. /**************************************** HELPG *****************************/
  128. void helpg(void)
  129. {
  130. fprintf(stderr,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  131. " -------------------------- GENERATIVE OPERATIONS --------------------------\n",
  132. "| Rg Generate Random 0s & 1s | |\n",
  133. "| (number of items, in infile) | ic@ Create @ Intervals, size of |\n",
  134. "| Rv@ generate @ Random Values | (1) value in file |\n",
  135. "| (maxmin values in infile) | i=@ Equal Intervals of @ between |\n",
  136. "| Rc@ Chop @ to Randomsize chunks | 2 values in file |\n",
  137. "| (maxmin chunklens in infile) | D@ @ equal Divisions between |\n",
  138. "| | 2 values in file |\n",
  139. "| iv gen Intermediate Values | L@ @ Log-equal divisions between |\n",
  140. "| | 2 +ve values in file |\n",
  141. "| dv@ Duplicate each Val @ times | Q@ @ Quadratic-curve steps btwn |\n",
  142. "| dl@ Duplicate List @ times | 2 vals in file, where val3 is |\n",
  143. "| ir@ Repeat Intervals @ times, | curvature(>0): <1 down: >1 up |\n",
  144. "| starting from last entry | |\n",
  145. "| | |\n",
  146. "| At@ Accel Time-seq from event- | B plain Bob : 8 bells |\n",
  147. "| -separation val1 in file, to | |\n",
  148. "| val2 in file, total dur @ | |\n",
  149. "| (optional: starttime val3) | |\n",
  150. "| | |\n",
  151. "| Ad@ Accel Durations from val1 to | |\n",
  152. "| val2 in file, in total dur @ | |\n",
  153. " ------------------- FOR FURTHER HELP TRY -m -M -l -R ---------------------\n");
  154. exit(1);
  155. }
  156. /********************************** HELPR ***********************************/
  157. void helpr(void)
  158. {
  159. fprintf(stderr,"%s%s%s%s%s%s%s%s%s%s%s%s",
  160. " ---------------------------- RANDOM OPERATIONS ---------------------------\n",
  161. "| | |\n",
  162. "| Ro[@] Randomise Order | Rc@ Chop @ to Randchunks |\n",
  163. "| (& again, @ times) | (maxmin chunklens in infile) |\n",
  164. "| | Rg Generate random 0s & 1s |\n",
  165. "| Ra@ Add Randval between +-@ | (number of items, in infile) |\n",
  166. "| RA@ Add Randval between 0 & @ | Rv@ Gen @ random Values |\n",
  167. "| Rm@ Multiply by Randval btwn 0-@ | (maxmin vals in infile) |\n",
  168. "| Rs@ Scatter[@=0-1] ascending vals | |\n",
  169. "| over intervals between vals | Re@ Eliminate @ items at Random |\n",
  170. "| | |\n",
  171. " -------------------- FOR FURTHER HELP TRY -m -M -l -g --------------------\n");
  172. exit(1);
  173. }
  174. /******************************* HELP *******************************/
  175. void help(void)
  176. {
  177. fprintf(stderr,
  178. "a@ .... Add @ l ..... find LEAST\n"
  179. "A@ .... Approx to multiples of @ li@ ....LIMIT values to <=@\n"
  180. "At@ ... ACCELERATING TIME-seq M ..... find MEAN\n"
  181. "Ad@ ... ACCELERATING DURATIONS m@ .... MULTIPLY by @\n"
  182. "As .... ALPHABETIC SORT mg@ ... MARK values > @\n"
  183. "B ..... plain BOB (bell-ringing) Mr[@].. MIDI-pitchclass-REPETS avoided.\n"
  184. "bg@ ... Vals >@ reduced to BOUND @ Mh .... MIDI to HZ\n"
  185. "bl@ ... Vals <@ increased to BOUND @ ml@ ... MARK values < @\n"
  186. "C ..... CONCATENATE Mm@ ... MAJOR->MINOR (MIDI) in key @\n"
  187. "c ..... COUNT vals cc...COLUMNATE Mt .... MIDI to TEXT\n"
  188. "cl .... COUNT LINES mM@ ... MINOR->MAJOR (MIDI) in key @\n"
  189. "D@ .... @ equal DIVISIONS btwn 2 vals N@ .... partitioN -> @ files, in blocks\n"
  190. "DB .... DB values to gain vals Nr@ ....partN-> @ files, in rotation\n"
  191. "d@ .... DIVIDE by @ o ..... ORDER list\n"
  192. "db .... gain vals to DB values P@ .... +ve vals raised to POWER\n"
  193. "dl@ ... DUPLICATE LIST @ times p ..... find PRODUCT\n"
  194. "do@ ... DUPL LIST at @ OCTAVES (MIDI) Q@ ..@ QUADRATIC-curve steps btwn vals.\n"
  195. "dO@ ... DUPL LIST at @ OCTAVES (FRQS) q@ .... QUANTISE over @\n"
  196. "dv@ ... DUPLICATE each VALUE @ times R[@]... find RECIPROCALS\n"
  197. "E[@] .. vals END to END in 2 cols RA@ ... RANDVAL ADDED\n"
  198. "e@ .... ELIMINATE value Ra@ ... RANDVAL +- ADDED\n"
  199. "ed@ ... ELIMINATE DUPLICATES ra .... RATIOS betwn vals\n"
  200. "ee .... ELIMINATE EVEN items Rc@ ... cut @ into RANDOM CHUNKS\n"
  201. "eg@ ... ELIMINATE vals > @ Re@ ... RANDOMLY ELIMINATE items\n"
  202. "el@ ... ELIMINATE vals < @ Rg ... RANDOM GEN of 0s & 1s\n"
  203. "fr[@].. FRQ pitchclass REPETS avoided Rm@ ... MULTIPLY by RAND\n"
  204. "F@ .... FORMAT in @ columns rm@ ... motivic-ROTATE\n"
  205. "fl@ ... FLOOR vals to >=@ Ro[@].. RANDOMISE ORDER\n"
  206. "g ..... find GREATEST rr..... REVERSE list\n"
  207. "G@ .... GROUP @th items, cyclically Rs@ ... RANDOM SCATTER vals\n");
  208. fprintf(stderr,
  209. "hM .... HZ to MIDI Rv@ ... generate RAND VALS\n"
  210. "H@ .... Generate HARMONICS S@ .....SEPARATE cols->files\n"
  211. "Hr@ ... Gen HARMONIC ROOTS (subharms) s[@] .. STACK vals from 0\n"
  212. "Hg[@].. GROUP freqs as HARMONICS. sd[@]...SUM abs DIFFERENCES\n"
  213. "I ..... INTERLEAVE sK@ ... get @ vals,SKIP 1\n"
  214. "Ir .... INTERVAL(semitones)->frqRATIO sk@ ... get 1 val, SKIP @\n"
  215. "i ..... get INTERVALS sl@ ... change slope by factor @\n"
  216. "i=@ ... create EQUAL INTVLS of @ sn@ ... SUM N-WISE. N = @\n"
  217. "ia@ ... ADD @ to INTERVALS so@ ... SUM,minus OVERLAPS\n"
  218. "ic@ ... CREATE @ INTERVALS st@ ... SAMPLE-CNT to TIME\n"
  219. "ih .... motiv-INVERT HZ t ..... find TOTAL\n"
  220. "iL@ ....LIMIT INTERVALS to < max @ Tc@ ... TEMPO with beatCOUNT ->time\n"
  221. "il@ ....LIMIT INTERVALS to > min @ td@ ... Time density in @ layers.\n"
  222. "iM .... motiv-INVERT:MIDI Th[@].. TEMPER HZ data\n"
  223. "im@ ... INTERVALS, MULTIPLIED th .... TEXT to HZ\n"
  224. "ir@ ... INTERVS, REPEATED Tl@ ... TEMPO & beatLENGTHS ->time\n"
  225. "iv .... INTERMEDIATE VALS TM[@].. TEMPER MIDI data\n"
  226. "J ..... JOIN as columns tM .... TEXT to MIDI\n"
  227. "L@ .... LOG-equal divisions v[@] .. rank by VOTE(no of times occurs)\n"
  228. " V@ ..rank frqs by VOTE(@-semitone steps)\n");
  229. exit(1);
  230. }