Browse Source

initial commit

richarddobson 3 years ago
parent
commit
446e4c0763
76 changed files with 10978 additions and 0 deletions
  1. 416 0
      dev/include/arrays.h
  2. 40 0
      dev/include/bitflags.h
  3. 38 0
      dev/include/blur.h
  4. 65 0
      dev/include/cdpar.h
  5. 78 0
      dev/include/cdparams.h
  6. 151 0
      dev/include/cdpmain.h
  7. 32 0
      dev/include/cdpstate.h
  8. 382 0
      dev/include/columns.h
  9. 36 0
      dev/include/combine.h
  10. 169 0
      dev/include/conditions.h
  11. 27 0
      dev/include/dircdp.h
  12. 70 0
      dev/include/distcon.h
  13. 32 0
      dev/include/distort.h
  14. 86 0
      dev/include/distort1.h
  15. 58 0
      dev/include/edit.h
  16. 35 0
      dev/include/envel.h
  17. 48 0
      dev/include/envel1.h
  18. 102 0
      dev/include/envlcon.h
  19. 67 0
      dev/include/extdcon.h
  20. 32 0
      dev/include/extend.h
  21. 52 0
      dev/include/extend1.h
  22. 142 0
      dev/include/filetype.h
  23. 124 0
      dev/include/filtcon.h
  24. 32 0
      dev/include/filters.h
  25. 38 0
      dev/include/filters1.h
  26. 292 0
      dev/include/flags.h
  27. 34 0
      dev/include/fmnts.h
  28. 36 0
      dev/include/focus.h
  29. 52 0
      dev/include/formants.h
  30. 414 0
      dev/include/globcon.h
  31. 48 0
      dev/include/graicon.h
  32. 32 0
      dev/include/grain.h
  33. 45 0
      dev/include/grain1.h
  34. 30 0
      dev/include/headread.h
  35. 48 0
      dev/include/hfperm.h
  36. 35 0
      dev/include/highlight.h
  37. 133 0
      dev/include/house.h
  38. 39 0
      dev/include/localcon.h
  39. 102 0
      dev/include/logic.h
  40. 52 0
      dev/include/menuno.h
  41. 34 0
      dev/include/mix.h
  42. 84 0
      dev/include/mix1.h
  43. 98 0
      dev/include/mixxcon.h
  44. 686 0
      dev/include/modeno.h
  45. 146 0
      dev/include/modicon.h
  46. 32 0
      dev/include/modify.h
  47. 72 0
      dev/include/modify1.h
  48. 31 0
      dev/include/morph.h
  49. 216 0
      dev/include/otherfile.h
  50. 27 0
      dev/include/paudition.h
  51. 37 0
      dev/include/pitch.h
  52. 1621 0
      dev/include/pnames.h
  53. 414 0
      dev/include/processno.h
  54. 42 0
      dev/include/pvoc.h
  55. 35 0
      dev/include/repitch.h
  56. 269 0
      dev/include/science.h
  57. 126 0
      dev/include/sfdump.h
  58. 33 0
      dev/include/simple.h
  59. 36 0
      dev/include/sndinfo.h
  60. 251 0
      dev/include/speccon.h
  61. 154 0
      dev/include/special.h
  62. 34 0
      dev/include/specinfo.h
  63. 32 0
      dev/include/specpinfo.h
  64. 63 0
      dev/include/srates.h
  65. 1137 0
      dev/include/standalone.h
  66. 33 0
      dev/include/strange.h
  67. 30 0
      dev/include/stretch.h
  68. 586 0
      dev/include/structures.h
  69. 55 0
      dev/include/synth.h
  70. 32 0
      dev/include/texture.h
  71. 113 0
      dev/include/texture1.h
  72. 228 0
      dev/include/tkglobals.h
  73. 204 0
      dev/include/txtucon.h
  74. 27 0
      dev/include/utils.h
  75. 186 0
      dev/include/vowels.h
  76. 30 0
      dev/include/vowels2.h

+ 416 - 0
dev/include/arrays.h

@@ -0,0 +1,416 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+        /*******@@@@@@@@@@@@@@****** ARRAY NAMES ********@@@@@@@@@@@@@@********/
+
+/************************* (double) VARIABLE ARRAY NAMES **********************/
+
+/*************** SPEC ***********/
+
+#define ARPE_TAB                        (0)
+
+#define CHORU_RTABA                     (0)
+#define CHORU_RTABF                     (1)
+
+#define GLIDE_INF                       (0)
+
+#define INV_AMPRATIO            (0)
+
+#define MPH_COS                         (0)     /* morph */
+
+#define OCTVU_ENERGY            (0)
+
+#define PA_AVPICH                       (0)     /* p_approx */
+
+#define PI_INTMAP                       (0)     /* p_invert */
+
+#define PQ_QSET                         (0)     /* p_quantise */
+
+#define PV_SIN                          (0)     /* p_vibrato */
+
+#define PW_BRK                          (0)     /* p_write */
+
+#define PEAK_BAND                       (0)     /* peak */
+#define PEAK_MAXI                       (1)
+
+#define PICH_PRETOTAMP          (0)     /* pitch && track */
+#define PICH_PBRK                       (1)
+
+#define PICH_SPEC                       (0)
+
+#define RP_TBRK                         (0)     /* repitch */
+
+#define SHIFT_CHTOP             (0)
+#define SHIFT_CHMID             (1)
+
+#define TSTR_PBUF                       (0)
+#define TSTR_QBUF                       (1)
+/* the 2 above are also names for bufptrs  */
+/* the 1 below is ONLY a name for a bufptr */
+#define TSTR_PEND                       (2)
+
+#define WARP_P2                         (0)
+#define WARP_AVP                        (1)
+
+#define WAVER_CHFBOT            (0)
+
+/* DISTORT */
+#define DISTORT_SIN                     (0)
+
+/* DISTORT_ENV */
+#define DISTORTE_ENV            (0)     /* array AND ptr */
+#define DISTORTE_ENVEND         (1)     /* ptr only */
+
+/* DISTORT_HRM */
+#define DISTORTH_AMP            (0)
+
+#define ENV_CREATE_INTIME       (0)
+#define ENV_CREATE_INLEVEL      (1)
+#define ENV_CREATE_TIME         (2)
+#define ENV_CREATE_LEVL         (3)
+
+/* ENVEL */
+#define ENV_SINETAB                     (0)
+
+/* ZIGZAG : LOOP */
+#define ZIGZAG_SPLICE           (0)
+
+/* DRUNKWALK */
+#define DRNK_SPLICETAB          (0)
+
+/* FILTERS */
+#define FLT_FRQ                         (0)
+#define FLT_AMP                         (1)
+#define FLT_AMPL                        (2)
+#define FLT_A                           (3)
+#define FLT_B                           (4)
+#define FLT_Y                           (5)
+#define FLT_Z                           (6)
+#define FLT_D                           (7)
+#define FLT_E                           (8)
+#define FLT_COSW                        (9)
+#define FLT_SINW                        (10)
+#define FLT_WW                          (11)
+
+#define FLT_FBRK                        (12)
+#define FLT_INAMP                       (13)
+#define FLT_INFRQ                       (14)
+#define FLT_LASTFVAL            (15)
+#define FLT_LASTAVAL            (16)
+#define FLT_FINCR                       (17)
+#define FLT_AINCR                       (18)
+
+#define FLT_HBRK                        (19)
+#define HARM_FRQ_CALC           (20)
+#define HARM_AMP_CALC           (21)
+
+/* FSTATVAR, FLTSWEEP */
+#define FLT_DLS                         (0)
+#define FLT_DBS                         (1)
+#define FLT_DHS                         (2)
+#define FLT_DNS                         (3)
+
+/* EQ */
+#define FLT_XX1                         (0)
+#define FLT_XX2                         (1)
+#define FLT_YY1                         (2)
+#define FLT_YY2                         (3)
+
+/* ALLPASS */
+#define FLT_DELBUF1                     (0)
+#define FLT_DELBUF2                     (1)
+
+/* LPHP */
+/*RWD 4:2000 redefined to deal with nchan files */
+#define FLT_DEN1                        (0)
+#define FLT_DEN2                        (1)
+#define FLT_CN                          (2)
+
+#ifdef NOTDEF
+#define FLT_S1                          (3)
+#define FLT_S2                          (4)
+#define FLT_E1                          (5)
+#define FLT_E2                          (6)
+#define FLT_S1S                         (7)
+#define FLT_E1S                         (8)
+#define FLT_S2S                         (9)
+#define FLT_E2S                         (10)
+#else
+#define FLT_S1_BASE                     (3)
+#define FLT_S2_BASE                     (4)
+#define FLT_E1_BASE                     (5)
+#define FLT_E2_BASE                     (6)
+#define FLT_LPHP_ARRAYS_PER_FILTER (4)
+#endif
+/* GRAIN */
+#define GR_ENVEL                        (0)
+#define GR_ENVSTEP                      (1)
+#define GR_SPLICETAB            (2)
+
+/* GRAIN REPITCH, RERHYTHM, REMOTIF */
+#define GR_RATIO                        (3)
+
+/* GRAIN REPOSITION, FIND & ALIGN */
+#define GR_SYNCTIME                     (3)
+
+/* SYNC */
+#define MSY_TIMESTOR            (0)
+#define MSY_STARTSRCH           (1)
+#define MSY_ENDSRCH                     (2)
+
+/* MIX TIMEWARP */
+#define MTW_TIMESTOR            (0)
+#define MTW_TIMEDIFF            (1)
+
+/* MIX SPACEWARP */
+#define MSW_TIMESTOR            (0)
+
+/* MIX GAIN */
+#define MIX_LLEVELSTOR          (0)
+#define MIX_RLEVELSTOR          (1)
+
+/* MIX MERGE */
+#define MCR_COSTABLE            (0)
+
+/* BRASSAGE & SAUSAGE */
+#define GRS_BSPLICETAB          (0)
+#define GRS_ESPLICETAB          (1)
+#define GRS_NORMFACT            (2)
+
+/* TEXTURE */
+#define TEX_PITCHES                     (0)
+
+/* MODIFY */
+#define VIB_SINTAB                      (0)
+#define DELAY_BUF                       (0)
+
+#define STAD_TDELAY                     (0)
+#define STAD_GAIN                       (1)
+#define STAD_PAN                        (2)
+#define STAD_GAINL                      (3)
+#define STAD_GAINR                      (4)
+
+#define SCRUB_SIN                       (0)
+#define SCRUB_READTAB           (1)
+
+#define RM_SINTAB                       (0)
+                /* EDIT JOIN */
+#define SPLICE_UP                       (0)
+#define SPLICE_DN                       (1)
+
+                /* SYNTH */
+#define SYNTH_TAB                       (0)
+
+                /* UTILS */
+#define COL                                     (0)
+
+/************************ INTEGER VARIABLE ARRAY NAMES **************************/
+
+/*** SPEC *****/
+
+#define ARPE_KEEP                       (0)
+
+#define CL_MARK                         (0)  /* clean */
+
+#define FRZ_TIMETYPE            (0)
+
+#define GLIDE_ZERO                      (0)
+
+#define OCTVU_CHBTOP            (0)
+#define OCTVU_CHBBOT            (1)
+
+#define PA_CHANGE                       (0)     /* p_approx */
+
+#define SCAT_KEEP                       (0)
+
+#define SHIFT_OVER              (0)
+#define SHIFT_DONE              (1)
+
+#define SHUF_MAP                        (0)
+
+#define TUNE_LOUD                       (0)
+
+#define WARP_CHANGE                     (0)
+
+#define WEAVE_WEAV                      (0)
+
+#define MEAN_LOC1                       (0)
+#define MEAN_LOC2                       (1)
+
+/* DISTORT_HRM */
+#define DISTORTH_HNO            (0)
+
+/* DISTORT_SHUF */
+#define DISTORTS_MAP            (0)
+
+/* ENVEL */
+#define ENV_SLOPETYPE           (0)
+
+/* LOOP : SCRAMBLE */
+#define ZIGZAG_PLAY                     (0)
+
+/* SCRAMBLE */
+#define SCRAMBLE_PERM           (1)
+
+/* GRAIN REORDER only */
+#define GR_REOSET                       (0)
+
+/* MIX SYNC */
+#define MSY_CHANS                       (0)
+#define MSY_ENVPOS                      (1)
+
+/* BRASSAGE & SAUSAGE */
+#define GRS_FLAGS                       (0)
+/* SAUSAGE */
+#define SAUS_PERM                       (1)
+
+/* TEXTURE */
+#define TXPERMINDEX             (0)
+#define TXPERMLEN               (1)
+#define TXLASTPERMLEN           (2)
+#define TXLASTPERMVAL           (3)
+#define TXREPETCNT                      (4)
+#define TXRPT                           (5)
+
+/* MOD_RADICAL */
+#define SHR_PERM                        (0)
+
+/************************** LONG VARIABLE ARRAY NAMES ****************************/
+
+/**** SPEC *****/
+
+#define FRZ_SEGTIME                     (0)
+#define FRZ_FRZTIME                     (1)
+
+#define PICK_BFLG                       (0)
+
+#define PLUK_BFLG                       (0)
+
+/* DISTORT_AVG */
+#define DISTORTA_CYCLEN         (0)
+#define DISTORTA_STARTCYC       (1)
+
+/* DISTORT_FRC */
+#define DISTORTF_CYCLEN         (0)
+#define DISTORTF_STARTCYC       (1)
+
+/* DISTORT_SHUF */
+#define DISTORTS_STARTCYC       (0)
+
+/* DISTORT_DEL */
+#define DISTDEL_STARTCYC        (0)
+#define DISTDEL_CYCLEVAL        (1)
+
+/* DISTORT_RPL */
+#define DISTRPL_STARTCYC        (0)
+#define DISTRPL_CYCLEVAL        (1)
+
+/* DISTORT_TEL */
+#define DISTTEL_STARTCYC        (0)
+#define DISTTEL_CYCLEVAL        (1)
+
+/* ZIGZAG : LOOP : SCRAMBLE */
+#define ZIGZAG_TIMES            (0)
+
+/* SCRAMBLE */
+#define SCRAMBLE_CHUNKPTR       (1)
+#define SCRAMBLE_CHUNKLEN       (2)
+
+/* FILTERS */
+#define FLT_SAMPTIME            (0)
+
+/* GRAIN REORDER */
+#define GR_ARRAYLEN                     (0)
+#define GR_THIS_LEN                     (1)
+
+/* GRAIN REVERSE */
+#define GR_ABS_POS                      (0)
+
+/* MIX SYNC */
+#define MSY_PEAKSAMP            (0)
+#define MSY_SAMPSIZE            (1)
+#define MSY_ENVEL                       (2)
+
+/* BRASSAGE & SAUSAGE */
+#define GRS_LBUF                        (0)
+#define GRS_LBUFEND                     (1)
+#define GRS_LBUFMID                     (2)
+#define GRS_LTAILEND            (3)
+
+/* MOD_REVECHO */
+#define STAD_DELAY                      (0)
+
+/* MOD_RADICAL */
+#define SHR_CHUNKPTR            (0)
+#define SHR_CHUNKLEN            (1)
+
+/* EDIT EXCISE(MANY) */
+#define CUT_STTSAMP                     (0)
+#define CUT_STTSPLI                     (1)
+#define CUT_ENDSAMP                     (2)
+#define CUT_ENDSPLI                     (3)
+
+/* HOUSE EXTRACT */
+#define CUTGATE_STIME           (0)
+#define CUTGATE_ETIME           (1)
+
+/************************* EXTRA SHORT BUFS **********************/
+
+/* ZIGZAG */
+#define ZIGZAG_SPLBUF           (0)
+
+/************************* INTERNAL POINTERS (dz->ptr) ***********************/
+
+/* GRAIN */
+#define GR_GATEVALS                     (0)
+#define GR_GATEBRKEND           (1)
+#define GR_ENVEND               (2)
+#define GR_ESTEPEND             (3)
+
+/************* FLOAT ARRAY NAMES FOR SPEC PITCH, TRACK, and P_HEAR ****************/
+
+#define CHBOT                           (0)
+#define TESTPAMP                        (1)
+#define TOTPAMP                         (2)
+
+#define SIN_TABLE                       (0)
+
+#define STACK_TRANS                     (0)
+#define STACK_AMP                       (1)
+
+/************* FLOAT ARRAY NAMES FOR SHUDDER ****************/
+
+#define SHUD_TIMES                      (0)
+#define SHUD_LEVEL                      (1)
+#define SHUD_WIDTH                      (2)
+#define SHUD_DEPTH                      (3)
+#define SHUD_ENV0                       (4)
+#define SHUD_ENV1                       (5)
+
+/*TW March 2004 */
+/* ENVSYN */
+#define ENVSYN_ENV                      (0)     /* array AND ptr */
+#define ENVSYN_ENVEND           (1)     /* ptr only */

+ 40 - 0
dev/include/bitflags.h

@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define CANCEL_ONE_FILE_OPTIONS_0       (1548)
+#define CANCEL_ONE_FILE_OPTIONS_1       (2013295616)
+#define CANCEL_ONE_FILE_OPTIONS_2       (2035)
+#define CANCEL_ONE_FILE_OPTIONS_3       (-133169152)
+#define CANCEL_ONE_FILE_OPTIONS_4       (25690623)
+#define CANCEL_ONE_FILE_OPTIONS_5       (3840)
+#define CANCEL_ONE_FILE_OPTIONS_6       (128)
+
+#define DEFUSE_REPITCH                          (134217728)
+
+TRNSP
+TRSNF
+
+If (mode!=TRNS_BIN)     VALID else NOT

+ 38 - 0
dev/include/blur.h

@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specavrg(dataptr dz);
+int  specsupr(dataptr dz);
+int  specchorus(dataptr dz);
+int  specnoise(dataptr dz);
+int  specscat(dataptr dz);
+int  specspread(dataptr dz);
+
+int  specdrunk(dataptr dz);
+int  specshuffle(dataptr dz);
+int  specweave(dataptr dz);

+ 65 - 0
dev/include/cdpar.h

@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define CHECKBUTTON                     (0)
+#define SWITCHED                        (1)
+#define LINEAR                          (2)
+#define LOG                                     (3)
+#define PLOG                            (4)
+#define FILE_OR_VAL                     (5)
+#define FILENAME                        (6)
+#define NUMERIC                         (7)
+#define GENERIC_FILENAME        (8)
+#define STRING_A                        (10)
+#define STRING_B                        (11)
+#define STRING_C                        (12)
+#define STRING_D                        (13)
+#define TIMETYPE                        (14)
+#define SRATE                           (15)
+#define TWOFAC                          (16)
+#define WAVETYPE                        (17)
+#define POWTWO                          (18)
+
+typedef struct applic *aplptr;
+
+int  cdparams(int process,int mode,int filetype,int infilesize,int insams,int srate,
+                int channels,int wanted,int wlength,int linecnt,float arate,float frametime,
+                double nyquist,double duration);
+int   parse_indata(int arc,char *argv[],int *process,int *mode,int *infilecnt,int *filetype,int *infilesize,
+                int *insams,int *srate,int *channels,int *wanted,int *wlength,int *linecnt,
+                float *arate,float *frametime,double *nyquist,double *duration);
+int  does_process_accept_conflicting_srates(int process);
+int  get_param_names(int process,int mode,int total_params,int user_params,aplptr ap);
+int  setup_flagnames(int process,int mode,int bare_flags,aplptr ap);
+int  establish_display(int process,int mode,int total_params,float frametime,double duration,aplptr ap);
+
+int  set_legal_param_structure(int application_no,int mode, aplptr ap);
+int      set_legal_option_and_variant_structure(int process,int mode,aplptr ap);
+int  deal_with_formants(int process,int mode,int channels,aplptr ap);
+int  deal_with_special_data(int process,int mode,int srate,double duration,double nyquist,int wlength,int channels,aplptr ap);
+int  get_param_ranges(int process,int mode,int total_params,double nyquist,float frametime,
+                float arate,int srate,int wlength,int insams,
+                int channels,int wanted,int filetype,int linecnt,double duration,aplptr ap);

+ 78 - 0
dev/include/cdparams.h

@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* floats version */
+#define CHECKBUTTON                     (0)
+#define SWITCHED                        (1)
+#define LINEAR                          (2)
+#define LOG                                     (3)
+#define PLOG                            (4)
+#define FILE_OR_VAL                     (5)
+#define FILENAME                        (6)
+#define NUMERIC                         (7)
+#define GENERIC_FILENAME        (8)
+#define STRING_A                        (10)
+#define STRING_B                        (11)
+#define STRING_C                        (12)
+#define STRING_D                        (13)
+#define TIMETYPE                        (14)
+#define SRATE                           (15)
+#define TWOFAC                          (16)
+#define WAVETYPE                        (17)
+#define POWTWO                          (18)
+#define MIDI                            (19)
+#define OCTAVES                         (20)
+#define CHORDSORT                       (21)
+#define DENSESORT                       (22)
+#define LOGNUMERIC                      (23)
+#define FILE_OR_VOWELS          (24)
+
+/*GNU doesn't like duplcate definitions */
+#ifndef _STRUCTURES_H_INCLUDED
+#error cdparams.h: requires structures.h
+#endif
+//typedef struct applic *aplptr;
+int  cdparams(int process,int mode,int filetype,int infilesize,int insams,int srate,
+                int channels,int wanted,int wlength,int linecnt,float arate,float frametime,
+                double nyquist,double duration);
+
+int   parse_indata(int argc,char *argv[],int *process,int *mode,int *infilecnt,int *filetype,int *infilesize,
+                int *insams,int *srate,int *channels,int *wanted,int *wlength,int *linecnt,
+                float *arate,float *frametime,double *nyquist,double *duration);
+
+int  set_legal_param_structure(int application_no,int mode, aplptr ap);
+int      set_legal_option_and_variant_structure(int process,int mode,aplptr ap);
+int  does_process_accept_conflicting_srates(int process);
+int  deal_with_formants(int process,int mode,int channels,aplptr ap);
+int  deal_with_special_data(int process,int mode,int srate,double duration,double nyquist,int wlength,int channels,aplptr ap);
+int  get_param_names(int process,int mode,int total_params,aplptr ap);
+int  get_param_ranges(int process,int mode,int total_params,double nyquist,float frametime,
+                float arate,int srate,int wlength,int insams,
+                int channels,int wanted,int filetype,int linecnt,double duration,aplptr ap);
+int  setup_flagnames(int process,int mode,int bare_flags,aplptr ap);
+
+void mp_message(int process,int mode);
+int  establish_display(int process,int mode,int total_params,float frametime,double duration,aplptr ap);

+ 151 - 0
dev/include/cdpmain.h

@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* floatsam version*/
+#define PRE_CMDLINE_DATACNT      (37)
+
+int     establish_datastructure(dataptr *dz);
+int     superfree(dataptr dz);
+int     get_process_and_mode_from_cmdline(int *cmdlinecnt,char ***cmdline,dataptr dz);
+int     usage(int argc,char *argv[]);
+int     usage1(void);
+int     usage2(char *);
+int     usage3(char *str1,char *str2);
+
+int     parse_tk_data(int argc,char *argv[],char ***cmdline,int *cmdlinecnt,dataptr dz);
+int     allocate_filespace(dataptr dz);
+int     setup_particular_application(dataptr dz);
+int     allocate_filespace(dataptr dz);
+int             set_legal_internalparam_structure(int process,int mode,aplptr ap);
+int             read_parameters_and_flags(char ***cmdline,int *cmdlinecnt,dataptr dz);
+int     read_special_data(char *str,dataptr dz);
+int     read_and_test_pitch_or_transposition_brkvals(FILE *fp,char *filename,
+                        double **brktable,int *brksize,int which_type,double minval,double maxval);
+int     convert_brkpntdata_to_window_by_window_array
+                        (double *brktable,int brksize,float **thisarray,int wlen,float timestep);
+int     convert_dB_at_or_below_zero_to_gain(double *val);
+void    out_of_range_in_brkfile(char *filename,double val,double loval,double hival);
+int     interp_val(double *val,double ttime,double *startoftab,double *endoftab,double **p);
+int     check_param_validity_and_consistency(dataptr dz);
+int     get_maxvalue_in_brktable(double *brkmax,int paramno,dataptr dz);
+int     get_minvalue_in_brktable(double *brkmin,int paramno,dataptr dz);
+int     convert_pch_or_transpos_data_to_brkpnttable(int *brksize,float *floatbuf,float frametime,int array_no,dataptr dz);
+
+int     groucho_process_file(dataptr dz);
+int     spec_process_file(dataptr dz);
+
+int     complete_output(dataptr dz);
+int     truncate_outfile(dataptr dz);
+int     write_exact_samps(float *buffer,int samps_to_write,dataptr dz);
+int     write_samps(float *bbuf,int samps_to_write,dataptr dz);
+int     write_samps_no_report(float *bbuf,int samps_to_write,int *samps_written,dataptr dz);
+int     write_samps_to_elsewhere(int ofd, float *buffer,int samps_to_write,dataptr dz);
+int     write_brkfile(FILE *fptext,int brklen,int array_no,dataptr dz);
+
+
+
+int     convert_pch_or_transpos_data_to_brkpnttable(int *brksize,float *floatbuf,
+                        float frametime,int array_no,dataptr dz);
+int     headwrite(int ofd,dataptr dz);
+
+int     create_sized_outfile(char *filename,dataptr dz);
+/*RWD.7.98  for sfsys98 */
+int     create_sized_outfile_formatted(const char *filename,int srate,int channels, int stype,dataptr dz);
+void    display_virtual_time(int value,dataptr dz);
+
+                /* groucho */
+int     reset(int i,int samples,float *bbuf,int *lastzero,/*int*/float *cyclemax);
+int     get_mixdata_in_line(int wordcnt,char **wordstor,int total_words,double *time,int *chans,
+                        double *llevel,double *lpan,double *rlevel,double *rpan,int filecnt,dataptr dz);
+int     finalise_and_check_mixdata_in_line(int wordcnt,int chans,
+                        double llevel,double *lpan,double *rlevel,double *rpan);
+int     create_sndbufs_for_envel(dataptr dz);
+/* RWD was byte_windowsize */
+int     generate_samp_windowsize(fileptr thisfile,dataptr dz);
+void    upsort(double *scti,int scatcnt);
+int     open_file_retrieve_props_open(int filecnt,char *filename,int *srate,dataptr dz);
+int     force_value_at_zero_time(int paramno,dataptr dz);
+int     establish_groucho_bufptrs_and_extra_buffers(dataptr dz);
+int     pvoc_preprocess(dataptr dz);
+int     pvoc_process(dataptr dz);
+int     pvoc_process_addon(unsigned int samps_so_far,dataptr dz);        /* was ~bytes~ */
+
+int     modspace_pconsistency(dataptr dz);
+int     modpitch_pconsistency(dataptr dz);
+int             modspace_preprocess(dataptr dz);
+int             scaledpan_preprocess(dataptr dz);
+int     create_delay_buffers(dataptr dz);
+int     create_stadium_buffers(dataptr dz);
+int             delay_preprocess(dataptr dz);
+int             do_delay(dataptr dz);
+int     stadium_pconsistency(dataptr dz);
+int     do_stadium(dataptr dz);
+int     create_shred_buffers(dataptr dz);
+int     shred_pconsistency(dataptr dz);
+int     shred_preprocess(dataptr dz);
+int     shred_process(dataptr dz);
+
+void    free_wordstors(dataptr dz);
+
+#define INITIALISE_DEFAULT_VALUES       initialise_param_values
+
+//int create_sized_outfile(char *filename,dataptr dz);
+int setup_param_ranges_and_defaults(dataptr dz);
+int handle_formants(int *cmdlinecnt,char ***cmdline,dataptr dz);
+int handle_formant_quiksearch(int *cmdlinecnt,char ***cmdline,dataptr dz);
+int handle_special_data(int *cmdlinecnt,char ***cmdline,dataptr dz);
+int read_formant_qksrch_flag(char ***cmdline,int *cmdlinecnt,dataptr dz);
+int do_housekeep_files(char *filename,dataptr dz);
+int check_repitch_type(dataptr dz);
+int exceptional_repitch_validity_check(int *is_valid,dataptr dz);
+int setup_brktablesizes(infileptr infile_info,dataptr dz);
+int store_filename(char *filename,dataptr dz);
+int store_further_filename(int n,char *filename,dataptr dz);
+int count_and_allocate_for_infiles(int argc,char *argv[],dataptr dz);
+int count_infiles(int argc,char *argv[],dataptr dz);
+int count_bundle_files(int argc,char *argv[],dataptr dz);
+void put_default_vals_in_all_params(dataptr dz);
+int make_initial_cmdline_check(int *argc,char **argv[]);
+int test_application_validity(infileptr infile_info,int process,int *valid,dataptr dz);
+int parse_infile_and_hone_type(char *filename,int *valid,dataptr dz);
+int set_chunklens_and_establish_windowbufs(dataptr dz);
+int setup_file_outname_where_ness(char *filename,dataptr dz);
+int set_special_process_sizes(dataptr dz);
+int copy_parse_info_to_main_structure(infileptr infile_info,dataptr dz);
+int allocate_filespace(dataptr dz);
+int handle_extra_infiles(char ***cmdline,int *cmdlinecnt,dataptr dz);
+int handle_outfile(int *cmdlinecnt,char ***cmdline,int is_launched,dataptr dz);
+int print_messages_and_close_sndfiles(int exit_status,int is_launched,dataptr dz);
+
+int     x(int y); /* TESTING ONLY */
+
+int pvoc_out(int floats_out,unsigned int *bytes_so_far,char *orig_outfilename,
+        char *root_outname, int jj, dataptr dz);
+
+int get_the_vowels(char *filename,double **times,int **vowels,int *vcnt,dataptr dz);
+int get_vowel (char *str);
+
+void insert_separator_on_sndfile_name(char *filename,int cnt);

+ 32 - 0
dev/include/cdpstate.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*******************************************************************************************
+ * CURRENT STATE OF CDP SYSTEM
+ *******************************************************************************************/
+
+//#define NO_DUPLICATE_SNDFILES         (1)
+//#define NO_FLOATFORMAT_SNDFILES (1)

+ 382 - 0
dev/include/columns.h

@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* header for columns */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <sfsys.h>
+#include <osbind.h>
+
+#if defined unix || defined __GNUC__
+#define round(x) lround((x))
+#endif
+
+#ifndef HUGE
+#define HUGE 3.40282347e+38F
+#endif
+
+#define PROG    "COLUMNS"
+
+#define BIGARRAY  200
+#define ODD(x)    ((x)&1)
+#define ENDOFSTR  '\0'
+#define FLTERR    0.000002
+#define ONEMAX    0.001         /* Upper limit on log(x)==1 */
+#define ONEMIN    0.999         /* Lower limit on log(x)==1 */
+#define TWELVE  12.0
+#define VERY_TINY (0.0000000000000000000000000000001)
+
+#define C_HZ              (8.175799)
+#define LOG_2_TO_BASE_E  (.69314718)
+#define HARMONIC_TUNING_TOLERANCE (.01) /* semitones */
+#define ONE_OVER_LN2  (1.442695)
+#define INVERT 1
+#define MULT 0
+#define ADD 1
+#define SUBTRACT 2
+#define ENVMAX   3
+#define MIDIMINFRQ (8.175799)
+#define MIDIMAXFRQ (12543.853951)
+
+#define MIDIMIN (0)
+#define MIDIMAX (127)
+
+#define MAXSAMP (32767.0)
+#define F_MAXSAMP (1.0)
+#define MAXOCTTRANS (12.0)
+
+extern int      cnt, firstcnt, arraysize, infilecnt, outfilecnt;
+extern double   *number, *permm, *permmm, factor, scatter, *pos;
+extern double   thresh;
+extern FILE     **fp;
+extern char     temp[20000], flag, *filename, *thisfilename, string[200];
+extern int      ro, ifactor, len, condit;
+
+extern char **strings;
+extern char     *stringstore;
+extern int      stringscnt;
+extern int      stringstoresize, stringstart;
+
+int     strgetfloat(char **,double  *), strgetstr(char **,char *);
+int     flteq(double,double);
+void    logo(void), qiksort(void), eliminate(int), usage(void);
+double  hztomidi(double), miditohz(double);
+char    *exmalloc(int), *exrealloc(char *,int);
+void    rndperm(double *), insert(double *,int, int), prefix(double *,int);
+void    multrndperm(double *), rndperm2(double *), shuffle(int,int);
+void    do_infile(char *), do_pitchtext_infile(char *), do_text_read(char *);
+void    do_outfile(char *), do_other_infiles(char *[]);
+void    bellperm1(void), bellperm2(void), bellperm3(void);
+void    swap(double *,double *);
+double  texttomidi(char *);
+char    *get_pitchclass(char *,int *,int);
+int     timevents(double,double,double,double);
+int     m_repos(int), f_repos(int);
+void    check_for_conditional(int *,char *[]);
+void do_stringline_infile_irreg(char *argv,int n);
+void    remove_frq_pitchclass_duplicates(void);
+void    count_items(char *);
+void    accel_time_seq(void);
+void    accel_durations(void);
+void    separate_columns_to_files(void);
+void    partition_values_to_files(void);
+void    join_files_as_columns(char *);
+void    join_many_files_as_columns(char *,int);
+void    concatenate_files(char *);
+void    concatenate_files_cyclically(char *);
+void    vals_end_to_end_in_2_cols(void);
+void    quantise(void);
+void    eliminate_equivalents(void);
+void    eliminate_even_items(void);
+void    eliminate_greater_than(void);
+void    eliminate_less_than(void);
+void    eliminate_duplicates(void);
+void    print_numbers(void);
+void    reduce_to_bound(void);
+void    increase_to_bound(void);
+void    greatest(void);
+void    least(void);
+void    mark_greater_than(void);
+void    mark_less_than(void);
+void    minor_to_major(void);
+void    add(void);
+void    take_power(void);
+void    temper_midi_data(void);
+void    temper_hz_data(void);
+void    time_from_crotchet_count(void);
+void    time_from_beat_lengths(void);
+void    total(void);
+void    text_to_hz(void);
+void    product(void);
+void    hz_to_midi(void);
+void    find_mean(void);
+void    midi_to_hz(void);
+void    major_to_minor(void);
+void    remove_midi_pitchclass_duplicates(void);
+void    reverse_list(void);
+void    rotate_motif(void);
+void    ratios(void);
+void    qiksort(void);
+void    reciprocals(int positive_vals_only);
+void    randomise_order(int *perm);
+void    add_randval_plus_or_minus(void);
+void    add_randval(void);
+void    multiply_by_randval(void);
+void    randchunks(void);
+void    generate_random_values(void);
+void    random_0s_and_1s(void);
+void    random_0s_and_1s_restrained(void);         /*TW march 2004 */
+void    random_scatter(void);
+void    random_elimination(void);
+void    equal_divisions(void);
+void    log_equal_divisions(void);
+void    quadratic_curve_steps(void);
+void    plain_bob(void);
+void    get_intervals(void);
+void    repeat_intervals(void);
+void    make_equal_intevals_btwn_given_vals(void);
+void    create_intervals(void);
+void    change_value_of_intervals(void);
+void    change_value_of_intervals(void);
+void    get_intermediate_values(void);
+void    insert_intermediate_values(void);
+void    motivically_invert_midi(void);
+void    motivically_invert_hz(void);
+void    stack(int with_last);              /*TW March 2004 */
+void    get_one_skip_n(void);
+void    get_n_skip_one(void);
+void    sum_nwise(void);
+void    sum_minus_overlaps(void);
+void    sum_absolute_differences(void);
+void    duplicate_values(void);
+void    duplicate_list(void);
+void    multiply(int rounded);
+void    format_vals(void);
+void    rotate_partition_values_to_files(void);
+void    generate_harmonics(void);
+void    group_harmonics(void);
+void    get_harmonic_roots(void);
+void    rank_vals(void);
+void    rank_frqs(void);
+void    approx_vals(void);
+void    pitchtotext(int midi);
+void    miditotext(void);
+void    floor_vals(void);
+void    limit_vals(void);
+
+void    help(void),helpm(void),helpM(void),helpr(void);
+void    helpl(void),helpg(void);
+void    interval_limit(void);
+void    time_density(void), divide_list(void), group(void);
+void    duplicate_octfrq(void);
+void    duplicate_octaves(void);
+void    interval_to_ratio(int semitones,int tstretch);
+void    do_slope(void);
+void    do_string_infile(char *);
+void    alphabetic_sort(void);
+void    db_to_level(int sampleval);
+void    level_to_db(int sampleval);
+void    do_DB_infile(char *);
+void    columnate(void);
+void    samp_to_time(void);
+void    time_to_samp(void);
+void    column_format_vals(void);
+void    delete_small_intervals(void);
+void    mark_event_groups(void);
+void    span(void);
+void    spanpair(void);
+void    alt0101(void);
+void    alt0011(void);
+void    alt01100(void);
+void    delete_vals(void);
+void    insert_val(void);
+void    replace_val(void);
+void    ascending_order(void);
+void    alt0r0r(void);
+void    altr0r0(void);
+void    alt00rr(void);
+void    altrr00(void);
+void    alt0rr00r(void);
+void    altr00rr0(void);
+void    alt00RR(void);
+void    altRR00(void);
+void    alt0RR00R(void);
+void    altR00RR0(void);
+void    create_intervals_from_base(void);
+void    create_ratios_from_base(void);
+void    create_equal_vals(void);
+void    quantised_scatter(int *perm,int permlen);
+void    replace_equal(void);
+void    replace_less(void);
+void    replace_greater(void);
+void    grid(int isoutside);
+void    randdel_not_adjacent(void);
+void    replace_with_rand(int i);
+void    randquanta_in_gaps(void);
+void    reverse_time_intervals(void);
+void    invert_normd_env(void);
+void    invert_over_range(void);
+void    invert_around_pivot(void);
+void    join_files_as_rows(void);
+void    join_many_files_as_rows(void);
+void    env_superimpos(int inverse,int typ);
+void    env_del_inv(void);
+void    env_plateau(void);
+void    time_from_beat_position(int has_offset);
+void    insert_after_val(void);
+void    min_interval(int ismax);
+void    mark_multiples(void);
+void    insert_in_order(void);
+void    insert_at_start(void);
+void    insert_at_end(void);
+void    format_strs(void);
+void    column_format_strs(void);
+void    random_integers(void);
+void    random_integers_evenly_spread(void);
+void    time_from_bar_beat_metre_tempo(int has_offset);
+void    brk_add(void);
+void    brk_subtract(void);
+void    span_rise(void);
+void    span_fall(void);
+void    span_all(void);
+void    span_xall(void);
+void    cyclic_select(char c);
+void    generate_randomised_vals(void);
+void    ratio_to_interval(int semitones,int tstretch);
+void    pitch_to_delay(int midi);
+void    delay_to_pitch(int midi);
+void    reverse_order_of_brkvals(void);
+void    thresh_cut(void);
+void    band_cut(void);
+
+int     do_stringline_infile(char *argv,int i);
+int     do_other_stringline_infile(char *argv);
+void    do_other_stringline_infiles(char *argv[],char c);
+void    do_inline_cnt(int n,char *argv);
+void    scale_above(void);
+void    scale_below(void);
+void    scale_from(void);
+void    env_append(void);
+void    abutt(void);
+void    quantise_time(void);
+void    quantise_val(void);
+void    expand_table_dur_by_factor(void);
+void    expand_table_dur_to_time(void);
+void    expand_table_vals_by_factor(void);
+void    cut_table_at_time(void);
+void    limit_table_val_range(void);
+void    expand_table_to_dur(void);
+void    extend_table_to_dur(void);
+
+void    do_error(void);
+void    do_valout(double val);
+void    do_stringout(char *str);
+void    do_valout_as_message(double val);
+void    do_valout_flush(double val);
+void    do_valpair_out(double val0,double val1);
+void    note_to_midi(int is_transpos);
+void    substitute(void);
+void    substitute_all(void);   /*TW March 2004 */
+void    mean_of_reversed_pairs(void);
+void    duplicate_values_stepped(void);
+void    kill_text(int after);
+void    append_text(int where);
+
+void    targeted_pan(void);
+void    targeted_stretch(void);
+void    do_squeezed_pan(void);
+void    kill_path(void);
+void    kill_extension(void);
+void    kill_path_and_extension(void);
+void    convert_space_pan_to_tex(void);
+void    convert_space_tex_to_pan(void);
+
+extern char     errstr[];
+extern int colcnt, *cntr;
+extern int *file_cnt;
+extern int sloom;
+extern int sloombatch;
+extern int hasoutfile;
+extern char outfilename[];
+
+void compress_sequence(int multi);              /* Wc */
+void transpose_sequence(int multi);             /* Wt */
+void p_invertset_sequence(int multi);   /* WI */
+void p_expandset_sequence(int multi);   /* WE */
+void p_invert_sequence(int multi);              /* Wi */
+void t_reverse_sequence(int multi);             /* Wr */
+void p_reverse_sequence(int multi);             /* WP */
+void a_reverse_sequence(int multi);             /* WA */
+void pa_reverse_sequence(int multi);    /* WR */
+void tp_reverse_sequence(int multi);    /* WT */
+void ta_reverse_sequence(int multi);    /* Wa */
+void tpa_reverse_sequence(int multi);   /* WZ */
+void loop_sequence(int);                /* Wl */
+void abut_sequences(int);               /* Wb */
+void uptempo_sequence(int);     /* Wm */
+void accel_sequence(int);               /* WM */
+void create_equal_steps(void);  /* iQ */
+void mean_tempo(void);                  /* te */
+void time_to_crotchets(int beatvals);   /* tB,tC */
+void rotate_list(int reversed); /* rR, rX */
+void splice_pos(void);                  /* SM */
+void time_warp(void);                   /* ew */
+void brkval_warp(void);                 /* eX */
+void brktime_warp(void);                /* eW */
+void duplicate_list_at_step(void); /* dL */
+void list_warp(void);                   /* eL */
+void seqtime_warp(void);                /* eQ */
+void tw_pseudo_exp(void);               /* ze */
+void reverse_time_intervals2(void);     /* tR */
+void interp_n_vals(void);               /* IV */
+void convert_to_edits(void);    /* sE */
+void cosin_spline(void);                /* cs */
+void distance_from_grid(void);  /* dg */
+void sinusoid(void);                    /* ss */
+void warped_times(int isdiff);  /* wt, wo */
+void random_pairs(void);                        /* rG */
+void random_pairs_restrained(void);     /* rJ */
+void cumuladd(void);                            /* ga */
+void randomise_Ntimes(int *perm);       /* Rx */
+void tw_psuedopan(void);                        /* pp */
+
+//double drand48(void);
+//void initrand48(void);
+void rand_ints_with_fixed_ends(void);   /* ri */
+void rand_zigs(void);                                   /* zz */
+void eliminate_dupltext(void);                  /* eb */
+void sinjoin(char val);         /* sc, sv, sx */
+void brktime_owarp(void);               /* eY */
+void just_intonation_Hz(void);          /* Zh */
+void just_intonation_midi(void);        /* ZM */
+void create_just_intonation_Hz(void);   /* ZH */
+void create_just_intonation_midi(void); /* Zm */
+void insert_intermediate_valp(void);    /* ip */
+void random_warp(void); /* Zs */

+ 36 - 0
dev/include/combine.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specmake(dataptr dz);
+int  specsum(dataptr dz);
+int  specdiff(dataptr dz);
+int  specleaf(dataptr dz);
+int  specmax(dataptr dz);
+int  specmean(dataptr dz);
+int  speccross(dataptr dz);
+int  specmake2(dataptr dz);

+ 169 - 0
dev/include/conditions.h

@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#include <pnames.h>
+
+/*
+ * 1)   When compiling validate library for CDPARSE, ALL condit defines must be ON!!
+ */
+
+#ifdef ENVEL_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <envel.h>
+#endif
+
+#ifdef DISTORT_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <distort.h>
+#endif
+
+#ifdef EXTEND_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <extend.h>
+#endif
+
+#ifdef TEXTURE_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <texture.h>
+#endif
+
+#ifdef GRAIN_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <grain.h>
+#endif
+
+#ifdef MIX_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <mix.h>
+int  set_up_mix(dataptr dz);
+#endif
+
+#ifdef FILTER_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <filters.h>
+#endif
+
+#ifdef MODIFY_COMPILE
+#define IS_GROUCHO_COMPILE              (1)
+#include <modify.h>
+#endif
+
+
+#ifdef SPEC_SIMPLE_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <simple.h>
+#endif
+
+#ifdef SPEC_STRETCH_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <stretch.h>
+#endif
+
+#ifdef SPEC_PITCH_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <pitch.h>
+#endif
+
+#ifdef SPEC_HIGHLIGHT_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <highlight.h>
+#endif
+
+#ifdef SPEC_FOCUS_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <focus.h>
+#endif
+
+#ifdef SPEC_BLUR_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <blur.h>
+#endif
+
+#ifdef SPEC_STRANGE_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <strange.h>
+#endif
+
+#ifdef SPEC_MORPH_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <morph.h>
+#endif
+
+#ifdef SPEC_REPITCH_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <repitch.h>
+#endif
+
+#ifdef SPEC_FORMANTS_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <fmnts.h>
+#endif
+
+#ifdef SPEC_COMBINE_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <combine.h>
+#endif
+
+#ifdef SPEC_INFO_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <specinfo.h>
+#endif
+
+#ifdef SPEC_PINFO_COMPILE
+#define IS_SPEC_COMPILE         (1)
+#include <specpinfo.h>
+#endif
+
+#ifdef PVOC_COMPILE
+#define IS_GROUCHO_COMPILE      (1)
+#include <pvoc.h>
+#endif
+
+#ifdef EDIT_COMPILE
+#define IS_GROUCHO_COMPILE      (1)
+#include <edit.h>
+#endif
+
+#ifdef HOUSEKEEP_COMPILE
+#define IS_GROUCHO_COMPILE      (1)
+#include <house.h>
+#endif
+
+#ifdef SNDINFO_COMPILE
+#define IS_GROUCHO_COMPILE      (1)
+#include <sndinfo.h>
+#endif
+
+#ifdef SYNTHESIS_COMPILE
+#define IS_GROUCHO_COMPILE      (1)
+#include <synth.h>
+#endif
+
+
+#ifdef UTILS_COMPILE
+#define IS_GROUCHO_COMPILE      (1)
+#include <utils.h>
+#endif

+ 27 - 0
dev/include/dircdp.h

@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+int dircdp(int required_filetype,int srate,int channels,int origrate,int Mlen,int Dfac,int specenvcnt,float arate);

+ 70 - 0
dev/include/distcon.h

@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/************************ DISTORT *************************/
+/* floatsam version*/
+/* CONSTANTS FOR DISTORT */
+
+/*#define CLIPMAX           ((short)24000)*/
+#define FCLIPMAX                (0.7325f)
+#define SINETABLEN  (1024)
+#define TABLEN      (1024.0)
+#define PULSEWIDTH  (0.001)             /* secs */
+#define MAXWIDTH        (6.0)
+
+/* CONSTANTS FOR DISTORTA, DISTORTTH, DISTORTF */
+
+#define MAXWAVELEN   (.5)               /* seconds */
+
+/* CONSTANTS FOR DISTORTH */
+
+/* CONSTANTS FOR DISTORTF */
+
+#define MIN_SCALE               (2.0)
+
+/* CONSTANTS FOR DISTORT_RPT */
+
+#define MULTIPLY                (0)
+#define INTERPOLATE             (1)
+#define GRP_MULTIPLY    (2)
+
+/* CONSTANTS FOR DISTORT_DEL */
+
+#define LOSE                    (0)
+#define KEEP                    (1)
+
+/* CONSTANTS FOR DISTORT_PCH */
+
+#define MAXOCTVAR               (8.0)
+#define DEFAULT_RSTEP   (64)
+
+#define MINWAVELEN              (8.0)           /* samples */
+
+#define DISTORT_MAX_POWFAC              (40.0)
+#define DISTORTE_MIN_EXPON              (0.02)
+#define DISTORTE_MAX_EXPON              (50.0)
+#define DISTORTH_MAX_PRESCALE   (200.0)
+#define CYCLIM_DFLTFRQ  (1000.0)

+ 32 - 0
dev/include/distort.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <distcon.h>
+#include        <distort1.h>

+ 86 - 0
dev/include/distort1.h

@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* floatsam version*/
+#define DFLT_DISTORTER_MULT             (.01)
+#define DFLT_DISTORTER_DEPTH    (1.0)
+#define DISTORTER_TABLEN                (1028)
+#define ENDBIT_SPLICE                   (256.0)
+#define PULSE_FRQLIM                    (6000.0)
+#define PULSE_DBLIM                             (-60)
+#define ORIG_PULSENV    (0)
+#define PULSENV                 (1)
+#define PULSTRN                 (2)
+
+int     process_with_swapped_bufs_on_single_half_cycles(dataptr dz);
+int             process_with_swapped_bufs_on_full_cycles(dataptr dz);
+int             process_on_single_buf_with_phase_dependence(dataptr dz);
+int     process_with_swapped_buf_to_swapped_outbufs(dataptr dz);
+int             process_with_swapped_bufs_on_full_cycles_with_optional_prescale(dataptr dz);
+int             process_with_swapped_bufs_on_full_cycles_with_newsize_output_and_skipcycles
+                        (float *outbuf,int skip_param,dataptr dz);
+int             process_cyclecnt(dataptr dz);
+int     two_infiles_interleave_process(dataptr dz);
+int     two_infiles_resize_process(dataptr dz);
+int     distort_pitch(dataptr dz);
+
+int             skip_initial_cycles(int *current_pos,int *current_buf,int phase,int skip_paramno,dataptr dz);
+int             get_initial_phase(int *initial_phase,dataptr dz);
+
+int     do_distort(int tthis,int is_last,int *lastzero,float *cyclemax,dataptr dz);
+int     distort_env(int *current_buf,int initial_phase,int *current_pos,int *buffer_overrun,int *cnt,dataptr dz);
+int     distort_rev(int *current_buf,int initial_phase,int *current_pos,int *buffer_overrun,int *cnt,dataptr dz);
+int             distort_avg(int *current_buf,int inital_phase,int *outbufcnt,int *inbufcnt,int *cnt,dataptr dz);
+int     distort_omt(int *inbufcnt,int inital_phase,dataptr dz);
+int     mdistort(int is_last,int *lastzero,int *endsample,int *output_phase,int current_buf,float *cyclemax,
+                int *no_of_half_cycles,int *startindex,int *startmakrer,int *endindex,dataptr dz);
+int     distorth(int *bufpos,int phase,int *last_total_samps_read,int *current_buf,dataptr dz);
+int     distortf(int *bufpos,int phase,int *last_total_samps_read,int *current_buf,dataptr dz);
+int     distort_shuf(int *current_buf,int initial_phase,int *obufpos,int *current_pos_in_buf,int *cnt,dataptr dz);
+int     distort_rpt(int *current_buf,int initial_phase,int *obufpos,int *current_pos_in_buf,int *cnt,
+                                int cyclecnt,int *lastcycle_len,int *lastcycle_start,int *last_bufcros,dataptr dz);
+int             distort_del(int *current_buf,int *current_pos_in_buf,int phase,int *obufpos,int *cnt,dataptr dz);
+int             distort_del_with_loudness(int *current_buf,int phase,int *obufpos,int *current_pos_in_buf,int *cnt,dataptr dz);
+int             distort_rpl(int *current_buf,int initial_phase,int *obufpos,int *current_pos_in_buf,int *cnt,dataptr dz);
+int     distort_tel(int *current_buf,int initial_phase,int *obufpos,int *current_pos_in_buf,int *cnt,dataptr dz);
+int     distort_flt(int *current_buf,int initial_phase,int *obufpos,int *current_pos_in_buf,dataptr dz);
+int     two_infiles_interleave_process(dataptr dz);
+int     two_infiles_resize_process(dataptr dz);
+int     reset_distorte_modes(dataptr dz);
+
+void    prescale(int current_buf,int prescale_param,dataptr dz);
+int             cop_out(int i,int j,int last_total_bytes_read,dataptr dz);
+int     change_buf(int *current_buf,int *buffer_overrun,float **buf,dataptr dz);
+int             change_buff(float **b,int *cycleno_in_group_at_bufcros,int *current_buf,dataptr dz);
+int     get_full_cycle(float *b,int *buffer_overrun,int *current_buf,int initial_phase,int *current_pos,
+                int cyclecnt_param,dataptr dz);
+int     output_val(float value,int *obufpos,dataptr dz);
+int     distort_overload(dataptr dz);
+int             overload_preprocess(dataptr dz);
+int             preprocess_pulse(dataptr dz);
+int             do_pulsetrain(dataptr dz);
+int     distort_rpt_frqlim(int *current_buf,int initial_phase,int *obufpos,int *current_pos_in_buf,int *cnt,
+                                int cyclecnt,dataptr dz);

+ 58 - 0
dev/include/edit.h

@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE      (1)
+
+#define EDIT_SPLICELEN  (15.0)
+#define EDIT_SPLICEMAX  (5000.0)
+#define EDIT_MAXGAIN    (128.0)
+#define MINOUTDUR               (0.05)
+#define MIN_SUPRESS             (1000)
+
+int     create_edit_buffers(dataptr dz);
+int     create_twixt_buffers(dataptr dz);
+int     edit_pconsistency(dataptr dz);
+int     edit_preprocess(dataptr dz);
+int     twixt_preprocess(dataptr dz);
+int     sphinx_preprocess(dataptr dz);
+int     do_cut(dataptr dz);
+int     do_zcut(dataptr dz);
+int     do_excise(dataptr dz);
+int     do_insert(dataptr dz);
+int     do_insertsil_many(dataptr dz);
+int     do_joining(dataptr dz);
+int     do_patterned_joining(dataptr dz);       /*TW March 2004 */
+int             do_randcuts(dataptr dz);
+int             do_randchunks(dataptr dz);
+int             do_twixt(dataptr dz);
+int     get_switchtime_data(char *filename,dataptr dz);
+int     get_multi_switchtime_data(char *filename,dataptr dz);
+int     cut_many(dataptr dz);
+int     do_noise_suppression(dataptr dz);
+int     do_syllabs(dataptr dz);                         /*TW March 2004 */
+int             do_many_zcuts(dataptr dz);
+#define SPLICELEN (dz->ringsize)        /* dz->ringsize being used to store SPLICELEN */
+                                                                        /* danger, don't use RING functions anywhere in sfedit functions !! */

+ 35 - 0
dev/include/envel.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <envlcon.h>
+#include        <envel1.h>
+
+/*RWD try to replace/lose all SECSIZE stuff in time! */
+#define ENV_FSECSIZE (256)

+ 48 - 0
dev/include/envel1.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+int     process_envelope(dataptr dz);
+//int   setup_envel_windowsize(dataptr dz);
+int     read_env_ramp_brk(char *filename,dataptr dz);
+//int   read_env_create_file(char *str,dataptr dz);
+int     envelope_warp(float **env,float **envend,dataptr dz);
+int     envreplace(float *env,float **envend,float *origenv,float *origend);
+int     extract_env_from_sndfile(int *bufcnt,int *envcnt,float **env,float **envend,int fileno,dataptr dz);
+int     impose_envel_on_sndfile(float *env,int envcnt,int bufcnt,int fileno,dataptr dz);
+int     create_envelope(int *cnt,dataptr dz);
+int     envel_preprocess(dataptr dz);
+int     create_sndbufs_for_envel(dataptr dz);
+int     apply_brkpnt_envelope(dataptr dz);
+
+int     buffers_in_sndfile(int buffer_size,int fileno,dataptr dz);
+int     windows_in_sndfile(int fileno,dataptr dz);
+
+//int   create_pluck_buffers(dataptr dz);
+int     envelope_pluck(dataptr dz);
+int     envelope_tremol(dataptr dz);
+int     generate_samp_windowsize(fileptr thisfile,dataptr dz);
+int             do_grids(dataptr dz);
+int             envsyn(dataptr dz);     /*TW March 2004 */

+ 102 - 0
dev/include/envlcon.h

@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*************************** ENVELOPE *************************/
+
+#define ENV_DEFAULT_WSIZE       (50.0)  /* MSECS */
+
+#define MIN_ENV_EXAG            (0.01)
+#define MAX_ENV_EXAG            (100.0)
+#define MIN_ENV_ATTEN           (0.0)
+#define MAX_ENV_ATTEN           (1.0)
+#define MIN_ENV_LIMIT           (0.0)
+#define MAX_ENV_LIMIT           (ABSMAXSAMP)
+#define MIN_ENV_THRESHOLD   (0.0)
+#define MAX_ENV_THRESHOLD   (ABSMAXSAMP)
+#define MIN_ENV_TSTRETCH        (.001)
+#define MAX_ENV_TSTRETCH        (1000.0)
+#define MAX_ENV_FLATN           (5000.0)
+#define MAX_ENV_SMOOTH           (32767.0)
+
+
+#define ENV_DEFAULT_EXAGG    (2.0)
+#define ENV_DEFAULT_ATTEN    (0.5)
+#define ENV_DEFAULT_LIFT     (0.0)
+#define ENV_DEFAULT_TSTRETCH (2.0)
+#define ENV_DEFAULT_FLATN        (4.0)
+#define ENV_DEFAULT_GATE         (0.3)
+#define ENV_DEFAULT_THRESH       (0.15)
+#define ENV_DEFAULT_MIRROR       (0.3)
+#define ENV_DEFAULT_TRIGDUR  (ENV_DEFAULT_WSIZE * 4.0)
+#define ENV_DEFAULT_TRIGRISE (0.15)
+#define ENV_DEFAULT_TROFDEL     (2.0)
+#define ENV_DEFAULT_PKSRCHWIDTH (4.0)
+
+#define ENV_DEFAULT_DATAREDUCE  (0.0002)
+
+#define ENV_MIN_ATK_ONSET               (5.0)
+#define ENV_MAX_ATK_ONSET               (32767.0)
+#define ENV_DEFAULT_ATK_ONSET   (50.0)
+#define ENV_ATK_SRCH                    (200.0)
+#define ENV_DEFAULT_ATK_TAIL    (200.0)
+#define ENV_DEFAULT_ATK_GAIN    (2.0)
+
+#define ENV_TIMETYPE_SECS       (0)
+#define ENV_TIMETYPE_SMPS       (1)
+#define ENV_TIMETYPE_STSMPS     (2)
+
+#define ENVTYPE_LIN             (0)
+#define ENVTYPE_EXP             (1)
+#define ENVTYPE_STEEP   (2)
+#define ENVTYPE_DBL             (3)
+
+#define ENV_PLK_FRQ_MIN                 (20.0)
+#define ENV_PLK_FRQ_MAX                 (10000.0)
+#define ENV_PLK_CYCLEN_MIN          (2.0)
+#define ENV_PLK_CYCLEN_MAX      ((double)MAXSHORT)
+#define ENV_PLK_CYCLEN_DEFAULT  (32.0)
+#define ENV_PLK_DECAY_DEFAULT   (48.0)
+#define ENV_PLK_DECAY_MIN               (1.0)
+#define ENV_PLK_DECAY_MAX               (64.0)
+#define ENV_PLK_ENDSAMP_MAXTIME (10.0)
+#define ENV_PLK_ONSET_TIME      (4.0)      /* MS */
+
+#define PLK_INBUF    (0)
+#define PLK_OUTBUF   (1)
+#define PLK_OBUFWRAP (2)
+#define PLK_BUFEND   (3)
+#define PLK_INITBUF  (4)
+#define PLK_PLUKEND  (5)
+
+#define ENV_TREM_TABSIZE                (4096)
+#define ENV_TREM_MAXFRQ                 (500.0)
+#define ENV_TREM_DEFAULT_FRQ    (15.0)
+#define ENV_TREM_DEFAULT_DEPTH  (0.25)
+
+#define ENV_MIN_WSIZE                   (5.0)           /* MSECS */
+#define ENV_MAX_WSIZE                   (10000.0)       /* MSECS */
+
+#define MAX_PEAK_SEPARATION             (32767)         /* Arbitrary */

+ 67 - 0
dev/include/extdcon.h

@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************************** EXTEND ******************************/
+
+/* CONSTANTS FOR ZIGZAG */
+#define ZIG_SPLICELEN     (15.0)
+#define ZIG_MIN_UNSPLICED (1.0)
+#define ZIG_EXPON                 (1.0)
+#define MIN_ZIGSPLICE     (1.0)
+#define MAX_ZIGSPLICE     (5000.0)
+#define DEFAULT_LPSTEP    (200.0)
+/* CONSTANTS FOR ITERATE */
+#define ITER_MAXPSHIFT          (12.0)
+#define ITER_MAX_DELAY          (100.0)
+#define ITER_UPSCALE            (65536.0)
+#define ITER_DNSHIFT            (16)
+#define ITER_SAFETY             (512)
+#define DEFAULT_ITER_GAIN       (0.0)
+#define ST_INTP_SHIFT           (3)
+#define MN_INTP_SHIFT           (4)
+#define FIXED_AMP                       (10)  /* added to flags above gives flags below */
+#define FIXA_MONO                       (11)
+#define FIXA_STEREO             (12)
+#define FIXA_ST_INTP_SHIFT      (13)
+#define FIXA_MN_INTP_SHIFT      (14)
+/* CONSTANTS FOR DRUNKWALK */
+#define DRNK_GRAIN              (.002)
+#define DRNK_DEFAULT_GSTEP      (10.0)
+#define DRNK_DEFAULT_CLOKTIK (4.0)
+#define DRNK_SPLICE                     (15.0)
+#define DRNK_MIN_SPLICELEN       (1.0)
+#define DRNK_MAX_SPLICELEN (5000.0)
+#define MAX_DRNKTIK                     (32767.0)       /* arbitrary */
+#define DEFAULT_MIN_DRNKTIK     (10.0)
+#define DEFAULT_MAX_DRNKTIK (30.0)
+#define DRNK_MAX_OVERLAP        (0.99)
+/*TW March 2004 */
+/* FORM DOUBLETS */
+#define SPLICEDUR (5 * MS_TO_SECS)
+
+#define ITX_SPLICELEN   (256)
+
+#define ITERATE_EXTEND_BUFSIZE (512 * 512)

+ 32 - 0
dev/include/extend.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <extdcon.h>
+#include        <extend1.h>

+ 52 - 0
dev/include/extend1.h

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*
+ *      2nd header for EXTEND group of sndprgs - graphics compatible version - FUNCTIONS
+ */
+
+#define EXTEND1_H_RCSID "$Id$"
+/*
+ * $Log$
+ */
+/* RWD 6:2001 commented out funcs declare static to ap_extend.c, extprepro.c */
+void    initialise_random_sequence(int seed_flagno,int seed_paramno,dataptr dz);
+int     iterate_preprocess(dataptr dz);
+int             convert_time_and_vals_to_samplecnts(int paramno,dataptr dz);
+int     create_drunk_buffers(dataptr dz);
+int     drunk_preprocess(dataptr dz);
+
+int     zigzag(dataptr dz);
+int     do_iteration(dataptr dz);
+int     do_loops(int *thisstart,int *lastend,int *outbuf_space,int obufno,int splbufno,dataptr dz);
+int     do_drunken_walk(dataptr dz);
+int     accent_stream(dataptr dz);
+int             do_sequence(dataptr dz);
+int             do_sequence2(dataptr dz);
+int             do_btob(dataptr dz);
+/*TW March 2004 */
+int             do_doubling(dataptr dz);
+int             extend_by_insplice(dataptr dz);

+ 142 - 0
dev/include/filetype.h

@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/** WARNING **
+ *
+ * If new filetypes are added..
+ * FUNCTIONS  in filetype.c must be upgraded to take account of these!!
+ */
+
+/***************************** NEW FILE HEADER VALUES, ALSO USEFUL FOR FLAGGING IN GUI *************
+                                                                                                                                                                   TPNdU LNSSMFS|
+                                                                                                                                                                   rioBn iunyilp|
+                                                                                                                                                                   atr r nmdnxoe|
+                                                                                                                                                                   ncm n eb c ac|
+                                                                                                                                                                   shl g  r   t |
+                                                                                                                                                                           d                    */
+#define BRKFILE                                                                                                                 (8192)  /* 0010000000000000     */
+#define DB_BRKFILE                                                                                                              (4096)  /* 0001000000000000     */
+#define UNRANGED_BRKFILE                                                                                                (2048)  /* 0000100000000000     */
+#define NUMLIST                                                                                                                 (256)   /* 0000000100000000     */
+#define SNDLIST                                                                                                                 (128)   /* 0000000010000000     */
+#define SYNCLIST                                                                                                                (64)    /* 0000000001000000     */
+#define MIXFILE                                                                                                         (32)    /* 0000000000100000     */
+#define LINELIST                                                                                                                (512)   /* 0000001000000000     */
+#define SNDFILE                                                                                                                 (1)             /* 0000000000000001     */
+#define FLT_SNDFILE                                                                                                             (17)    /* 0000000000010001     */
+#define ANALFILE                                                                                                                (24)    /* 0000000000011000     */
+#define PITCHFILE                                                                                                               (25)    /* 0000000000011001     */
+#define TRANSPOSFILE                                                                                                    (26)    /* 0000000000011010     */
+#define FORMANTFILE                                                                                                             (27)    /* 0000000000011011     */
+#define ENVFILE                                                                                                                 (16)    /* 0000000000010000     */
+#define TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST    (41728) /* 1010001100000000     */
+#define TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST                                (41216) /* 1010000100000000     */
+#define TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST    (49920) /* 1100001100000000     */
+#define TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST                                (49408) /* 1100000100000000     */
+#define TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST (35584) /* 1000101100000000     */
+#define TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST                             (35072) /* 1000100100000000     */
+#define NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                (8960)  /* 0010001100000000     */
+#define NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                    (8448)  /* 0010000100000000     */
+#define DB_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                   (4864)  /* 0001001100000000     */
+#define DB_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                               (4352)  /* 0001000100000000     */
+#define PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                (17152) /* 0100001100000000     */
+#define PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                    (16640) /* 0100000100000000     */
+#define PITCH_POSITIVE_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST               (18176) /* 0100011100000000     */
+#define PITCH_POSITIVE_BRKFILE_OR_NUMLIST_OR_WORDLIST                                   (17664) /* 0100010100000000     */
+#define UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                             (2816)  /* 0000101100000000     */
+#define UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                 (2304)  /* 0000100100000000     */
+#define NUMLIST_OR_LINELIST_OR_WORDLIST                                                                 (768)   /* 0000001100000000     */
+#define NUMLIST_OR_WORDLIST                                                                                             (256)   /* 0000000100000000     */
+#define SNDLIST_OR_SYNCLIST_LINELIST_OR_WORDLIST                                                (704)   /* 0000001011000000     */
+#define SNDLIST_OR_SYNCLIST_OR_WORDLIST                                                                 (192)   /* 0000000011000000     */
+#define SNDLIST_OR_LINELIST_OR_WORDLIST                                                                 (640)   /* 0000001010000000     */
+#define SNDLIST_OR_WORDLIST                                                                                             (128)   /* 0000000010000000     */
+#define MIXLIST_OR_LINELIST_OR_WORDLIST                                                                 (544)   /* 0000001000100000     */
+#define MIXLIST_OR_WORDLIST                                                                                             (32)    /* 0000000000100000     */
+#define SYNCLIST_OR_LINELIST_OR_WORDLIST                                                                (576)   /* 0000001001000000     */
+#define SYNCLIST_OR_WORDLIST                                                                                    (64)    /* 0000000001000000     */
+#define LINELIST_OR_WORDLIST                                                                                    (512)   /* 0000001000000000     */
+#define WORDLIST                                                                                                                (288)   /* 0000000100100000     */
+#define POSITIVE_BRKFILE                                                                                                (1024)  /* 0000010000000000 */
+#define POSITIVE_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                             (1792)  /* 0000011100000000     */
+#define POSITIVE_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                 (1280)  /* 0000010100000000     */
+
+
+/**** VALUES ONLY USED AFTER redefine_textfile_type... *********/
+
+#define ANYFILE                 (65535) /* 1111111111111111 (probably redundant)*/
+#define TEXTFILE                (96)    /* 0000000001100000 */
+
+/*********** NEW FLAG RECOGNITION CONSTANTS **************/
+                                                                                                /* Operation
+                                                                                                with program's
+                                                                                                filetype flag */
+#define IS_A_PITCH_BRKFILE              (16384)                         /* &=   TRUE */         /* 0100000000000000     */
+#define IS_A_TRANSPOS_BRKFILE   (32768)                         /* &=   TRUE */         /* 1000000000000000     */
+#define IS_A_POSITIVE_BRKFILE   POSITIVE_BRKFILE        /* &=   TRUE */         /* 1000000000000000     */
+#define IS_A_NORMD_BRKFILE              BRKFILE                         /* &=   TRUE */
+#define IS_A_DB_BRKFILE                 DB_BRKFILE                      /* &=   TRUE */
+#define IS_AN_UNRANGED_BRKFILE  (3072)                          /* &=   TRUE */         /* 0000110000000000     */
+#define IS_A_NUMLIST                    NUMLIST                         /* &=   TRUE */
+#define IS_A_SNDLIST                    SNDLIST                         /* &=   TRUE */
+#define IS_A_SYNCLIST                   SYNCLIST                        /* &=   TRUE */
+#define IS_A_MIXFILE                MIXFILE                     /* &=   TRUE  && !WORDLIST */
+#define IS_A_LINELIST                   LINELIST                        /* &=   TRUE */
+#define IS_A_SNDFILE                    SNDFILE                         /* ==            */
+#define IS_A_FLT_SNDFILE                FLT_SNDFILE                     /* ==            */
+#define IS_AN_ANALFILE                  ANALFILE                        /* ==            */
+#define IS_A_PITCHFILE                  PITCHFILE                       /* ==            */
+#define IS_A_TRANSPOSFILE               TRANSPOSFILE            /* ==            */
+#define IS_A_FORMANTFILE                FORMANTFILE                     /* ==            */
+#define IS_AN_ENVFILE                   ENVFILE                         /* ==            */
+#define IS_A_SNDSYSTEM_FILE             (31)                            /* &=   TRUE                                                    0000000000011111 */
+#define IS_A_PTF_BINFILE                (27)                            /* &=   > ANALFILE                                              0000000000011011 */
+#define IS_A_TEXTFILE                   (65504)                         /* &=   TRUE                                                    1111111111100000 */
+#define IS_A_SNDLIST_FIXEDSR    (192)                           /* &=   IS_A_SNDLIST_FIXEDSR                    0000000011000000 */
+#define IS_A_NUMBER_LINELIST    (768)                           /* &=   IS_A_NUMBER_LINELIST                    0000001100000000 */
+#define IS_MIX_OR_SNDLST_FIXSR  (224)                           /* &=   MIXFILE||IS_A_SNDLIST_FIXEDSR   0000000011100000 */
+#define IS_A_BRKFILE                    (64512)                         /* &=   TRUE                                                    1111110000000000 */
+#define IS_A_P_OR_T_BRK                 (39152)                         /* &=   TRUE                                                    1100000000000000 */
+
+/* NOT USED, IF USED, CHANGE BIT 6 (counting from 1 at LEFT, to 1 */
+#define IS_AN_ENV_OR_DB_BRK             (12288)                         /* &=   TRUE                                                    0011000000000000 */
+
+#define POSSIBLY_FILENAMES              (928)                           /* &=   TRUE                                                    0000001110100000 */
+/* ANYFILE                              NO TEST */
+#define IS_ANYFILE                              (65535)                         /* &=   TRUE                                                    1111111111111111 */
+
+#define IS_NOT_PURE_NUMS_TEXT   (65248)                         /* &=   TRUE                                                    1111111011100000 */
+#define IS_NOT_PURENUMS_OR_MIX_TEXT     (65216)                 /* &=   TRUE                                                    1111111011000000 */
+#define IS_NOT_MIX_TEXT                 (65472)                         /* &=   TRUE                                                    1111111111000000 */
+
+#define IS_ANALDERIVED                  (8)                                     /* &=   TRUE                                                    0000000000001000 */
+
+
+
+
+#define DEFAULT_FILENAME        "#test"
+
+#define ONE_NONSND_FILE                 (-100)  /* flag */

+ 124 - 0
dev/include/filtcon.h

@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/***************************** FILTERS ******************************/
+
+#define BSIZE                   (128)
+#define MINQ                    (0.001)
+#define MAXQ                    (10000.0)
+#define MIN_ACUITY              (1.0/MAXQ)
+#define MAX_ACUITY              (1.0)
+#define FLT_MINGAIN             (0.001)
+#define FLT_MAXGAIN             (10000.0)
+#define MINMIDI                 (0.0)
+#define MAXMIDI                 (127.0)
+//RWD was a whopping 10Hz!
+#define FLT_MINFRQ              (0.1)
+#define FLT_MAXFRQ              ((double)srate/2.0)
+
+#define FLT_MAX_FILTERS (2000)
+
+#define MINFILTAMP              (0.001) /* Filter can't have zero gain (causes divide by zero) */
+                                                                /* This is near enough to zero to allow the maths to work */
+                                                                /* without the filter component biting */
+
+#define FLT_MAX_PSHIFT  (48.0)  /* 4 8vas in semitones */
+
+/* FLITITER */
+
+#define ITER_MONO               (1)
+#define ITER_STEREO             (2)
+#define MN_SHIFT                (3)
+#define ST_SHIFT                (4)
+#define ST_FLT_INTP_SHIFT       (5)
+#define MN_FLT_INTP_SHIFT       (6)
+#define FIXED_AMP       (10) /* Converts flags above to flags below */
+#define U_MONO                  (11)
+#define U_STEREO        (12)
+#define U_MN_SHIFT              (13)
+#define U_ST_SHIFT              (14)
+#define U_ST_INTP_SHIFT (15)
+#define U_MN_INTP_SHIFT (16)
+
+#define MIN_SHORT               (-32768)
+#define MAX_SHORT               (32767)
+#define FLT_SAFETY      (512)
+
+#define FLT_OUTBUF      (2)
+#define FLT_OVFLWBUF    (3)
+
+/* FLTSWEEP */
+
+#define FLT_MINSWEEP    (0.0001)
+#define FLT_MAXSWEEP    (200.0)
+
+/* FSTATVAR */
+
+#define FLT_DEFAULT_FRQ         (440.0)
+#define FLT_DEFAULT_LOFRQ       (100.0)
+#define FLT_DEFAULT_HIFRQ       (4000.0)
+#define FLT_DEFAULT_SWPFRQ      (0.5)
+#define FLT_MININT                      (.25)           /* 1/4 of a semitone: min step between filters */
+#define FLT_MAXINT                      (8.0 * SEMITONES_PER_OCTAVE)
+
+#define FLT_MINPRESCALE         (-1.0)
+#define FLT_MAXPRESCALE         (1.0)
+
+#define FLT_MAXEQPRESCALE       (200.0)
+#define FLT_MINEQPRESCALE       (1.0/FLT_MAXEQPRESCALE)
+
+#define FLT_MAXHARMS            (200.0)
+
+#define FLT_DEFAULT_BW                   (200.0)
+#define FLT_DEFAULT_Q                    (20.0)
+#define FLT_DEFAULT_OFFSET               (40.0)
+#define FLT_DEFAULT_INCOUNT              (8.0)
+#define FLT_DEFAULT_INTSIZE              (5.0)
+#define FLT_DEFAULT_HCNT                 (1.0)
+#define FLT_DEFAULT_ROLLOFF              (-6.0)
+#define FLT_DEFAULT_ITERDELAY    (1.0)
+#define FLT_DEFAULT_ALLPASSDELAY (10.0)  /* MS */
+#define FLT_DEFAULT_SWPPHASE     (0.25)
+
+#define FLT_MINDBGAIN                    (MIN_DB_ON_16_BIT)
+#define FLT_MAXDBGAIN                    (36.0) /* arbitrary!! */
+
+#define FLT_DEFAULT_LOHIPASS     (1000.0)
+#define FLT_DEFAULT_LOHISTOP     (600.0)
+
+#define FLT_DEFAULT_LOHIPASSMIDI (84.0)
+#define FLT_DEFAULT_LOHISTOPMIDI (72.0)
+
+#define FLT_DEFAULT_LOHI_ATTEN   (-60.0)
+
+#define FLT_LBF                                         (200)
+#define FLT_DEFAULT_LPHP_PRESCALE       (0.9)
+
+#define FLT_MAXDELAY                    (32767.0)
+
+#define FLT_SPLICELEN                           (15.0)
+
+#define FLT_TAIL                                        (20.0)  /* 1 second allowed for filter to die to zero */

+ 32 - 0
dev/include/filters.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <filtcon.h>
+#include        <filters1.h>

+ 38 - 0
dev/include/filters1.h

@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* GLOBAL */
+
+int     filter_process(dataptr dz);
+void    io_filtering(float *buf1,float *buf2,int chans,int n,
+                        double *a,double *b,double *y,double *z,double *d,double *z1,double *ampl,dataptr dz);
+int     filter_pconsistency(dataptr dz);
+int     filter_preprocess(dataptr dz);
+int     filter_process(dataptr dz);
+int     iterating_filter(dataptr dz);
+int     allocate_filter_frq_amp_arrays(int fltcnt,dataptr dz);
+int             make_vfilt_data(dataptr dz);                                               /* TW March 2004      */
+int             newfval2(double *fbrk,double *hbrk,dataptr dz);

+ 292 - 0
dev/include/flags.h

@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/**************************** INTERNAL VARIANT-FLAGS ******************************/
+
+#define ACCU_DECAY              (0)     /* accu */
+#define ACCU_GLIS               (1)     /* accu */
+
+#define ARPE_IS_NONLIN  (0)     /* arpe */
+#define ARPE_IS_SUST    (1)     /* arpe */
+#define ARPE_TRKFRQ             (2)     /* arpe */
+#define ARPE_KEEP_SUST  (3)     /* arpe */
+
+#define BARE_LESS_BODY  (0)     /* bare */
+
+#define CHORD_FTOP              (0)     /* chord */
+#define CHORD_FBOT              (1)     /* chord */
+#define CHORD_BODY              (2)     /* chord */
+
+#define CROSS_INTP              (0)     /* cross */
+
+#define DIFF_IS_CROSS   (0)     /* diff */
+#define DIFF_SUBZERO    (1)     /* diff */
+
+#define DRNK_NO_ZEROSTEPS       (0)     /* drunk */
+
+#define FMNT_VIEW               (0)     /* fmntsee */
+
+#define FOCUS_STABLE    (0)     /* focus */
+
+#define FOLD_WITH_BODY  (0)     /* fold */
+
+#define FSEE_DISPLAY    (0) /* formsee */
+
+#define GLIS_FTOP               (0)     /* glis */
+
+#define GREQ_NOTCH              (0)     /* greq */
+
+#define MEAN_ZEROED             (0)     /* mean */
+
+#define PF_STARTCUT             (0)     /* pitchfix */
+#define PF_ENDCUT               (1)
+#define PF_LOPASS               (2)
+#define PF_HIPASS               (3)
+#define PF_IS_SMOOTH    (4)
+#define PF_IS_SMARK             (5)
+#define PF_IS_EMARK             (6)
+#define PF_TWOW                 (7)
+#define PF_INTERP               (8)
+
+#define PI_IS_MEAN              (0)     /* p_invert */
+#define PI_IS_TOP               (1)
+#define PI_IS_BOT               (2)
+
+#define PQ_OCTDUPL              (0)     /* pquantise */
+
+#define PR_IS_SLEW              (0)     /* prandomise */
+
+#define PS_MEANP                (0)     /* psmooth */
+#define PS_HOLD                 (1)     /* psmooth */
+
+#define PEAK_HEAR               (0)     /* peak */
+
+#define PICH_ALTERNATIVE_METHOD (0)     /* pitch */
+#define KEEP_PITCH_ZEROS                (1) /* pitch, track */
+
+
+#define SCAT_RANDCNT    (0)     /* scat */
+#define SCAT_NO_NORM    (1)     /* scat */
+
+#define SHIFT_LOG               (0)     /* shift */
+
+#define SHP_IS_DEPTH    (0)     /* shiftp  */
+
+#define STR_IS_DEPTH    (0)     /* stretch */
+
+#define SUM_IS_CROSS    (0)     /*  sum */
+
+#define TRACE_RETAIN    (0)     /*trace */
+
+#define TRNSF_FTOP              (0)     /* trnsf */
+#define TRNSF_FBOT              (1)     /* trnsf */
+#define TRNSF_BODY              (2)     /* trsnf */
+
+#define TRNSP_FTOP              (0)     /* trnsp */
+#define TRNSP_FBOT              (1)     /* trnsp */
+#define TRNSP_BODY              (2)     /* trnsp */
+
+#define TUNE_TRACE      (0)     /* tune */
+#define TUNE_FBOT               (1)     /* tune */
+
+#define IS_OCTVU_FUND   (0)     /* octvu */
+
+#define IS_BRG_START    (0)     /* bridge */
+#define IS_BRG_END              (1)     /* bridge */
+
+/* DISTORT_ENV */
+#define DISTORTE_IS_TROF        (0)
+#define DISTORTE_IS_EXPON       (1)
+
+/* DISTORT_MLT */
+#define DISTORTM_SMOOTH         (0)
+
+/* DISTORT_DIV */
+#define DISTORTD_INTERP         (0)
+
+/* DISTORT_HRM */
+/* DISTORT_FRC */
+#define IS_PRESCALED            (0)
+
+/* DISTORT_AVG  */
+/* DISTORT_SHUF */
+/* DISTORT_RPT  */
+/* DISTORT_DEL  */
+/* DISTORT_RPL  */
+/* DISTORT_TEL  */
+/* DISTORT_FLT  */
+#define IS_DISTORT_SKIP         (0)
+
+/* DISTORT_TEL */
+#define IS_DISTTEL_AVG          (1)
+
+/* ZIGZAG */
+#define IS_ZIG_RSEED            (0)
+
+/* LOOP */
+#define IS_KEEP_START           (0)
+
+/* SCRAMBLE */
+#define IS_SCRAMBLE_RSEED       (0)
+#define IS_SCR_KEEP_START       (1)
+#define IS_SCR_KEEP_END         (2)
+
+/* ITERATE */
+#define IS_ITER_DELAY           (0)
+#define IS_ITER_RAND            (1)
+#define IS_ITER_PSCAT           (2)
+#define IS_ITER_ASCAT           (3)
+#define IS_ITER_FADE            (4)
+#define IS_ITER_GAIN            (5)
+#define IS_ITER_RSEED           (6)
+
+/* DRUNKWALK */
+#define IS_DRNK_CLOKRND         (0)
+#define IS_DRNK_OVERLAP         (1)
+#define IS_DRNK_RSEED           (2)
+
+/* FILTERS */
+#define FLT_DBLFILT                     (0)
+#define DROP_OUT_AT_OVFLOW      (1)
+/* FLTITER */
+#define FLT_PINTERP_OFF         (1)
+#define FLT_EXPDEC                      (2)
+#define FLT_NONORM                      (3)
+
+/* ALLPASS */
+#define FLT_LINDELAY            (0)
+
+/* GRAIN DUPL,REORODER,REPITCH,REMOTIF ONLY */
+#define GR_ENVTRACK                     (0)
+#define LOSE_LAST_GRAIN         (1)
+
+/* MIX */
+#define ALTERNATIVE_MIX         (0)
+
+/* MIXSHUFL */
+#define MSH_NOCHECK                     (0)
+
+/* SYNCATT */
+#define MSY_POWMETHOD           (0)
+
+/* BRASSAGE */
+#define GRS_NO_DECCEL           (0)
+#define GRS_EXPON                       (1)
+#define GRS_NO_INTERP           (2)
+
+/* TEXTURE */
+#define IS_TEX_RSEED            (0)
+        /* FLAGS only used in certain texture processes */
+#define TEX_IGNORE_DUR   (1)
+#define DONT_KEEP_MTFDUR (2) /* motif note durs same as firstnote, not as motif-durs */
+#define FIXED_STEP       (2) /* dec & gp note event-spacing equal */
+#define INS_TO_SCATTER   (3) /* flags instrument values are scattered:     ORN & DEC only */
+#define FORCEHI                  (4) /* Force orns, decs to highest note of chord */
+#define WHICH_CHORDNOTE  (4) /* A duplicate name for FORCEHI flag : see NOTE BELOW */
+#define FORCE_EVERY              (5) /* Force orns onto ALL notes of chord */
+#define DISCARD_ORIGLINE (6) /* after decoration: discard orig line :           DEC only */
+
+#define CYCLIC_TEXFLAG   (2)
+#define PERM_TEXFLAG     (3)
+
+
+#define TOTAL_POSSIBLE_USER_FLAGS (7) /* COUNT OF FLAGS ABOVE */
+
+/* MOD_PITCH */
+#define VTRANS_OUTTIMES         (0)
+/* MOD_REVECHO */
+#define DELAY_INVERT_FLAG       (0)
+/* EDIT_INSERT */
+#define INSERT_OVERWRITE        (0)
+#define ACCEPT_SILENT_END       (1)
+/* EDIT_SPLICE */
+#define SPLICE_START            (0)
+#define SPLICE_END                      (1)
+/* RANDCHUNKS */
+#define LINEAR                          (0)
+#define FROMSTART                       (1)
+/* HOUSE_COPY */
+#define IGNORE_COPIES           (0)
+/* HOUSE_DEL */
+#define ALL_COPIES                      (0)
+/* HOUSE_CHANS */
+#define CHAN_INVERT_PHASE       (0)
+/* HOUSE_SORT */
+#define DONT_SHOW_DURS          (0)
+/* HOUSE_EXTRACT */
+#define STOP_ON_SAMENAME        (0)
+
+#define NO_STT_TRIM                     (0)
+#define NO_END_TRIM                     (1)
+#define STT_TRIM                        (0)
+#define END_TRIM                        (1)
+/* SNDINFO */
+/* samptotime & timetosamp */
+#define CHAN_GROUPED            (0)
+/* sfdiff */
+#define IGNORE_LENDIFF          (0)
+#define IGNORE_CHANDIFF         (1)
+/* maxsamp */
+#define FORCE_SCAN                      (0)
+
+/* HOUSE RECOVER */
+#define SFREC_PHASESHIFT        (0)
+
+/* SYNTH */
+#define SYNTH_FLOAT                     (0)
+
+/* HF_PERM1 */
+
+#define HP1_MINONLY                     (0)
+#define HP1_SPAN                        (1)
+#define HP1_DENS                        (2)
+#define HP1_ELIMOCTS            (3)
+
+/* SYNTH_SPEC */
+#define SS_PICHSPRD                     (0)
+
+/* TWIXT */
+#define IS_NOTCYCL                      (0)
+
+/* DISTORT_PULSE */
+#define PULSE_KEEPSTART (0)     /* keep start of input sound before start of impulse stream */
+#define PULSE_KEEPEND   (1)     /* keep tail of input sound on end of impulse stream */
+
+/* EDIT : SUPPRESS NOISE */
+#define GET_NOISE       (0)
+
+/* STACK */
+#define STACK_SEE (0)
+
+/* SHUDDER */
+#define SHUD_BALANCE (0)
+#define SHUD_ATK         (1)
+
+/* DOUBLETS */
+#define NO_TIME_EXPAND  (0)
+
+/* SYLLABS */
+#define SYLLAB_PAIRS (0)

+ 34 - 0
dev/include/fmnts.h

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specformants(dataptr dz);
+int  specform(dataptr dz);
+int  specvocode(dataptr dz);
+int  specfmntsee(dataptr dz);
+int  outer_formsee_loop(dataptr dz);
+int  specformsee(dataptr dz);

+ 36 - 0
dev/include/focus.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specaccu(dataptr dz);
+int  specexag(int *zero_set,dataptr dz);
+int  specfold(dataptr dz);
+int  specfocus(int *peakscore,int *descnt,int *least,dataptr dz);
+int  outer_focu_loop(dataptr dz);
+int  specfreeze(dataptr dz);
+int  specfreeze2(dataptr dz);
+int  specstep(dataptr dz);

+ 52 - 0
dev/include/formants.h

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* FORMANT PARAMS */
+#define FREQWISE_FORMANTS                       (0)
+#define PICHWISE_FORMANTS                       (1)
+#define TOP_OF_LOW_OCTAVE_BANDS         (4)
+#define CHAN_ABOVE_LOW_OCTAVES          (8)
+#define IGNORE_ACTUAL_CHAN_FRQS         (1)
+#define RECTIFY_CHANNEL_FRQ_ORDER       (2)
+#define MAX_BANDS_PER_OCT                       (12)    /* semitone is max width */
+
+#define FBAND_DEFAULT                           (4)             /* default no of formant bands */
+
+#define FMNT_BUFMULT    (512)
+
+/* FORMANTS */
+int  initialise_specenv(int *arraycnt,dataptr dz);
+int  write_formant_descriptor(float **fptr1,float *fptr2,dataptr dz);
+int  initialise_specenv2(dataptr dz);
+int  get_channel_corresponding_to_frq(int *chan,double thisfrq,dataptr dz);
+int      establish_formant_band_ranges(int channels,aplptr ap);
+int  read_formantband_data_and_setup_formants(char ***cmdline,int *cmdlinecnt,dataptr dz);
+int  initialise_specenv(int *arraycnt,dataptr dz);
+int  extract_specenv(int bufptr_no,int storeno,dataptr dz);
+int  getspecenvamp(double *thisamp,double thisfrq,int storeno,dataptr dz);
+int  extract_specenv_over_partials(int *specenvcnt,double thispitch,int bufptr_no,dataptr dz);
+int  setup_formant_params(int fd,dataptr dz);
+void print_formant_params_to_screen(dataptr dz);

+ 414 - 0
dev/include/globcon.h

@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* floats verison */
+#define SHORT_BUFFERS   1                /* RWD TODO: ??? */
+
+#define CHARBITSIZE                             (8)     /* size of char in bits */
+
+
+/************************ ERROR HANDLING/RETURN **************/
+
+#define CONTINUE      (1)
+#define FINISHED      (0)
+#define GOAL_FAILED       (-1)  /* program succeeds, but users goal not achieved: e.g. find pitch */
+#define USER_ERROR    (-2)      /* program fails because wrong data, no data etc given by user */
+#define DATA_ERROR        (-3)  /* Data is unsuitable, incorrect or missing */
+#define MEMORY_ERROR  (-4)      /* program fails because ran out of, or mismanaged, memory */
+#define SYSTEM_ERROR  (-5)  /* failure to write to or truncate outfile: usually means H/D is full */
+#define PROGRAM_ERROR (-6)      /* program fails because the programming is naff */
+#define USAGE_ONLY        (-7)  /* program interrogated for usage_message only */
+#define TK_USAGE          (-8)  /* program interrogated by TK for usage_message only */
+#define BAD_INFILECNT (-9)      /* Bad infilecnt sent from TK at program testing stage */
+
+extern char errstr[];
+extern char warnstr[];
+extern char informstr[];
+extern char username[];
+
+extern int sloom;
+/* TW May 2001 */
+extern int sloombatch;
+extern int anal_infiles;
+extern int is_converted_to_stereo;
+
+/************************** GENERAL **************************/
+
+#ifndef FALSE
+#define FALSE   (0)
+#endif
+
+#ifndef TRUE
+#define TRUE    (1)
+#endif
+
+#define LAST    (TRUE)
+
+#define MAX_PARAM_LEN   (64)
+
+//#define       MAX_CHANNELS    (4)                     /* maximum number  of SNDFILE channels */
+#define MAX_CHANNELS    (16)
+#define MAX_MIX_CHANS   (STEREO)        /* maximum number  of SNDFILE channels for mixing */
+
+/* PROBLEM : maxfloat applies only to PC and I'm not sure I got it right !! */
+/* RWD this is unix version */
+/* defined in math.h on unix platforms */
+#if defined _MSC_VER || defined __GNUC__
+# ifndef MAXFLOAT
+# define        MAXFLOAT        ((float)3.40282346638528860e+38)
+# endif
+#endif
+#define FLTERR                  (0.000002)
+
+/******************* UNIVERSAL CONSTANTS AND MACROS ***********************************/
+
+//#define       MAX_SNDFILE_OUTCHANS    (4)      /* quad output, max for sndfiles, 1997 */
+//allow for double ADAT chancount!
+#define MAX_SNDFILE_OUTCHANS    (16)     /* quad output, max for sndfiles, 1997 */
+
+#define MIN_FRACTION_OF_LEVEL   (1.0/32767.0)
+//TODO: need to add 96000 and 88200
+#define LEGAL_SRATE(x)  ((x)==16000 || (x)==24000 || (x)==22050 || (x)==32000 || (x)==44100 || (x)==48000)
+
+#define ODD(x)                          ((x)&1)
+#define EVEN(x)                         (!ODD(x))
+
+#define MAXSAMP                         (32767)
+#define MINSAMP                         (-32768)
+#define ABSMAXSAMP                      (32768.0)
+//RWD floatsam versions
+#define F_MAXSAMP                       (1.0)
+#define F_MINSAMP                       (-1.0)
+#define F_ABSMAXSAMP            F_MAXSAMP
+//RWD.7.99 for BRASSAGE/GRANULA
+//#define LFACTOR                               (sizeof(long) / sizeof(short))
+//or
+#define LFACTOR                 (1)              /* RWD 4:2001 missing from tw2K verssion */
+
+#define MIN_DB_ON_16_BIT        (-96.0)
+/* RWD define positive too! */
+#define MAX_DB_ON_16_BIT        (96.0)
+#define MAXIMUM_SHORT           (32767)
+#define ABSMAXIMUM_SHORT        (32768.0)
+#define MINIMUM_SHORT           (-32768)
+
+#define BIG_TIME                        (32767.0)
+
+#define BIGARRAY                         (200)
+#define FLTERR                           (0.000002)
+#define CHARSIZE                         (8)
+#define TWO_POW_15               (32768.0)
+#define TWO_POW_14                       (16384)
+//RWD floatsam versions  (???)
+#define F_TWO_POW_15            F_MAXSAMP
+#define F_TWO_POW_14            (F_MAXSAMP * 0.5)
+/* PROBLEM : maxfloat applies only to PC and I'm not sure I got it right !! */
+
+/******************* UNIVERSAL SPEC MACROS ***********************************/
+
+#define AMPP                            (vc)     /* accesses an ampitude value in a float window */
+#define FREQ                            (vc+1)   /* accesses a frequency value in a float window */
+
+/* PROBLEM : maxfloat applies only to PC and I'm not sure I got it right !! */
+
+#define SPAN_FACTOR     (1.5)
+
+/******************* UNIVERSAL CONSTANTS AND MACROS ***********************************/
+/* RWD need this! */
+#ifndef PI
+#define PI                                       (3.141592654)
+#define TWOPI                           (2.0 * PI)
+#endif
+
+
+
+#define ROOT_2                           (1.414213562)
+#define ONE_OVER_LN2             (1.442695)
+#define LOG2(x)                          (log(x) * ONE_OVER_LN2)
+#define LOG10_OF_2                       (0.301029995)
+#define ENDOFSTR                         ('\0')
+#define NEWLINE                          ('\n')
+#define SEMITONES_PER_OCTAVE (12.0)
+#define OCTAVES_PER_SEMITONE (0.08333333333)
+#define SEMITONE_INTERVAL        (1.05946309436)
+#define SEMITONE_DOWN            (0.9438743127)
+#define SEMITONES_AS_RATIO(x)   (pow(SEMITONE_INTERVAL,(x)))
+#define VERY_TINY_VAL            (0.00000000000000000001)  /* 10^-20 */
+#define MINAMP                           (0.000000003)
+#define BIGAMP                           (10000.0)
+#define SPECIAL                          (0.00000000314159f)            /* marker value for specbare chans */
+
+#define TIME_INTERVAL            (0.05)
+#define MS_TO_SECS               (0.001)
+#define SECS_TO_MS               (1000.0)
+
+#define MINPITCH                         (9.0)          /* Pitch (Hz) corresponding, approx, to MIDI 0 */
+#define LOW_A                            (6.875)        /* Frequency of A below MIDI 0  */
+#ifndef MIDIMAX
+#define MIDIMAX                          (127)          /* RWD 12:2003  written as doubles, but otherwise duplicates defs in columns.h */
+#define MIDIMIN                          (0)
+#endif
+#define MAXWAVELEN               (.5)           /* seconds: for distort type progs */
+
+#define MONO                             (1)
+#define STEREO                           (2)
+
+#define MU_MIN_DELAY            (0.1)
+#define MU_MAX_DELAY            (100.0)
+
+#define MU_MINTEMPO_DELAY       (1.0)
+#define MU_MAXTEMPO_DELAY       (2000.0)
+
+#define MU_MIN_TEMPO            (30)
+#define MU_MAX_TEMPO            (1000)
+
+/***************** CONSTANT CONNECTED WITH PITCHDATA *****/
+
+#define DEFAULT_NYQUIST          (10000)        /* Fudge to allow brkpnt pitchdata to be tested */
+
+/***************** CONSTANT CONNECTED WITH FORMANTS *****/
+
+#define MINFBANDVAL                     (1)     /* min number of formant bands */
+#define LOW_OCTAVE_BANDS                (4)
+#define DESCRIPTOR_DATA_BLOKS   (2)
+
+/***************** CONSTANT CONNECTED WITH MIXFILES *****/
+
+#define MINPAN  (-32767.0)
+#define MAXPAN  (32767.0)
+
+#define PAN_LEFT        (-1.0)
+#define PAN_RIGHT       (1.0)
+#define PAN_CENTRE      (0.0)
+
+#define MIX_MAXLINE             (7)
+#define MIX_MIDLINE             (5)
+#define MIX_MINLINE             (4)
+#define MIX_NAMEPOS             (0)
+#define MIX_TIMEPOS             (1)
+#define MIX_CHANPOS             (2)
+#define MIX_LEVELPOS    (3)
+#define MIX_PANPOS              (4)
+#define MIX_RLEVELPOS   (5)
+#define MIX_RPANPOS             (6)
+
+#define MIDDLE_C_MIDI   (60)
+
+int     get_word_from_string(char **p,char **q);
+int     get_float_from_within_string(char **str,double *val);
+int     flteq(double f1,double f2);
+void    swap(double *d1, double *d2);
+void    iiswap(int *d1, int *d2);
+double  miditohz(double val);
+int     hztomidi(double *midi,double hz);
+double  unchecked_hztomidi(double hz);
+int     get_leveldb(char *str,double *val);
+int     get_level(char *thisword,double *level);
+int     is_dB(char *str);
+double  dbtogain(double val);
+int     is_an_empty_line_or_a_comment(char *p);
+int     is_a_comment(char *p);
+int     is_an_empty_line(char *p);
+int     float_array(float **q,int size);
+int     first_param_greater_than_second(int paramno1,int paramno2,dataptr dz);
+int     first_param_not_less_than_second(int paramno1,int paramno2,dataptr dz);
+int     establish_additional_brktable(dataptr dz);
+void    reset_filedata_counters(dataptr dz);
+
+int  open_first_infile(char *filename,dataptr dz);
+int  handle_other_infile(int fileno,char *filename,dataptr dz);
+int  get_maxvalue_in_brktable(double *brkmax,int paramno,dataptr dz);
+int  get_minvalue_in_brktable(double *brkmin,int paramno,dataptr dz);
+int  establish_file_data_storage_for_mix(int filecnt,dataptr dz);
+int  establish_bufptrs_and_extra_buffers(dataptr dz);
+
+int  setup_internal_arrays_and_array_pointers(dataptr dz);
+int  assign_process_logic(dataptr dz);
+void set_legal_infile_structure(dataptr dz);
+
+
+/* BUFFERS */
+int  allocate_large_buffers(dataptr dz);
+int  create_iterbufs(double maxpscat,dataptr dz);
+int  create_drunk_buffers(dataptr dz);
+
+int  get_maxvalue(int paramno,double *maxval,dataptr dz);
+int  convert_time_and_vals_to_samplecnts(int paramno,dataptr dz);
+int  convert_time_to_samplecnts(int paramno,dataptr dz);
+void delete_notes_here_and_beyond(noteptr startnote);
+int  make_new_note(noteptr *thisnote);
+
+/* PCONSISTENCY in distinct files */
+int  filter_pconsistency(dataptr dz);
+int  granula_pconsistency(dataptr dz);
+
+int  param_preprocess(dataptr dz);
+
+/* PREPROCESSING in distinct files */
+int  distort_preprocess(dataptr dz);
+int  distortenv_preprocess(dataptr dz);
+int  distortmlt_preprocess(dataptr dz);
+int  distortdiv_preprocess(dataptr dz);
+int  distortshuf_preprocess(dataptr dz);
+int  distortdel_preprocess(dataptr dz);
+int  distortflt_preprocess(dataptr dz);
+int  distorter_preprocess(int param1,int param2,int param3,dataptr dz);
+int  texture_preprocess(dataptr dz);
+int  zigzag_preprocess(dataptr dz);
+int  loop_preprocess(dataptr dz);
+int  scramble_preprocess(dataptr dz);
+int  iterate_preprocess(dataptr dz);
+int  drunk_preprocess(dataptr dz);
+int  grain_preprocess(int gate_paramno,dataptr dz);
+int  envel_preprocess(dataptr dz);
+int  mix_preprocess(dataptr dz);
+int  mixtwo_preprocess(dataptr dz);
+int  mixcross_preprocess(dataptr dz);
+int  get_inbetween_ratios(dataptr dz);
+int  check_new_filename(char *filename,dataptr dz);
+int  filter_preprocess(dataptr dz);
+int  check_new_filename(char *filename,dataptr dz);
+
+void initialise_random_sequence(int seed_flagno,int seed_paramno,dataptr dz);
+
+/* SOUND INPUT-OUTPUT, TABLE READING AND GLOBAL FUNCS FOR PROCESSING */
+/*int  read_bytes(char *bbuf,dataptr dz);*/
+int  read_samps(float *bbuf,dataptr dz);
+int  read_values_from_all_existing_brktables(double thistime,dataptr dz);
+int  read_value_from_brktable(double thistime,int paramno,dataptr dz);
+
+        /* spec */
+int  get_totalamp(double *totalamp,float *sbuf,int wanted);
+int  inner_loop(int *peakscore,int *descnt,int *in_start_portion,int *least,
+                int *pitchcnt,int windows_in_buf,dataptr dz);
+int  specbare(int *pitchcnt,dataptr dz);
+int  normalise(double pre_totalamp,double post_totalamp,dataptr dz);
+int  initialise_ring_vals(int thissize,double initial_amp,dataptr dz);
+int  if_one_of_loudest_chans_store_in_ring(int vc,dataptr dz);
+int  if_one_of_quietest_chans_store_in_ring(int vc,dataptr dz);
+int  rearrange_ring_to_allow_new_entry_and_return_entry_address(chvptr *here,dataptr dz);
+int  choose_bflagno_and_reset_mask_if_ness(int *bflagno,int cc,int *mask,int longpow2,int divmask);
+int      move_data_into_appropriate_channel(int vc,int truevc,float thisamp,float thisfrq,dataptr dz);
+int  move_data_into_some_appropriate_channel(int truevc,float thisamp,float thisfrq,dataptr dz);
+int  construct_filter_envelope(int pkcnt_here,float *fbuf,dataptr dz);
+int  spec_blur_and_bltr(dataptr dz);
+int  get_amp_and_frq(float *floatbuf,dataptr dz);
+int  put_amp_and_frq(float *floatbuf,dataptr dz);
+int  get_amp(float *floatbuf,dataptr dz);
+int  put_amp(float *floatbuf,dataptr dz);
+int  get_statechanges(int avcnt,int scantableno,int avpitcharrayno,int statechangearrayno,
+                                        double min_up_interval,double min_dn_interval,int datatype,dataptr dz);
+int  rectify_frqs(float *floatbuf,dataptr dz);
+int  advance_one_2fileinput_window(dataptr dz);
+int  skip_or_special_operation_on_window_zero(dataptr dz);
+int  move_along_formant_buffer(dataptr dz);
+int  outer_twofileinput_loop(dataptr dz);
+int  extract_formant_peaks2(int sl1param,int *thispkcnt,double lofrq_limit,double hifrq_limit,dataptr dz);
+int      score_peaks(int *peakscore,int sl1_var,int stabl_var,dataptr dz);
+int  collect_scores(int *cnt,int *descnt,dataptr dz);
+int  sort_design(int no_of_design_elements,dataptr dz);
+int  sort_equivalent_scores(int this_pkcnt,dataptr dz);
+int  unscore_peaks(int *peakscore,dataptr dz);
+int  specpfix(dataptr dz);
+int  specrepitch(dataptr dz);
+
+        /* filters */
+void get_coeffs1(int n,dataptr dz);
+void get_coeffs2(int n,dataptr dz);
+
+int  file_has_invalid_startchar(char *filename);
+int  file_has_reserved_extension(char *filename);
+int  file_has_invalid_extension(char *filename);
+int  derived_filetype(int filetype);
+
+int  pvoc_preprocess(dataptr dz);
+
+int  set_internalparam_data(const char *this_paramlist,aplptr ap);
+
+int  convert_msecs_to_secs(int brktableno,dataptr dz);
+int  establish_bottom_frqs_of_channels(dataptr dz);
+int  establish_testtone_amps(dataptr dz);
+int  setup_ring(dataptr dz);
+int  setup_internal_bitflags(int bflag_array_no,int longpow,int divmask, dataptr dz);
+int  log2_of_the_number_which_is_a_power_of_2(int *n,int k);
+int two_to_the_power_of(int k);
+int  init_bitflags_to_zero(int bflag_array_no,dataptr dz);
+int  setup_stability_arrays_and_constants(int stability_val,int sval_less_one,dataptr dz);
+
+int  zero_sound_buffers(dataptr dz);
+
+int  initialise_window_frqs(dataptr dz);
+int  read_both_files(int *windows_in_buf,int *got,dataptr dz);
+int  outer_loop(dataptr dz);
+int  gen_amplitude_in_lo_half_filterband(double *thisamp,double thisfrq,double filt_centre_frq,dataptr dz);
+int  gen_amplitude_in_hi_half_filterband(double *thisamp,double thisfrq,double filt_centre_frq,dataptr dz);
+int  filter_band_test(dataptr dz);
+
+void convert_shiftp_vals(dataptr dz);
+
+int create_sndbufs(dataptr dz);
+int allocate_single_buffer(dataptr dz);
+int allocate_double_buffer(dataptr dz);
+int allocate_triple_buffer(dataptr dz);
+int allocate_single_buffer_plus_extra_pointer(dataptr dz);
+int lcm_for_buffers(unsigned int *lcm,int a,int b);
+int allocate_analdata_plus_formantdata_buffer(dataptr dz);
+int calculate_analdata_plus_formantdata_buffer(unsigned int *buffersize,dataptr dz);
+
+int  get_process_no(char *prog_identifier_from_cmdline,dataptr dz);
+int  get_mode_from_cmdline(char *str,dataptr dz);
+int  get_process_no(char *prog_identifier_from_cmdline,dataptr dz);
+
+int  establish_spec_bufptrs_and_extra_buffers(dataptr dz);
+void setup_process_logic(int input,int process,int output,dataptr dz);
+
+int do_the_bltr(int *last_total_windows,float *ampdif,float *freqdif,int blurfactor,dataptr dz);
+
+void handle_pitch_zeros(dataptr dz);
+int      check_depth_vals(int param_no,dataptr dz);
+
+void rectify_window(float *flbuf,dataptr dz);
+int  get_longer_file(dataptr dz);
+//TW UPDATE
+//int  keep_excess_bytes_from_correct_file(int *bytes_to_write,int file_to_keep,int got,int wc,dataptr dz);
+int  keep_excess_samps_from_correct_file(int *bytes_to_write,int file_to_keep,int got,int wc,dataptr dz);
+int  read_either_file(int *bytes_read,int file_to_keep,dataptr dz);
+
+int sound_loom_in_use(int *argc, char **argv[]);
+
+/* TEST ONLY */
+int x(int y);
+
+#define MAX_CYCLECNT    (32767.0)               /* arbitrary */
+#define MAX_GRS_HVELOCITY       (32767.0)       /* max when using shorts, so has to be max */
+#define BIG_VALUE               (32767.0)               /* arbitrary */
+#define NOT_PITCH (-1.0)
+#define NOT_SOUND (-2.0)
+
+//TW FLOAT REVISIONS
+/* replace MAXSAMP by a maximum range value, where it is used only for this purpose */
+#define MAXRANGE (32767)
+#define MINRANGE (-32768)

+ 48 - 0
dev/include/graicon.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*********************************** GRAIN ********************************/
+
+#define GRAIN_SPLICELEN (15.0)  /* mS */
+#define GRAIN_SAFETY     (1.0)  /* mS */
+#define GR_INTERPLIMIT  (1000)  /* stereo-samples */
+#define CAPITALISE               (-32)  /* convert lower-case to up[per-case ASCII */
+#define ALPHABASE                ('A')  /* lowest ASCII value */
+#define GR_MAX_TRANSPOS  (4.0)  /* max grain transposition in octaves */
+#define GR_MAX_OUT_OF    (64.0) /* max fraction of omitted grains = 63/64 */
+#define GR_MIN_TSTRETCH  (.001)
+#define GR_MAX_TSTRETCH  (1000.0)
+#define GR_GATE_DEFAULT  (0.3)
+#define GR_MAX_OFFSET           (32767.0)       /* arbitrary */
+#define MAX_FIRSTGRAIN_TIME     (32767.0)       /* arbitrary */
+#define SPLBUF_OFFSET    (2)                    /* first 2 extrabufs are for splices */
+                                                                                /* remainder store grains for reordering */
+#define NOMINAL_LENGTH   (2)                    /* size of pre-malloced arrays */
+
+#define LOW_RRR_SIZE     (15)                   /* 15 ms is approx size of fast rrr-flap */
+
+#define NOIS_MIN_FRQ    (6000.0)
+#define GR_MINDUR        (0.1)

+ 32 - 0
dev/include/grain.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <graicon.h>
+#include        <grain1.h>

+ 45 - 0
dev/include/grain1.h

@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* GRAIN1.H */
+/*RWD 6:2001 purged decls of local statics */
+
+int  process_grains(dataptr dz);
+int  copygrain(int start,int end,int bufno,int *obufposition,dataptr dz);
+int  crosbuf_grain_type3(int grainstart,int grainend,int bufno,int *obufpos,dataptr dz);
+int  do_the_grain(int ibufpos,int *graincnt,int bufno,int gapcnt,int *obufpos,int grainstart,
+                                int crosbuf,int chans,int *grainadjusted,double samptotime,int *is_first_grain,dataptr dz);
+//TW REVISED
+int  deal_with_last_grains(int ibufpos,int bufno,int *graincnt,int grainstart,int *grainadjusted,
+                                int *obufpos,int crosbuf,int chans,double samptotime,int *is_first_grain,dataptr dz);
+int  swap_to_otherfile_and_readjust_counters(dataptr dz);
+int timestretch_iterative(dataptr dz);
+int     assess_grains(dataptr dz);
+int  grain_preprocess(int gate_paramno,dataptr dz);
+int  timestretch_iterative2(dataptr dz);
+int  timestretch_iterative3(dataptr dz);
+int  grab_noise_and_expand(dataptr dz);
+int      grev(dataptr dz);

+ 30 - 0
dev/include/headread.h

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+int readhead(infileptr inputfile,int ifd,char *filename,double *maxamp,double *maxloc, int *maxrep,int getmax,int getmaxinfo);
+int  is_a_pitchfile(int ifd);
+int  is_a_transposfile(int ifd);
+int  is_a_formantfile(int ifd);

+ 48 - 0
dev/include/hfperm.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define MAX_HFPERMSET (48.0)
+#define HFP_OUTLEVEL (0.8)
+#define HFP_TABSIZE (2048)
+#define HFP_MAXJITTER (15.0)
+#define HP1_SPLICELEN (15.0)
+
+int do_hfperm(dataptr dz);
+
+#define ROOT            (0)
+#define TOP                     (1)
+#define PCLASS          (2)
+#define CHORDTYPE       (3)
+#define CHORD_1         (4)
+
+#define MAXSPAN_LAST    (0)     /* means nothing for chords */
+#define MAXSPAN_FIRST   (1)     /* means nothing for chords */
+
+/* both means nothing for chords OR density */
+#define DENSE_SORT      (0)     /* sort by DENSITY */
+#define OTHER_SORT      (1)     /* for ROOT & TOP, sort by INTSTAK : for PCLASS, sort by MAXINT then DENSITY */
+
+int gen_dp_output(dataptr dz);

+ 35 - 0
dev/include/highlight.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specfilt(dataptr dz);
+int  specgreq(dataptr dz);
+int  specsplit(dataptr dz) ;
+int  specarpe(int *in_start_portion,dataptr dz);
+int  specpluck(dataptr dz);
+int  spectrace(dataptr dz);
+int  vowel_filter(dataptr dz);

+ 133 - 0
dev/include/house.h

@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#ifndef _CDP_HOUSE_H_INCLUDED
+#define _CDP_HOUSE_H_INCLUDED
+#define IS_GROUCHO_COMPILE      (1)
+
+#define MAXDUPL                         (999)
+#define COPYDEL_OVERMAX         (10)
+#define SORT_SMALL_DEFAULT  (1.0)
+#define SORT_LARGE_DEFAULT  (16.0)
+#define SORT_STEP_DEFAULT   (1.0)
+#define SORT_LSTEP_DEFAULT  (2.0)
+#define MIN_SORT_DUR        (0.005)
+#define MAX_SORT_DUR        (120.0)
+#define MIN_SORT_STEP       (0.005)
+#define MAX_SORT_STEP       (60.0)
+#define MIN_SORT_LSTEP      (1.414)
+#define MAX_SORT_LSTEP      (8.0)
+#define CUTGATE_SPLICELEN   (15.0)
+#define CUTGATE_MINSPLICE   (2.0)
+#define CUTGATE_MAXSPLICE   (200.0)
+#define CUTGATE_MAX_SUSTAIN (64)
+#define CUTGATE_MAXBAKTRAK      (64)
+#define CUTGATE_MAXWINDOWS      (64)
+#define TOPNTAIL_SPLICELEN      (2)
+#define DUMPFILE_CHANNELS   (2)
+#define DUMPFILE_SRATE      (48000)
+
+#define BLEEP   (0)
+#define HEADERS (1)
+#define SOUND   (2)
+#define SHORT   (3)
+
+#define CYCLECNT          (512) /* number of square wave cycles in bleep */
+#define HALFCYCLE          (50) /* square-wave is 50 * 2 samples long    */
+#define SQUAREAMP        (8000) /* amplitude of square-wave bleep        */
+#define HEADSIZE  (SECSIZE * 2) /* bytesize of sndfile header in dumpfile*/
+#define HALFHEADSIZE  (SECSIZE) /* half size of sndfile header, in bytes */
+#define HEADCOPIES        (100) /* number of bakup copies of header      */
+#define DUMPDATSIZE ((CYCLECNT*HALFCYCLE*2*sizeof(short))+(HEADSIZE*HEADCOPIES))
+#define TW_MAGIC    (271828182) /* e */
+
+#define FIRST_HALF_SF_MAGIC             (30244)
+#define SECOND_HALF_SF_MAGIC    (5522)
+#define FIRST_HALF_TW_MAGIC             (-15146)
+#define SECOND_HALF_TW_MAGIC    (4147)
+
+#define OK_COUNT                (.25)   /* min fraction header_copies to recover    */
+#define OK_MARKER               (.33)   /* frac of a header_marker OK  to validate  */
+#define OK_SAME                 (.5)    /* frac of header to be same, to be a copy  */
+
+#define HEADSEARCHSIZE  ((HEADSIZE*HEADCOPIES)+SECSIZE)
+
+#define COPY_HEADER_WRITTEN (0)
+#define HEADER_SIZE_DEFINED (0)
+
+#define SHSECSIZE                       (SECSIZE/sizeof(short))
+
+// TW NEW
+//#define WHOLESECT(x)      (((x)/SHSECSIZE)*SHSECSIZE==(x))
+#define WHOLESECT(x)        (((x)/(int)SHSECSIZE)*(int)SHSECSIZE==(x))
+
+#define NAMESIZE            (64)
+#define FILESIZE_SIZE           (sizeof(int))
+#define MAGIC_SIZE                      (sizeof(int))
+#define CRC_SIZE                        (sizeof(int))
+
+
+// TW NEW
+//#define SFREC_SHIFT_MIN               (-100)
+//#define SFREC_SHIFT_MAX               (100)
+#define SFREC_SHIFT_MIN         (-10)
+#define SFREC_SHIFT_MAX         (10)
+
+
+
+typedef unsigned char   uchar;
+
+int             pconsistency_clean(dataptr dz);
+
+int     create_respec_buffers(dataptr dz);
+int             create_clean_buffers(dataptr dz);
+int     create_bakup_buffers(dataptr dz);
+int     create_recover_buffer(dataptr dz);
+
+int     sort_preprocess(dataptr dz);
+int     respec_preprocess(dataptr dz);
+
+int             do_duplicates(dataptr dz);
+int             do_deletes(dataptr dz);
+int     do_channels(dataptr dz);
+int     do_bundle(dataptr dz);
+int     do_file_sorting(dataptr dz);
+int     do_respecification(dataptr dz);
+int             process_clean(dataptr dz);
+int     sfdump(dataptr dz);
+int     sfrecover(dataptr dz);
+int     sum32(register int, register uchar *, int);
+
+//TW NEW
+int             check_available_diskspace(dataptr dz);
+int             house_bakup(dataptr dz);
+int             house_gate(dataptr dz);
+int             batch_expand(dataptr dz);
+int             house_gate2(dataptr dz);
+
+#define BAKUP_GAP (1.0)
+
+#endif

+ 39 - 0
dev/include/localcon.h

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#include <speccon.h>
+#include <distcon.h>
+#include <envlcon.h>
+#include <extdcon.h>
+#include <filtcon.h>
+#include <graicon.h>
+#include <mixxcon.h>
+#include <modicon.h>
+#include <txtucon.h>
+#include <hfperm.h>
+#include <edit.h>
+#include <house.h>
+#include <synth.h>

+ 102 - 0
dev/include/logic.h

@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************* OUTPUT FILE TYPES ***************************************/
+
+#define NO_OUTPUTFILE                      (0)
+#define SNDFILE_OUT                        (1)
+#define ANALFILE_OUT                       (2)
+#define PITCH_OUT                          (3)
+#define TRANSPOS_OUT                       (4)
+#define FORMANTS_OUT                       (5)
+#define TEXTFILE_OUT                       (6)
+#define ENVFILE_OUT                                (7)
+#define BRKFILE_OUT                                (8)
+
+/******************* PROCESS TYPES ***************************************/
+
+#define UNEQUAL_SNDFILE                         (0)
+#define EQUAL_ANALFILE                      (1)
+#define MAX_ANALFILE                        (2)
+#define MIN_ANALFILE                        (3)
+#define BIG_ANALFILE                        (4)
+#define PSEUDOSNDFILE                       (5)
+#define TO_TEXTFILE                                 (6)
+#define ANAL_TO_FORMANTS                    (7)
+#define ANAL_TO_PITCH                       (8)
+#define PITCH_TO_PITCH                      (9)
+#define PITCH_TO_BIGPITCH                   (10)
+#define PITCH_TO_ANAL                       (11)
+#define PITCH_TO_PSEUDOSND                  (12)
+#define EQUAL_FORMANTS                      (13)
+#define SCREEN_MESSAGE                      (14)
+#define EQUAL_SNDFILE                           (15)
+#define EQUAL_ENVFILE                           (16)
+#define UNEQUAL_ENVFILE                         (17)
+#define CREATE_ENVFILE                          (18)
+#define EXTRACT_ENVFILE                         (19)
+#define OTHER_PROCESS                           (20)
+
+/************************** INPUT PROCESS TYPE *****************************************/
+
+#define ANY_NUMBER_OF_ANY_FILES (-3)
+#define ALL_FILES                               (-2)
+#define NO_FILE_AT_ALL                  (-1)
+#define SNDFILES_ONLY                   (0)             /* Default */
+#define ANALFILE_ONLY                   (1)
+#define TWO_ANALFILES                   (2)
+#define THREE_ANALFILES                 (3)
+#define MANY_ANALFILES                  (4)
+#define FORMANTFILE_ONLY                (5)
+#define PITCHFILE_ONLY                  (6)
+#define PITCH_OR_TRANSPOS               (7)
+#define ANAL_AND_FORMANTS               (8)
+#define PITCH_AND_FORMANTS              (9)
+#define PITCH_AND_PITCH                 (10)
+#define PITCH_AND_TRANSPOS              (11)
+#define TRANSPOS_AND_TRANSPOS   (12)
+#define ANAL_WITH_PITCHDATA             (13)
+#define ANAL_WITH_TRANSPOS              (14)
+#define TWO_SNDFILES                    (15)
+#define MANY_SNDFILES                   (16)
+#define ENVFILES_ONLY                   (17)
+#define BRKFILES_ONLY                   (18)    /* NB ONLY WORKS with a SINGLE brkfile */
+#define DB_BRKFILES_ONLY                (19)
+#define SNDFILE_AND_ENVFILE             (20)
+#define SNDFILE_AND_BRKFILE             (21)
+#define SNDFILE_AND_DB_BRKFILE  (22)
+#define MIXFILES_ONLY                   (23)
+#define SNDLIST_ONLY                    (24)
+#define SND_OR_MIXLIST_ONLY             (25)
+#define SND_SYNC_OR_MIXLIST_ONLY (26)
+#define WORDLIST_ONLY                   (27)
+#define ONE_OR_MANY_SNDFILES    (28)
+#define UNRANGED_BRKFILE_ONLY   (29)
+#define TWO_WORDLISTS                   (30)
+#define SNDFILE_AND_UNRANGED_BRKFILE    (31)
+//TW NEW
+#define PFE                                             (32)
+#define ONE_OR_MORE_SNDSYS          (33)

+ 52 - 0
dev/include/menuno.h

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define SPEC_SIMPLE_MENU                (0)
+#define SPEC_STRETCH_MENU               (1)
+#define SPEC_PITCH_MENU                 (2)
+#define SPEC_HIGHLIGHT_MENU             (3)
+#define SPEC_FOCUS_MENU                 (4)
+#define SPEC_BLUR_MENU                  (5)
+#define SPEC_STRANGE_MENU               (6)
+#define SPEC_MORPH_MENU                 (7)
+#define SPEC_REPITCH_MENU               (8)
+#define SPEC_FORMANTS_MENU              (9)
+#define SPEC_COMBINE_MENU               (10)
+#define SPEC_INFO_MENU                  (11)
+#define SPEC_PINFO_MENU                 (12)
+#define DISTORT_MENU                    (13)
+#define EXTEND_MENU                             (14)
+#define FILTER_MENU                             (15)
+#define GRAIN_MENU                              (16)
+#define MIX_MENU                                (17)
+#define ENVEL_MENU                              (18)
+#define TEXTURE_MENU                    (19)
+#define EDIT_MENU                               (20)
+#define HOUSEKEEP_MENU                  (21)
+#define SNDINFO_MENU                    (22)
+#define UTILITIES_MENU                  (23)
+#define MODIFY_MENU                             (24)
+#define PVOC_MENU                               (25)

+ 34 - 0
dev/include/mix.h

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <mixxcon.h>
+#include        <mix1.h>
+
+int  set_up_mix(dataptr dz);

+ 84 - 0
dev/include/mix1.h

@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+int  set_up_mix(dataptr dz);
+int  mix_syntax_check(dataptr dz);
+int  mix_preprocess(dataptr dz);
+int  mmix(dataptr dz);
+int  mix_syntax_check(dataptr dz);
+int  mix_level_check(double *normalisation,dataptr dz);
+int  create_mixdummy(dataptr dz);
+int      mix_twisted(dataptr dz);
+
+int  mix_gain(dataptr dz);
+int  mix_timewarp(dataptr dz);
+int  mix_spacewarp(dataptr dz);
+int  mix_shufl(dataptr dz);
+
+int  do_time_manip(dataptr dz);
+int  do_time_and_name_copy(dataptr dz);
+int  do_name_reverse(dataptr dz);
+int  do_name_and_time_reverse(dataptr dz);
+int  do_name_freeze(dataptr dz);
+int  do_name_and_time_freeze(dataptr dz);
+int  randomise_names(dataptr dz);
+int  get_maxwordsize(int **maxwordsize,dataptr dz);
+int  output_mixfile_lines(int *maxwordsize,dataptr dz);
+int  read_new_filename(char *filename,dataptr dz);
+
+int  mix_twisted(dataptr dz);
+int  check_new_filename(char *filename,dataptr dz);
+int  mix_sync(dataptr dz);
+int  mix_sync_a_mixfile(dataptr dz);
+int  open_file_and_retrieve_props(int filecnt,char *filename,int *srate,dataptr dz);
+int  open_file_retrieve_props_open(int filecnt,char *filename,int *srate,dataptr dz);
+int  synchronise_mix_attack(dataptr dz);
+int  get_level(char *thisword,double *level);
+int  sync_and_output_mixfile_line
+         (int n,char *filename,int max_namelen,int max_timeword,double timestor,double gain,dataptr dz);
+int  retime_the_lines(double *timestor,int maxpostdec,dataptr dz);
+int  timesort_mixfile(double *timestor,dataptr dz);
+
+int  mixtwo_preprocess(dataptr dz);
+int  mixtwo(dataptr dz);
+//TW NEW
+int  mixmany(dataptr dz);
+
+int  mix_cross(dataptr dz);
+int  mixcross_preprocess(dataptr dz);
+int  mix_interl(dataptr dz);
+int  mix_inbetween(dataptr dz);
+int  get_inbetween_ratios(dataptr dz);
+
+int  open_file_and_retrieve_props(int filecnt,char *filename,int *srate,dataptr dz);
+int  cross_stitch(dataptr dz);
+
+//TW NEW
+int  do_automix(dataptr dz);
+int  addtomix(dataptr dz);
+int  panmix(dataptr dz);
+int  mix_model(dataptr dz);
+int reset_up_mix(dataptr dz);

+ 98 - 0
dev/include/mixxcon.h

@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*********************************** MIX ***********************************/
+
+#define MIX_ACTION_OFF          (0)
+#define MIX_ACTION_ON           (1)
+#define MIX_ACTION_REFILL       (2)
+
+/*
+defined elsewhere....
+#define MONO                             (1)
+#define STEREO                           (2)
+*/
+#define MONO_TO_LEFT             (3)
+#define MONO_TO_RIGHT            (4)
+#define MONO_TO_CENTRE           (5)
+#define MONO_TO_STEREO           (6)
+#define STEREO_MIRROR            (7)
+#define STEREO_TO_CENTRE         (8)
+#define STEREO_TO_LEFT           (9)
+#define STEREO_TO_RIGHT          (10)
+#define STEREO_PANNED            (11)
+#define STEREOLEFT_TO_LEFT       (12)
+#define STEREOLEFT_TO_RIGHT      (13)
+#define STEREOLEFT_PANNED        (14)
+#define STEREORIGHT_TO_LEFT      (15)
+#define STEREORIGHT_TO_RIGHT (16)
+#define STEREORIGHT_PANNED       (17)
+
+#define MIX_MAXLINE             (7)
+#define MIX_MIDLINE             (5)
+#define MIX_MINLINE             (4)
+#define MIX_NAMEPOS             (0)
+#define MIX_TIMEPOS             (1)
+#define MIX_CHANPOS             (2)
+#define MIX_LEVELPOS    (3)
+#define MIX_PANPOS              (4)
+#define MIX_RLEVELPOS   (5)
+#define MIX_RPANPOS             (6)
+
+#define POSITIONS               (32)
+#define HALF_POSTNS     (16)
+
+#define DEFAULT_DECIMAL_REPRESENTATION  (5)
+#define MIN_WINFAC              (1)
+#define MAX_WINFAC              (32)
+
+#define MAX_MCR_POWFAC  (8.0)
+#define MIN_MCR_POWFAC  (1.0/MAX_MCR_POWFAC)
+
+#define MCR_LINEAR              (0)
+#define MCR_COSIN               (1)
+#define MCR_SKEWED              (2)
+
+#define MCR_TABLEN              (512)
+
+#define MAX_MI_OUTCHANS (1000)
+#define INT_TO_ASCII    (48)
+
+#define DEFAULT_BETWEEN (8)
+#define MAXBETWEEN      (999)
+
+#define MINPAN                  (-32767.0)
+#define MAXPAN                  (32767.0)
+#define OBUFMIX                 (0)
+#define STEREOBUF               (1)
+#define IBUFMIX                 (2)
+
+#define PAN_LEFT                (-1.0)
+#define PAN_RIGHT               (1.0)
+#define PAN_CENTRE              (0.0)
+
+#define SAMPLE_RATE_DIVIDE      (28000) /* divides possible samprates int hi_sr and lo_sr */
+#define DEFAULT_BTWNFRQ (4000.0)

+ 686 - 0
dev/include/modeno.h

@@ -0,0 +1,686 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+                                                                /** MODE NAMES **/
+
+/*********************************** SPEC ***********************************/
+
+/* MODES for ALT */
+
+#define DELETE_ODD  (0)
+#define DELETE_EVEN (1)
+
+/* MODES for ARPE */
+
+#define ON                      (0)
+#define BOOST           (1)
+#define BELOW_BOOST (2)
+#define ABOVE_BOOST (3)
+#define BELOW           (4)
+#define ABOVE           (5)
+#define ONCE_BELOW      (6)
+#define ONCE_ABOVE      (7)
+
+/* MODES for BRIDGE */
+
+#define BRG_NO_NORMALISE         (0)
+#define BRG_NORM_TO_MIN      (1)
+#define BRG_NORM_TO_FILE1    (2)
+#define BRG_NORM_TO_FILE2    (3)
+#define BRG_NORM_FROM_1_TO_2 (4)
+#define BRG_NORM_FROM_2_TO_1 (5)
+
+
+/* MODES for CHORUS */
+
+#define CH_AMP            (0)
+#define CH_FRQ            (1)
+#define CH_FRQ_UP         (2)
+#define CH_FRQ_DN         (3)
+#define CH_AMP_FRQ        (4)
+#define CH_AMP_FRQ_UP (5)
+#define CH_AMP_FRQ_DN (6)
+
+/* MODES for CLEAN */
+
+#define FROMTIME          (0)
+#define ANYWHERE          (1)
+#define FILTERING         (2)
+#define COMPARING         (3)
+
+/* MODES for FILT */
+
+#define F_HI              (0)
+#define F_HI_NORM         (1)
+#define F_LO              (2)
+#define F_LO_NORM         (3)
+#define F_HI_GAIN         (4)
+#define F_LO_GAIN         (5)
+#define F_BND             (6)
+#define F_BND_NORM        (7)
+#define F_NOTCH           (8)
+#define F_NOTCH_NORM  (9)
+#define F_BAND_GAIN       (10)
+#define F_NOTCH_GAIN  (11)
+
+/* MODES for FORM */
+
+#define FORM_REPLACE  (0)
+#define FORM_IMPOSE   (1)
+
+/* MODES for FREEZE */
+
+#define FRZ_AMP         (0)
+#define FRZ_FRQ         (1)
+#define FRZ_AMP_AND_FRQ (2)
+
+/* MODES for GLIS */
+
+#define SHEPARD           (0)
+#define INHARMONIC    (1)
+#define SELFGLIS      (2)
+
+/* MODES for GREQ */
+
+#define GR_ONEBAND        (0)
+#define GR_MULTIBAND  (1)
+
+/* MODES for INVERT */
+
+#define INV_NORMAL        (0)
+#define INV_KEEPAMP   (1)
+
+/* MODES for MEAN */
+
+#define MEAN_AMP_AND_PICH (0)
+#define MEAN_AMP_AND_FRQ  (1)
+#define AMP1_MEAN_PICH    (2)
+#define AMP1_MEAN_FRQ     (3)
+#define AMP2_MEAN_PICH    (4)
+#define AMP2_MEAN_FRQ     (5)
+#define MAXAMP_MEAN_PICH  (6)
+#define MAXAMP_MEAN_FRQ   (7)
+
+/* MODES for MORPH */
+
+#define MPH_LINE          (0)
+#define MPH_COSIN     (1)
+
+/* MODES for OCT */
+
+#define OCT_UP            (0)
+#define OCT_DN            (1)
+#define OCT_DN_BASS   (2)
+
+/* MODES FOR P_APPROX,    P_INVERT, P_QUANTISE,
+                         P_RANDOMISE, P_SMOOTH, P_VIBRATO */
+
+#define PICH_OUT          (0)
+#define TRANSP_OUT    (1)
+
+/* MODES for P_CUT */
+
+#define PCUT_START_ONLY (0)
+#define PCUT_END_ONLY   (1)
+#define PCUT_BOTH           (2)
+
+/* MODES for P_EXAG */
+
+#define RANGE_ONLY_TO_P   (0)
+#define RANGE_ONLY_TO_T   (1)
+#define CONTOUR_ONLY_TO_P (2)
+#define CONTOUR_ONLY_TO_T (3)
+#define R_AND_C_TO_P      (4)
+#define R_AND_C_TO_T      (5)
+
+/* MODES for P_SEE */
+
+#define SEE_PITCH     (0)
+#define SEE_TRANSPOS  (1)
+
+/* MODES for P_TRANSPOSE */
+
+#define PTR_RATIO         (0)
+#define PTR_SEMITONES (1)
+
+/* MODES for PICK */
+
+#define PIK_HARMS                       (0)
+#define PIK_OCTS                        (1)
+#define PIK_ODD_HARMS           (2)
+#define PIK_LINEAR                      (3)
+#define PIK_DISPLACED_HARMS     (4)
+
+/* MODES for PITCH */
+
+#define PICH_TO_BIN       (0)
+#define PICH_TO_BRK       (1)
+
+/* MODES for REPORT */
+
+#define FRQ_ORDERED_TIMED   (0)
+#define AMP_ORDERED_TIMED   (1)
+#define FRQ_ORDERED_UNTIMED (2)
+#define AMP_ORDERED_UNTIMED (3)
+
+/* MODES for REPITCH and REPITCHB */
+
+#define PPT                       (0)
+#define PTP                       (1)
+#define TTT                       (2)
+#define PPT_TO_BRK        (3)
+#define PTP_TO_BRK        (4)
+#define TTT_TO_BRK        (5)
+
+
+/* MODES for SHIFT */
+
+#define SHIFT_ALL         (0)
+#define SHIFT_ABOVE       (1)
+#define SHIFT_BELOW       (2)
+#define SHIFT_BETWEEN (3)
+#define SHIFT_OUTSIDE (4)
+
+/* MODES for SHIFTP */
+
+#define P_OCT_UP                 (0)
+#define P_OCT_DN                 (1)
+#define P_OCT_UP_AND_DN  (2)
+#define P_SHFT_UP                (3)
+#define P_SHFT_DN                (4)
+#define P_SHFT_UP_AND_DN (5)
+
+/* MODES for STRETCH */
+
+#define STRETCH_ABOVE (0)
+#define STRETCH_BELOW (1)
+
+/* MODES for TRACE */
+
+#define TRC_ALL           (0)
+#define TRC_ABOVE         (1)
+#define TRC_BELOW         (2)
+#define TRC_BETWEEN       (3)
+
+/* MODES for TRACK */
+
+#define TRK_TO_BIN        (0)
+#define TRK_TO_BRK        (1)
+
+/* MODES for TRNSF and TRNSP */
+
+#define TRNS_RATIO        (0)
+#define TRNS_OCT          (1)
+#define TRNS_SEMIT        (2)
+#define TRNS_BIN          (3)
+
+/* MODES for TUNE */
+
+#define TUNE_FRQ          (0)
+#define TUNE_MIDI         (1)
+
+/* MODES for WAVER */
+
+#define WAVER_STANDARD  (0)
+#define WAVER_SPECIFIED (1)
+
+/* MODES for TSTRETCH */
+
+#define TSTR_NORMAL  (0)
+#define TSTR_LENGTH  (1)
+
+/******** MODE NUMBERS FOR INDIVIDUAL DISTORT PROGRAMS *********/
+
+/* MODES FOR DISTORT */
+
+#define DISTORT_SQUARE_FIXED            (0)
+#define DISTORT_SQUARE                          (1)
+#define DISTORT_TRIANGLE_FIXED          (2)
+#define DISTORT_TRIANGLE                        (3)
+#define DISTORT_INVERT_HALFCYCLE        (4)
+#define DISTORT_CLICK                           (5)
+#define DISTORT_SINE                            (6)
+#define DISTORT_EXAGG                           (7)
+
+/* MODES FOR DISTORT_ENV */
+#define DISTORTE_RISING         (0)
+#define DISTORTE_FALLING        (1)
+#define DISTORTE_TROFFED        (2)
+#define DISTORTE_USERDEF        (3)
+                /* internal */
+#define DISTORTE_LINRISE    (4)
+#define DISTORTE_LINFALL    (5)
+#define DISTORTE_LINTROF    (6)
+#define DISTORTE_RISING_TR  (7)
+#define DISTORTE_FALLING_TR (8)
+#define DISTORTE_LINRISE_TR (9)
+#define DISTORTE_LINFALL_TR (10)
+
+/* MODES FOR DISTORT_DEL */
+
+#define DELETE_IN_STRICT_ORDER  (0)     /* Original DIVIDE      */
+#define KEEP_STRONGEST                  (1)     /* Original flag -1     */
+#define DELETE_WEAKEST                  (2)     /* Original flag 0      */
+
+/* MODES FOR DISTORT_FLT */
+
+#define DISTFLT_HIPASS          (0)
+#define DISTFLT_LOPASS          (1)
+#define DISTFLT_BANDPASS        (2)
+
+/* MODES FOR DISTORT_INT */
+
+#define DISTINT_INTRLV          (0)      /* interleave: original type 1 */
+#define DISTINT_RESIZE          (1)      /* resize:     original type 2 */
+
+/* MODES FOR DISTORT_OVERLOAD */
+
+#define OVER_NOISE                      (0)
+#define OVER_SINE                       (1)
+
+/* MODES FOR DISTORT_PULSE */
+
+#define PULSE_IMP                       (0)
+#define PULSE_SYN                       (1)
+#define PULSE_SYNI                      (2)
+
+/******** MODE NUMBERS FOR INDIVIDUAL ENVELOPE PROGRAMS *********/
+
+/* IMPOSE,REPLACE */
+#define ENV_SNDFILE_IN          (0)
+#define ENV_ENVFILE_IN          (1)
+#define ENV_BRKFILE_IN          (2)
+#define ENV_DB_BRKFILE_IN       (3)
+/* CREATE,EXTRACT */
+#define ENV_ENVFILE_OUT (0)
+#define ENV_BRKFILE_OUT (1)
+/* WARPING,RESHAPING,REPLOTTING */
+#define ENV_NORMALISE   (0)
+#define ENV_REVERSE             (1) /* from warp */
+
+#define ENV_EXAGGERATING (2)
+#define ENV_ATTENUATING (3) /* from warp */
+#define ENV_LIFTING             (4) /* from warp */
+#define ENV_TSTRETCHING (5)
+
+#define ENV_FLATTENING  (6)
+
+#define ENV_GATING              (7)
+
+
+#define ENV_INVERTING   (8)
+#define ENV_LIMITING    (9)
+
+#define ENV_CORRUGATING (10)
+
+#define ENV_EXPANDING   (11)
+
+#define ENV_TRIGGERING  (12)
+#define ENV_CEILING     (13)
+#define ENV_DUCKED              (14)
+#define ENV_PEAKCNT     (15)
+/* DOVETAILING */
+#define DOVE            (0)
+#define DOVEDBL         (1)
+/* CURTAILING */
+#define ENV_START_AND_END       (0)
+#define ENV_START_AND_DUR       (1)
+#define ENV_START_ONLY      (2)
+#define ENV_START_AND_END_D     (3)
+#define ENV_START_AND_DUR_D     (4)
+#define ENV_START_ONLY_D    (5)
+/* ATTACK */
+#define ENV_ATK_GATED       (0)
+#define ENV_ATK_TIMED       (1)
+#define ENV_ATK_XTIME       (2)
+#define ENV_ATK_ATMAX       (3)
+/* TREMOL */
+#define ENV_TREM_LIN        (0)
+#define ENV_TREM_LOG        (1)
+
+/******** MODE NUMBERS FOR INDIVIDUAL EXTEND PROGRAMS *********/
+
+/* MODES FOR ZIGZAG */
+#define ZIGZAG_SELF             (0)
+#define ZIGZAG_USER             (1)
+
+/* MODES FOR LOOP */
+#define LOOP_ALL                (0)
+#define LOOP_OUTLEN             (1)
+#define LOOP_RPTS               (2)
+
+/* MODES FOR SCRAMBLE */
+#define SCRAMBLE_RAND   (0)
+#define SCRAMBLE_SHRED  (1)
+
+/* MODES FOR ITERATE */
+#define ITERATE_DUR             (0)
+#define ITERATE_REPEATS (1)
+
+/* MODES FOR DRUNKWALK */
+#define TOTALLY_PISSED    (0)
+#define HAS_SOBER_MOMENTS (1)
+
+/******************* MODES ********************/
+
+/* fltbanku,fltbankv,fltiter, lphp */
+#define FLT_HZ                  (0)
+#define FLT_MIDI                (1)
+/* fltbankn, fltbankc */
+#define FLT_HARMONIC    (0)
+#define FLT_ALTERNATE   (1)
+#define FLT_SUBHARM         (2)
+#define FLT_LINOFFSET   (3)
+#define FLT_EQUALSPAN   (4)
+#define FLT_EQUALINT    (5)
+/* fltsweep, fstatvar */
+#define FSW_HIGH        (0)
+#define FSW_LOW         (1)
+#define FSW_BAND        (2)
+#define FSW_NOTCH       (3)
+/* eq */
+#define FLT_LOSHELF             (0)
+#define FLT_HISHELF             (1)
+#define FLT_PEAKING             (2)
+/* allpass */
+#define FLT_PHASESHIFT  (0)
+#define FLT_PHASER              (1)
+
+/******** MODE NUMBERS FOR INDIVIDUAL GRAIN PROGRAMS *********/
+
+/* repitch */
+/* rerhythm */
+/* remotif */
+#define GR_NO_REPEATS   (0)
+#define GR_REPEATS              (1)
+
+/******** MODE NUMBERS FOR INDIVIDUAL MIX PROGRAMS *************/
+
+/* MIXINBETWEEN */
+#define INBI_COUNT                      (0)
+#define INBI_RATIO                      (1)
+
+/* MIXSYNC */
+#define MIX_SYNCMID                     (0)
+#define MIX_SYNCEND                     (1)
+#define MIX_SYNCSTT                     (2)
+
+/* MIXMAX */
+#define MIX_LEVEL_ONLY          (0)
+#define MIX_CLIPS_ONLY          (1)
+#define MIX_LEVEL_AND_CLIPS     (2)
+
+/* MIXTWARP */
+#define MTW_TIMESORT            (0)
+#define MTW_REVERSE_T           (1)
+#define MTW_REVERSE_NT          (2)
+#define MTW_FREEZE_T            (3)
+#define MTW_FREEZE_NT           (4)
+#define MTW_SCATTER                     (5)
+#define MTW_DOMINO                      (6)
+#define MTW_ADD_TO_TG           (7)
+#define MTW_CREATE_TG_1         (8)
+#define MTW_CREATE_TG_2         (9)
+#define MTW_CREATE_TG_3         (10)
+#define MTW_CREATE_TG_4         (11)
+#define MTW_ENLARGE_TG_1        (12)
+#define MTW_ENLARGE_TG_2        (13)
+#define MTW_ENLARGE_TG_3        (14)
+#define MTW_ENLARGE_TG_4        (15)
+
+/* MIXSHUFL */
+#define MSH_DUPLICATE           (0)
+#define MSH_REVERSE_N           (1)
+#define MSH_SCATTER                     (2)
+#define MSH_FIXED_N                     (3)
+#define MSH_OMIT                        (4)
+#define MSH_OMIT_ALT            (5)
+#define MSH_DUPL_AND_RENAME     (6)
+
+/* MIXSWARP */
+#define MSW_FIXED                       (0)
+#define MSW_NARROWED            (1)
+#define MSW_LEFTWARDS           (2)
+#define MSW_RIGHTWARDS          (3)
+#define MSW_RANDOM                      (4)
+#define MSW_RANDOM_ALT          (5)
+#define MSW_TWISTALL            (6)
+#define MSW_TWISTONE            (7)
+
+/* MIXCROSS */
+#define MCLIN                           (0)
+#define MCCOS                           (1)
+
+/* MIXDUMMY */
+#define MD_TOGETHER                     (0)
+#define MD_FOLLOW                       (1)
+
+
+/******************* MODES ********************/
+
+/* MOD_LOUDNESS */
+#define LOUDNESS_GAIN           (0)
+#define LOUDNESS_DBGAIN         (1)
+#define LOUDNESS_NORM           (2)
+#define LOUDNESS_SET            (3)
+#define LOUDNESS_BALANCE        (4)
+#define LOUDNESS_PHASE          (5)
+#define LOUDNESS_LOUDEST        (6)
+#define LOUDNESS_EQUALISE       (7)
+/* TW March 2004 modes 8 & 9 are crypto modes for the tremolo program */
+#define LOUD_PROPOR                     (10)
+#define LOUD_DB_PROPOR          (11)
+
+/* MOD_SPACE */
+#define MOD_PAN                 (0)        /* name: PAN */
+#define MOD_MIRROR              (1)        /* name: MIRROR */
+#define MOD_MIRRORPAN   (2)        /* name: MIRROR */
+#define MOD_NARROW              (3)        /* name: NARROW */
+/* MOD_PITCH */
+#define MOD_TRANSPOS            (0)        /* name: SPEED CHANGE */
+#define MOD_TRANSPOS_SEMIT      (1)        /* name: SPEEDCHANGE IN SEMITONES */
+#define MOD_TRANSPOS_INFO       (2)        /* name: VARISPEED INFO */
+#define MOD_TRANSPOS_SEMIT_INFO (3)  /* name: VARISPEED SEMITONES INFO */
+#define MOD_ACCEL                       (4)        /* name: ACCELERATE */
+#define MOD_VIBRATO                     (5)        /* name: VIBRATO */
+/* MOD_REVECHO */
+#define MOD_DELAY               (0)        /* name: DELAY */
+#define MOD_VDELAY              (1)        /* name: VDELAY */
+#define MOD_STADIUM             (2)        /* name: STADIUM */
+/* BRASSAGE */
+#define GRS_PITCHSHIFT          (0)
+#define GRS_TIMESTRETCH         (1)
+#define GRS_REVERB                  (2)
+#define GRS_SCRAMBLE            (3)
+#define GRS_GRANULATE           (4)
+#define GRS_BRASSAGE            (5)
+#define GRS_FULL_MONTY          (6)
+/* SAUSAGE */
+#define S_RANDSPACE_GIVENP      (0)        /* name: RANDOM POSITION */
+#define S_GIVENSPACE_GIVENP     (1)        /* name: GIVEN POSITIONS */
+#define S_CYCLESPACE_GIVENP     (2)        /* name: CYCLING POSITIONS */
+#define S_RANDSPACE_CYCLEP      (3)        /* name: RAND POS + CYCLING PITCH */
+#define S_GIVENSPACE_CYCLEP     (4)        /* name: GIVN POS + CYCLING PITCH */
+#define S_CYCLESPACE_CYCLEP     (5)        /* name: CYCL POS + CYCLING PITCH */
+/* RADICAL */
+#define MOD_REVERSE             (0)        /* name: REVERSE */
+#define MOD_SHRED               (1)        /* name: SHRED */
+#define MOD_SCRUB               (2)        /* name: SCRUB */
+#define MOD_LOBIT               (3)        /* name: LOWER RESOLUTION */
+#define MOD_RINGMOD             (4)        /* name: RING MODULATE */
+#define MOD_CROSSMOD    (5)        /* name: CROSS MODULATE */
+#define MOD_LOBIT2              (6)        /* name: LOWER RESOLUTION : NEW ALGO */
+
+/******** MODE NUMBERS FOR INDIVIDUAL TEXTURE PROGRAMS *********/
+
+#define TEX_HFIELD                      (0)
+#define TEX_HFIELDS                     (1)
+#define TEX_HSET                        (2)
+#define TEX_HSETS                       (3)
+#define TEX_NEUTRAL                     (4)
+
+/******** MODE NUMBERS FOR PVOC_ANAL *********/
+
+#define STANDARD_ANAL   (0)
+#define ENVEL_ONLY              (1)
+#define MAG_ONLY                (2)
+
+/******** MODE NUMBERS FOR EDIT *********/
+
+#define EDIT_SECS               (0)
+#define EDIT_SAMPS              (1)
+#define EDIT_STSAMPS    (2)
+
+/******** MODE NUMBERS HOUSE_COPY *******/
+#define COPYSF                  (0)
+#define DUPL                    (1)
+
+/******** MODE NUMBERS HOUSE_CHANNELS *******/
+#define HOUSE_CHANNEL   (0)
+#define HOUSE_CHANNELS  (1)
+#define HOUSE_ZCHANNEL  (2)
+#define STOM                    (3)
+#define MTOS                    (4)
+
+/******** MODE NUMBERS HOUSE_BUNDLE *******/
+#define BUNDLE_ALL              (0)
+#define BUNDLE_NONTEXT  (1)
+#define BUNDLE_TYPE             (2)
+#define BUNDLE_SRATE    (3)
+#define BUNDLE_CHAN             (4)
+
+/******** MODE NUMBERS HOUSE_SORT *******/
+
+#define BY_FILETYPE             (0)
+#define BY_SRATE                (1)
+#define BY_DURATION             (2)
+#define BY_LOG_DUR              (3)
+#define IN_DUR_ORDER    (4)
+#define FIND_ROGUES             (5)
+
+/******** MODE NUMBERS HOUSE_SPEC *******/
+
+#define HOUSE_RESAMPLE  (0)
+#define HOUSE_CONVERT   (1)
+#define HOUSE_REPROP    (2)
+
+/******** MODE NUMBERS HOUSE_EXTRACT *******/
+
+#define HOUSE_CUTGATE                   (0)
+#define HOUSE_CUTGATE_PREVIEW   (1)
+#define HOUSE_TOPNTAIL                  (2)
+#define HOUSE_RECTIFY                   (3)
+#define HOUSE_BYHAND                    (4)
+#define HOUSE_ONSETS                    (5)
+
+//TW REDUNDANT MODES REMOVED
+/******** MODE NUMBERS INFO_MUSUNITS *******/
+
+#define MU_MIDI_TO_FRQ                  (0)
+#define MU_FRQ_TO_MIDI                  (1)
+#define MU_NOTE_TO_FRQ                  (2)
+#define MU_NOTE_TO_MIDI                 (3)
+#define MU_FRQ_TO_NOTE                  (4)
+#define MU_MIDI_TO_NOTE                 (5)
+#define MU_FRQRATIO_TO_SEMIT    (6)
+#define MU_FRQRATIO_TO_INTVL    (7)
+#define MU_INTVL_TO_FRQRATIO    (8)
+#define MU_SEMIT_TO_FRQRATIO    (9)
+#define MU_OCTS_TO_FRQRATIO             (10)
+#define MU_OCTS_TO_SEMIT                (11)
+#define MU_FRQRATIO_TO_OCTS             (12)
+#define MU_SEMIT_TO_OCTS                (13)
+#define MU_SEMIT_TO_INTVL               (14)
+#define MU_FRQRATIO_TO_TSTRETH  (15)
+#define MU_SEMIT_TO_TSTRETCH    (16)
+#define MU_OCTS_TO_TSTRETCH             (17)
+#define MU_INTVL_TO_TSTRETCH    (18)
+#define MU_TSTRETCH_TO_FRQRATIO (19)
+#define MU_TSTRETCH_TO_SEMIT    (20)
+#define MU_TSTRETCH_TO_OCTS             (21)
+#define MU_TSTRETCH_TO_INTVL    (22)
+#define MU_GAIN_TO_DB                   (23)
+#define MU_DB_TO_GAIN                   (24)
+#define MU_DELAY_TO_FRQ                 (25)
+#define MU_DELAY_TO_MIDI                (26)
+#define MU_FRQ_TO_DELAY                 (27)
+#define MU_MIDI_TO_DELAY                (28)
+#define MU_NOTE_TO_DELAY                (29)
+#define MU_TEMPO_TO_DELAY               (30)
+#define MU_DELAY_TO_TEMPO               (31)
+
+/* SYNTHESIS */
+#define WAVE_SINE               (0)
+#define WAVE_SQUARE             (1)
+#define WAVE_SAW                (2)
+#define WAVE_RAMP               (3)
+
+/* HF_PERM1 */
+
+#define HFP_SNDOUT              (0)
+#define HFP_SNDSOUT             (1)
+#define HFP_TEXTOUT             (2)
+#define HFP_MIDIOUT             (3)
+
+/* TWIXT */
+
+#define IN_SEQUENCE             (0)
+#define RAND_REORDER    (1)
+#define RAND_SEQUENCE   (2)
+#define TRUE_EDIT               (3)
+
+//NEW TW
+/* P_INTERP */
+
+#define PI_GLIDE                (0)
+#define PI_SUSTAIN              (1)
+
+/* CONVOLVED */
+#define CONV_NORMAL             (0)
+#define CONV_TVAR               (1)
+
+/* CLICK */
+#define CLICK_BY_TIME   (0)
+#define CLICK_BY_LINE   (1)
+/*TW March 2004 */
+/* BATCH_EXPAND */
+#define ONE_PARAM       (0)
+#define MANY_PARAMS     (1)
+
+/* ENVSYN */
+#define ENVSYN_RISING   (0)
+#define ENVSYN_FALLING  (1)
+#define ENVSYN_TROFFED  (2)
+#define ENVSYN_USERDEF  (3)
+
+/* MODES FOR GREV */
+#define GREV_REVERSE    (0)
+#define GREV_REPEAT             (1)
+#define GREV_DELETE             (2)
+#define GREV_OMIT               (3)
+#define GREV_TSTRETCH   (4)
+#define GREV_GET                (5)
+#define GREV_PUT                (6)

+ 146 - 0
dev/include/modicon.h

@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************************** MODIFY ******************************/
+
+/*
+#define MULTICHAN 1
+*/
+/* mod_space constants */
+#define PAN_PRESCALE_DEFAULT    (0.7)
+#define MAX_PANNING                             (256.0)
+
+/* brassage internal flags */
+#define G_VELOCITY_FLAG         (0)
+#define G_DENSITY_FLAG          (1)
+#define G_GRAINSIZE_FLAG        (2)
+#define G_PITCH_FLAG            (3)
+#define G_AMP_FLAG                      (4)
+#define G_SPACE_FLAG            (5)
+#define G_BSPLICE_FLAG          (6)
+#define G_ESPLICE_FLAG          (7)
+#define G_RANGE_FLAG            (8)
+#define G_SCATTER_FLAG          (9)
+/* brassage bufnames */
+#define GRS_SBUF        (0)
+#define GRS_BUF         (1)
+#define GRS_IBUF        (2)
+#define GRS_OBUF        (3)
+/* brassage extrabuf_names */
+#define GRS_GBUF        (0)
+/* brassage bitflags */
+#define G_VARIABLE_HI_BOUND     (8)
+#define G_HI_BOUND                      (4)
+#define G_VARIABLE_VAL          (2)
+#define G_FIXED_VAL                     (1)
+/* brassage */
+#define GRS_MIN_GRSAMPSIZE      (4)             /* smaalest grainsize in (stereo-pair=1) samps */
+#define GRS_MAX_VFLAGS          (3)
+#define GRS_DEFAULT_DENSITY                      (2.0)           /* used to be 2.0 */
+#define GRS_MAX_DENSITY                          (16384.0)
+#define GRS_MAX_VELOCITY                         (32767.0)
+#define GRS_DEFAULT_GRAINSIZE            (50.0)
+#define GRS_DEFAULT_REVERB_PSHIFT        (0.33)
+#define MIN_LIKELY_PITCH                         (10.0)
+#define GRS_DEFAULT_REVERB_SRCHRANGE (50.0)     /* ??? */
+#define GRS_DEFAULT_SPLICELEN            (5.0)  /* ??? */
+#define GRS_MIN_SPLICELEN                        (1.0)  /* ??? */
+#define GRS_DEFAULT_SCATTER                      (0.5)  /* ??? */
+#define GRS_DEFAULT_REVERB_DENSITY       (8.0)  /* ??? */
+/* counts of granula flags */
+#define SFLAGCNT  (8)   /* structured flags */
+#define FLAGCNT   (2)   /* other flags */
+/* settings of granula flags */
+/*
+#define NOT_SET         (0) DEFINED GLOBALLY */
+#define FIXED           (1)
+#define VARIABLE        (2)
+#define RANGED          (5)
+#define RANGE_VLO       (6)
+#define RANGE_VHI       (9)
+#define RANGE_VHILO (10)
+/* granula */
+// multichannel 2009
+#define BOTH_CHANNELS (-1)
+#define ALL_CHANNELS  (-1)
+
+/* strans,vtrans */
+#define INBUF           (0)
+#define OUTBUF          (1)
+#define OBUFEND         (2)
+#define TRUE_LBUF       (3)
+#define L_GRDPNT        (4)
+#define TRUE_RBUF       (5)
+#define R_GRDPNT        (6)
+#define LBUF            (7)
+#define RBUF            (8)
+
+#define MIN_ACCEL               (.0001)
+#define MAX_ACCEL               (1000.0)
+#define MINTIME_ACCEL   (0.01)
+
+#define VIB_TABSIZE             (1024)
+#define VIB_BLOKSIZE            (128)
+#define DEFAULT_VIB_FRQ         (12.0)
+#define DEFAULT_VIB_DEPTH       (0.667) /* 2/3 semitones = 1/3 tone */
+#define MAX_VIB_FRQ                     (120.0)
+
+#define DEFAULT_DELAY           (20.0)
+#define MAX_DELAY                       (10000.0)
+
+/*TW NEW*/
+
+#define MAX_ECHOCNT             (1000)  /* used to be 23, then 100 */
+#define REASONABLE_ECHOCNT      (23)
+
+#define STAD_PREGAIN_DFLT       (0.645654)
+#define DFLT_STAD_DELTIME       (0.1)
+#define MAX_STAD_DELAY          (100.0)
+
+        /* lobit */
+#define MIN_SRATE_DIV           (2)
+#define MAX_SRATE_DIV           (256)
+#define MAX_BIT_DIV             (16)
+        /* shred */
+#define SHRED_SPLICELEN         (256)
+#define SHRED_HSPLICELEN                (128)
+#define SHRED_SPLICELEN_POW2    (8)
+#define MAXSHRED                                (10000)
+#define MAX_SHR_SCATTER                 (8)
+        /* scrub */
+#define SCRUB_SINTABSIZE        (256)
+#define SCRUB_SINWARP           (.3)
+#define SCRUB_SKEWRANGE         (.01)
+
+#define SCRUB_MINSPEED_DEFAULT  (-48.0) /* 4 octaves down */
+#define SCRUB_MAXSPEED_DEFAULT  (48.0)  /* 4 octaves up */
+#define SCRUB_SPEED_MIN                 (-96.0) /* 8 octaves down */
+#define SCRUB_SPEED_MAX                 (96.0)  /* 8 octaves up */
+#define SCRUB_RANGE_REDUCE_FACTOR       (.15)
+
+#define MIN_RING_MOD_FRQ                (0.1)
+#define RING_MOD_BLOK                   (128)
+#define RM_SINTABSIZE                   (512)

+ 32 - 0
dev/include/modify.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <modicon.h>
+#include        <modify1.h>

+ 72 - 0
dev/include/modify1.h

@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* 'MODIFY' FUNCTIONS */
+
+int     granula_pconsistency(dataptr dz);
+int     lobit_pconsistency(dataptr dz);
+int     scrub_pconsistency(dataptr dz);
+int     crossmod_pconsistency(dataptr dz);
+
+int     granula_preprocess(dataptr dz);
+int     vtrans_preprocess(dataptr dz);
+int     scrub_preprocess(dataptr dz);
+int     create_rm_sintab(dataptr dz);
+int     sausage_preprocess(dataptr dz);
+//TW NEW
+int     stack_preprocess(dataptr dz);
+
+int     granula_process(dataptr dz);
+int     loudness_process(dataptr dz);
+int     dopan(dataptr dz);
+int     mirroring(dataptr dz);
+void    mirror_panfile(dataptr dz);
+int     narrow_sound(dataptr dz);
+int     process_varispeed(dataptr dz);
+int     do_reversing(dataptr dz);
+int     lobit_process(dataptr dz);
+int     do_scrubbing(dataptr dz);
+int     ring_modulate(dataptr dz);
+int     cross_modulate(dataptr dz);
+int     generate_sintable(dataptr dz);
+//TW NEW
+int     do_stack(dataptr dz);
+
+int     create_modspeed_buffers(dataptr dz);
+int     create_delay_buffers(dataptr dz);
+int     create_reversing_buffers(dataptr dz);
+int     create_shred_buffers(dataptr dz);
+int     create_scrub_buffers(dataptr dz);
+int     create_crossmod_buffers(dataptr dz);
+int     create_sausage_buffers(dataptr dz);
+
+void    print_message_flush(char *str);
+void    print_warning_flush(char *str);
+//TW NEW
+int             do_convolve(dataptr dz);
+int             convolve_preprocess(dataptr dz);
+int             do_shudder(dataptr dz);
+int             findpan(dataptr dz);

+ 31 - 0
dev/include/morph.h

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specglide(dataptr dz);
+int  specbridge(dataptr dz);
+int  specmorph(dataptr dz);

+ 216 - 0
dev/include/otherfile.h

@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+Type of further main files required:
+3rd item sent back from CDPARAMS......
+
+#define FILES_NONE                                      (0)
+#define FILES_SND                                       (1)
+#define FILES_SND_MONO                          (2)
+#define FILES_SND_SAME_CHANS            (3)
+#define FILES_SND_MONO_ANY_SRATE        (4)
+#define FILES_SND_ANY_SRATE                     (5)
+#define FILES_ANAL                                      (6)
+#define FILES_A_AND_PCH                         (7)
+#define FILES_A_AND_TRNS                        (8)
+#define FILES_A_AND_FMNT                        (9)
+#define FILES_P_AND_FMNT                        (10)
+#define FILES_ENV                                       (11)
+#define FILES_BRK                                       (12)
+#define FILES_DB_BRK                            (13)
+#define FILES_TRNS_OR_BRK_TRNS          (14)
+#define FILES_PCH_OR_BRK_PCH            (15)
+
+
+Filetype data (originally sent from CDPARSE)
+which you have stored for each file on the user interface.
+
+#define SNDFILE                  (10)
+#define ANALFILE                 (11)
+#define PITCHFILE                (12)
+#define TRANSPOSFILE     (13)
+#define FORMANTFILE              (14)
+#define ENVFILE                  (15)
+#define TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST            (16)
+#define TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST                                        (17)
+#define TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST            (18)
+#define TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST                                        (19)
+#define TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST         (20)
+#define TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST                                     (21)
+#define NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                        (22)
+#define NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                            (23)
+#define DB_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                           (24)
+#define DB_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                                       (25)
+#define PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                        (26)
+#define PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                            (27)
+#define UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST                                     (28)
+#define UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST                                                         (29)
+#define NUMLIST_OR_LINELIST_OR_WORDLIST                                                                         (30)
+#define NUMLIST_OR_WORDLIST                                                                                                     (31)
+#define SNDLIST_OR_SYNCLIST_LINELIST_OR_WORDLIST                                                        (32)
+#define SNDLIST_OR_SYNCLIST_OR_WORDLIST                                                                         (33)
+#define SNDLIST_OR_LINELIST_OR_WORDLIST                                                                         (34)
+#define SNDLIST_OR_WORDLIST                                                                                                     (35)
+#define MIXLIST_OR_LINELIST_OR_WORDLIST                                                                         (36)
+#define MIXLIST_OR_WORDLIST                                                                                                     (37)
+#define SYNCLIST_OR_LINELIST_OR_WORDLIST                                                                        (38)
+#define SYNCLIST_OR_WORDLIST                                                                                            (39)
+#define LINELIST_OR_WORDLIST                                                                                            (40)
+#define WORDLIST                                                                                                                        (41)
+
+
+HOW THIS WORKS.........
+-----------------------
+
+        case(FILES_NONE):
+                break;
+        case(FILES_SND):
+                filetype of further file(s) = SNDFILE;
+                srate ==
+                break;
+        case(FILES_SND_MONO):
+                filetype of further file(s) = SNDFILE;
+                srate ==
+                channels = 1;
+                break;
+        case(FILES_SND_SAME_CHANS):
+                filetype of further file(s) = SNDFILE;
+                srate ==
+                channels ==
+                break;
+        case(FILES_SND_MONO_ANY_SRATE):
+                filetype of further file(s) = SNDFILE;
+                channels = 1;
+                break;
+        case(FILES_SND_ANY_SRATE):
+                filetype of further file(s) = SNDFILE;
+                break;
+        case(FILES_ANAL):
+                filetype of further file(s) = ANALFILE;
+                srate ==
+                channels ==
+                arate  flteq()
+                origstype ==
+                origrate ==
+                Mlen ==
+                Dfac ==
+                break;
+        case(FILES_A_AND_PCH):
+                filetype of further file(s) = PITCHFILE;
+                srate ==
+                channels(file1) == origchans(file2)     <<<----- NB:!!!!***
+                arate  flteq()
+                origstype ==
+                origrate ==
+                Mlen ==
+                Dfac ==
+                break;
+        case(FILES_A_AND_TRNS):
+                filetype of further file(s) = TRANSPOSFILE;
+                srate ==
+                channels(file1) == origchans(file2)     <<<----- NB:!!!!***
+                arate  flteq()
+                origstype ==
+                origrate ==
+                Mlen ==
+                Dfac ==
+                break;
+        case(FILES_A_AND_FMNT):
+                filetype of further file(s) = FORMANTFILE;
+                srate ==
+                channels(file1) == origchans(file2)     <<<----- NB:!!!!***
+                arate  flteq()
+                origstype ==
+                origrate ==
+                Mlen ==
+                Dfac ==
+                break;
+        case(FILES_P_AND_FMNT):
+                filetype of further file(s) = FORMANTFILE;
+                srate ==
+                origchans(file1) == origchans(file2)    <<<----- NB: DIFFERENT AGAIN !!!!***
+                arate  flteq()
+                origstype ==
+                origrate ==
+                Mlen ==
+                Dfac ==
+                break;
+        case(FILES_ENV):
+                filetype of further file(s) = ENVFILE;
+                break;
+        case(FILES_BRK):
+                filetype of further file(s) =
+                                   TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST;
+                break;
+        case(FILES_DB_BRK):
+                filetype of further file(s) = DB_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || DB_BRKFILE_OR_NUMLIST_OR_WORDLIST;
+                break;
+        case(FILES_TRNS_OR_BRK_TRNS):
+                filetype of further file(s) =
+                                   TRANSPOSFILE
+                                || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST;
+                break;
+        case(FILES_PCH_OR_BRK_PCH):
+                filetype of further file(s) =
+                                   PITCHFILE
+                                || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_NORMD_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_UNRANGED_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || PITCH_BRKFILE_OR_NUMLIST_OR_LINELIST_OR_WORDLIST
+                                || TRANSPOS_OR_PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST
+                                || PITCH_BRKFILE_OR_NUMLIST_OR_WORDLIST;
+                break;
+
+        }
+
+/**************************** FLTEQ *******************************/
+
+#define FLTERR  (0.000002)
+#define FALSE   (0)
+#define TRUE    (1)
+
+int flteq(double f1,double f2)
+{
+        double upperbnd, lowerbnd;
+        upperbnd = f2 + FLTERR;
+        lowerbnd = f2 - FLTERR;
+        if((f1>upperbnd) || (f1<lowerbnd))
+                return(FALSE);
+        return(TRUE);
+}

+ 27 - 0
dev/include/paudition.h

@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+extern char errstr[];

+ 37 - 0
dev/include/pitch.h

@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specalt(int *pitchcnt,dataptr dz);
+int  specoct(dataptr dz);
+int  specchord(dataptr dz);
+int  specchord2(dataptr dz);
+int  specshiftp(dataptr dz);
+int  spectune(dataptr dz);
+int  specpick(dataptr dz);
+int  reset_shiftps_according_to_depth_value(dataptr dz);
+int  adjust_params_and_setup_internal_params_for_shiftp(dataptr dz);

+ 1621 - 0
dev/include/pnames.h

@@ -0,0 +1,1621 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+                                                        /** VARIABLE NAMES **/
+
+/************************************ SPEC *************************************/
+/* RWD floats version */
+/* ACCU */
+#define ACCU_DINDEX             (0)
+#define ACCU_GINDEX             (1)
+
+/* ARPE */
+#define ARPE_WTYPE              (0)     /* int */
+#define ARPE_ARPFRQ             (1)
+#define ARPE_PHASE              (2)
+#define ARPE_LOFRQ              (3)
+#define ARPE_HIFRQ              (4)
+#define ARPE_HBAND              (5)
+#define ARPE_AMPL               (6)
+#define ARPE_NONLIN             (7)
+#define ARPE_SUST               (8)      /* int */
+        /* internal */
+#define ARPE_LAST_TABPOS (9)
+#define ARPE_LASTARPFRQ  (10)
+#define ARPE_SUSFLAG    (11) /* int */
+#define ARPE_WAVETABPOS  (12) /* int */
+
+/* AVRG */
+#define AVRG_AVRG               (0)     /* int */
+        /* internal */
+#define AVRG_AVRGSPAN   (1)     /* int */
+
+
+/* BLTR & BLUR */
+#define BLUR_BLURF              (0)     /* int */
+/* BLTR */
+#define BLTR_TRACE              (1)     /* int */
+#define BLTR_MAXTRACE   (2)     /* int */
+
+/* BRIDGE */
+#define BRG_OFFSET              (0)
+#define BRG_SF2                 (1)
+#define BRG_SA2                 (2)
+#define BRG_EF2                 (3)
+#define BRG_EA2                 (4)
+#define BRG_STIME               (5)
+#define BRG_ETIME               (6)
+        /* internal */
+#define BRG_TFAC                (7)
+#define BRG_FSTEP               (8)
+#define BRG_ASTEP               (9)
+#define BRG_TSTEP               (10)
+#define BRG_SWIN                (11) /* int */
+#define BRG_INTPEND             (12) /* int */
+#define BRG_STARTIS             (13) /* int */
+#define BRG_TAILIS              (14) /* int */
+
+/* CHANNEL */
+#define CHAN_FRQ                (0)
+
+/* CHORD */
+#define CHORD_LOFRQ             (0)
+#define CHORD_HIFRQ             (1)
+
+/* CHORUS */
+#define CHORU_AMPR              (0)
+#define CHORU_FRQR              (1)
+        /* internal */
+#define CHORU_RTABSIZE  (2)     /* int */
+#define CHORU_SPRTYPE   (3)     /* int */
+
+/* CLEAN */
+#define CL_FRQ                  (0)
+#define CL_SKIPT                (0)     /* NB : same param storage location as CL_FRQ: alternatives !! */
+#define CL_GAIN                 (1)
+        /* internal */
+#define CL_SKIPW                (2)     /* int */
+
+/* CROSS */
+#define CROS_INTP               (0)     /* cross */
+
+/* CUT */
+#define CUT_STIME               (0)
+#define CUT_ETIME               (1)
+
+/* DIFF */
+#define DIFF_CROSS              (0)
+
+/* DRUNK */
+#define DRNK_RANGE              (0)      /* int */
+#define DRNK_STIME              (1)
+#define DRNK_DUR                (2)
+        /* internal */
+#define DRNK_TWICERANGE (3)     /* int */
+
+/* EXAG */
+#define EXAG_EXAG               (0)
+
+/* FILT */
+#define FILT_FRQ1               (0)
+#define FILT_FRQ2               (1)
+#define FILT_QQ                 (2)
+#define FILT_PG                 (3)
+
+/* FMNTSEE */
+        /* internal */
+#define FMNTSEE_MAX             (0)
+
+/* FOCUS */
+#define FOCU_PKCNT              (0) /* int */
+#define FOCU_BW                 (1)
+#define FOCU_LOFRQ              (2)
+#define FOCU_HIFRQ              (3)
+#define FOCU_STABL              (4)     /* int */
+        /* internal */
+#define FOCU_BRATIO_DN  (5)
+#define FOCU_BRATIO_UP  (6)
+#define FOCU_SL1                (7)     /* int */
+
+/* FOLD */
+#define FOLD_LOFRQ              (0)
+#define FOLD_HIFRQ              (1)
+        /* internal */
+#define FOLD_HICHAN             (2)     /* int */
+#define FOLD_LOCHAN             (3)     /* int */
+#define FOLD_HICHANTOP  (4)
+#define FOLD_LOCHANBOT  (5)
+
+/* FORM */
+#define FORM_FBOT               (0)
+#define FORM_FTOP               (1)
+#define FORM_GAIN               (2)
+
+/* FORMANTS */
+   /* internal */
+//TW RENAMED
+#define FMNT_SAMPS_TO_WRITE  (0)        /* int */
+
+/* FORMSEE */
+        /* internal */
+#define FSEE_FMAX               (0)
+#define FSEE_FCNT               (1)     /* int */
+
+/* FREQUENCY */
+#define FRQ_CHAN                (0)     /* int */
+
+/* GAIN */
+#define GAIN_GAIN               (0)
+
+/* GLIDE */
+#define GLIDE_DUR               (0)
+
+/* GLIS */
+#define GLIS_RATE                       (0)
+#define GLIS_SHIFT                      (1)
+#define GLIS_HIFRQ                      (2)
+        /* internal */
+#define GLIS_CONVERTOR          (3)
+#define GLIS_HALF_SHIFT         (4)
+#define GLIS_REFPITCH           (5)
+#define GLIS_HALF_REFPITCH      (6)
+#define GLIS_FRQTOP_TOP         (7)
+#define GLIS_ROLL_OFF           (8)
+#define GLIS_BASEFRQ            (9)
+
+/* GRAB */
+#define GRAB_FRZTIME    (0)     /* as magnify */
+
+/* LEAF */
+#define LEAF_SIZE               (0)     /* int */
+
+/* MAGNIFY */
+#define MAG_FRZTIME     (0)     /* as grab */
+#define MAG_DUR                 (1)
+
+/* MEAN */
+#define MEAN_LOF                (0)
+#define MEAN_HIF                (1)
+#define MEAN_CHAN               (2)     /* int */
+        /* internal */
+#define MEAN_TOP                (3)     /* int */
+#define MEAN_BOT                (4)     /* int */
+
+/* MORPH */
+#define MPH_ASTT                (0)
+#define MPH_AEND                (1)
+#define MPH_FSTT                (2)
+#define MPH_FEND                (3)
+#define MPH_AEXP                (4)
+#define MPH_FEXP                (5)
+#define MPH_STAG                (6)
+          /* internal */
+#define MPH_ASTTW               (7)      /* int */
+#define MPH_AENDW               (8)  /* int */
+#define MPH_FSTTW               (9)  /* int */
+#define MPH_FENDW               (10) /* int */
+#define MPH_STAGW               (11) /* int */
+
+/* NOISE */
+#define NOISE_NOIS              (0)
+
+/* OCT */
+#define OCT_HMOVE               (0)      /* int */
+#define OCT_BREI                (1)
+
+/* OCTVU */
+#define OCTVU_TSTEP             (0)
+#define OCTVU_FUND              (1)
+        /* internal */
+#define OCTVU_BBBTOP    (2)                              /* bottom-band bandtop */
+#define OCTVU_TBLOK             (3)     /* int */
+
+/* P_APPROX */
+#define PA_PRANG                (0)
+#define PA_TRANG                (1)
+#define PA_SRANG                (2)
+
+/* P_CUT */
+#define PC_STT                  (0)
+#define PC_END                  (1)
+
+/* P_EXAG */
+#define PEX_MEAN                (0)
+#define PEX_RANG                (1)
+#define PEX_CNTR                (2)
+
+/* P_FIX */
+#define PF_SCUT                 (0)
+#define PF_ECUT                 (1)
+#define PF_LOF                  (2)
+#define PF_HIF                  (3)
+#define PF_SMOOTH               (4) /* int */
+#define PF_SMARK                (5)
+#define PF_EMARK                (6)
+        /* internal */
+#define PF_SCUTW        (7) /* int */
+#define PF_ECUTW        (8) /* int */
+#define PF_ISCUT        (9) /* int */
+#define PF_ISFILTER     (10) /* int */
+
+/* P_HEAR */
+#define PH_GAIN                 (0)
+
+/* P_INFO */
+        /* internal */
+#define PINF_MEAN               (0)
+#define PINF_MAX                (1)
+#define PINF_MIN                (2)
+#define PINF_MAXPOS             (3)
+#define PINF_MINPOS             (4)
+
+/* P_INVERT */
+#define PI_MEAN                 (0)
+#define PI_BOT                  (1)
+#define PI_TOP                  (2)
+
+/* P_RANDOMISE */
+#define PR_MXINT                (0)
+#define PR_TSTEP                (1)
+#define PR_SLEW                 (2)
+        /* internal */
+#define PR_NEGATIV_SLEW (3)
+
+/* P_SEE */
+#define PSEE_SCF                (0)
+
+/* P_SMOOTH */
+#define PS_TFRAME               (0)
+#define PS_MEAN                 (1)
+
+/* P_TRANSPOSE */
+#define PT_TVAL                 (0)
+
+/* P_VIBRATO */
+#define PV_FRQ                  (0)
+#define PV_RANG                 (1)
+
+/* P_WRITE */
+#define PW_DRED                 (0)
+
+/* PEAK */
+#define PEAK_CUTOFF             (0)
+#define PEAK_TWINDOW    (1)
+#define PEAK_FWINDOW    (2)
+        /* internal */
+#define PEAK_ENDTIME    (3)
+#define PEAK_TGROUP             (4)     /* int */
+#define PEAK_BANDCNT    (5)     /* int */
+
+/* PICK */
+#define PICK_FUND               (0)
+#define PICK_LIN                (1)
+#define PICK_CLAR               (2)
+        /* internal */
+#define PICK_LONGPOW2   (3)     /* int */
+#define PICK_DIVMASK    (4)     /* int */
+
+/* PITCH */
+#define PICH_RNGE               (0)
+#define PICH_VALID              (1)     /* int */
+#define PICH_SRATIO             (2)
+#define PICH_MATCH              (3) /* int */
+#define PICH_LOLM               (4)
+#define PICH_HILM               (5)
+#define PICH_DATAREDUCE (6)
+        /* internal */
+#define PICH_PICH               (7)
+
+/* PLUCK */
+#define PLUK_GAIN               (0)
+        /* internal */
+#define PLUK_LONGPOW2   (1)     /* int */
+#define PLUK_DIVMASK    (2)     /* int */
+
+/* PRINT */
+#define PRNT_STIME              (0)
+#define PRNT_WCNT               (1)     /* int */
+        /* internal */
+#define PRNT_STARTW             (2)     /* int */
+#define PRNT_ENDW               (3)     /* int */
+
+/* REPITCHB */
+#define RP_DRED                 (0)
+
+/* REPORT */
+#define REPORT_PKCNT                    (0) /* int */
+#define REPORT_LOFRQ                    (1)
+#define REPORT_HIFRQ                    (2)
+#define REPORT_STABL                    (3)     /* int */
+        /* internal */
+#define REPORT_SL1                              (4)     /* int */
+#define REPORT_LAST_PKCNT_HERE  (5) /* int */
+
+/* SCAT */
+#define SCAT_CNT                                (0)     /* int */
+#define SCAT_BLOKSIZE                   (1)     /* only later round to INT converting frqspan->chan_cnt: special case */
+        /* internal */
+#define SCAT_THISCNT                    (2)     /* int */
+#define SCAT_BLOKS_PER_WINDOW   (3)     /* int */
+
+/* SHIFT */
+#define SHIFT_SHIF              (0)
+#define SHIFT_FRQ1              (1)
+#define SHIFT_FRQ2              (2)
+
+/* SHIFTP */
+#define SHIFTP_FFRQ             (0)
+#define SHIFTP_SHF1             (1)
+#define SHIFTP_SHF2             (2)
+#define SHIFTP_DEPTH    (3)
+        /* internal */
+#define SHIFTP_FDCNO    (4)     /* int */
+#define SHIFTP_S1L1             (5)
+#define SHIFTP_1LS1             (6)
+#define SHIFTP_S2L1             (7)
+#define SHIFTP_1LS2             (8)
+#define SHIFTP_NS1              (9)
+#define SHIFTP_NS2              (10)
+
+/* SHUFFLE */
+#define SHUF_GRPSIZE    (0)     /* int */
+        /* internal */
+#define SHUF_DMNCNT             (1)     /* int */
+#define SHUF_IMGCNT             (2)     /* int */
+#define SHUF_I_WANTED   (3)     /* int */
+#define SHUF_D_WANTED   (4)     /* int */
+#define SHUF_I_BSZ              (5)     /* int */
+#define SHUF_D_BSZ              (6)     /* int */
+
+/* SPREAD */
+#define SPREAD_SPRD             (0)
+
+/* STEP */
+#define STEP_STEP               (0)     /* only later round to INT converting time->windowcnt: special case */
+
+/* STRETCH */
+#define STR_FFRQ                (0)
+#define STR_SHIFT               (1)
+#define STR_EXP                 (2)
+#define STR_DEPTH               (3)
+        /* internal */
+#define STR_FDCNO               (4)     /* int */
+#define STR_SL1                 (5)
+#define STR_NSHIFT              (6)
+
+/* SUM */
+#define SUM_CROSS               (0)
+
+/* SUPR */
+#define SUPR_INDX               (0) /* int */
+
+/* TRACE */
+#define TRAC_INDX               (0) /* int */
+#define TRAC_LOFRQ              (1)
+#define TRAC_HIFRQ              (2)
+
+/* TRACK */
+#define TRAK_PICH               (0)
+#define TRAK_RNGE               (1)
+#define TRAK_VALID              (2) /* int */
+#define TRAK_SRATIO             (3)
+#define TRAK_HILM               (4)
+#define TRAK_DATAREDUCE (5)
+        /* internal */
+#define TRAK_LOLM               (6)
+
+/* TRNSF */
+#define TRNSF_LOFRQ             (0)
+#define TRNSF_HIFRQ             (1)
+
+/* TRSNP */
+#define TRNSP_LOFRQ             (0)
+#define TRNSP_HIFRQ             (1)
+
+/* TSTRETCH */
+#define TSTR_STRETCH    (0)
+        /* internal */
+#define TSTR_TOTIME             (1)
+#define TSTR_ARRAYSIZE  (2)     /* int */
+
+/* TUNE */
+#define TUNE_FOC                (0)
+#define TUNE_CLAR               (1)
+#define TUNE_INDX               (2) /* int */
+#define TUNE_BFRQ               (3)
+
+/* VOCODE */
+#define VOCO_LOF                (0)
+#define VOCO_HIF                (1)
+#define VOCO_GAIN               (2)
+
+/* WARP */
+#define WARP_PRNG               (0)
+#define WARP_TRNG               (1)
+#define WARP_SRNG               (2)
+                /* internal */
+#define WARP_WREAD              (3)     /* int */
+#define WARP_PART_INBUF (4)     /* int */
+#define WARP_ATEND              (5)     /* int */
+
+/* WAVER */
+#define WAVER_VIB               (0)
+#define WAVER_STR               (1)
+#define WAVER_LOFRQ             (2)
+#define WAVER_EXP               (3)
+        /* internal */
+#define WAVER_BOTCHAN   (4) /* int */
+#define WAVER_STRCHANS  (5) /* int */
+
+/* WEAVE */
+        /* internal */
+#define WEAVE_BAKTRAK   (0)     /* int */
+
+/* LIMIT */
+#define LIMIT_THRESH    (0)
+
+
+/******************************* GROUCHO ********************************/
+
+/************ NAMES FOR PARAMS, ,OPTIONS, VARIANTS, INTERNAL PARAMS ************/
+
+/* DISTORT */
+#define DISTORT_POWFAC          (0)
+        /* internal */
+#define DISTORT_PULSE           (1) /* int */
+
+/* DISTORT_ENV */
+#define DISTORTE_CYCLECNT       (0)     /* int */
+        /* param OR variant */
+#define DISTORTE_TROF           (1)
+        /* variant */
+#define DISTORTE_EXPON          (2)
+        /* internal */
+#define ONE_LESS_TROF           (3)
+
+/* DISTORT_AVG */
+#define DISTORTA_CYCLECNT       (0)     /* int */
+        /* option */
+#define DISTORTA_MAXLEN         (1)
+        /* variant */
+#define DISTORTA_SKIPCNT        (2)
+        /* internal */
+#define DISTORTA_CYCBUFLEN      (3)     /* int */
+
+/* DISTORT_OMT */
+#define DISTORTO_OMIT           (0)     /* int */
+#define DISTORTO_KEEP           (1)     /* int */
+
+/* DISTORT_MLT */
+/* DISTORT_DIV */
+#define DISTORTM_FACTOR         (0)     /* int */
+/* DISTORT_MLT flag name only */
+#define DISTORTM_SMOOTH_FLAG (1)
+/* DISTORT_DIV flag name only */
+#define DISTORTD_INTERP_FLAG (1)
+
+/* DISTORT_HRM */
+#define DISTORTH_PRESCALE       (0)
+        /* internal */
+#define DISTORTH_CYCBUFLEN      (1)     /* int */
+#define DISTORTH_HCNT           (2)     /* int */
+#define FOLDOVER_WARNING        (3)     /* int */
+
+/* DISTORT_FRC */
+#define DISTORTF_SCALE          (0)     /* int */
+#define DISTORTF_AMPFACT        (1)
+#define DISTORTF_PRESCALE       (2)
+        /* internal */
+#define DISTORTF_CYCBUFLEN      (3)     /* int */
+
+/* DISTORT_REV */
+#define DISTORTR_CYCLECNT       (0)     /* int */
+
+/* DISTORT_SHUF */
+#define DISTORTS_CYCLECNT       (0)     /* int */
+#define DISTORTS_SKIPCNT        (1)     /* int */
+        /* internal */
+#define DISTORTS_DMNCNT         (2)     /* int */
+#define DISTORTS_IMGCNT         (3)     /* int */
+
+/* DISTORT_RPT , DISTORT_RPTFL */
+#define DISTRPT_MULTIPLY                (0) /* int */
+#define DISTRPT_CYCLECNT                (1) /* int */
+#define DISTRPT_SKIPCNT                 (2) /* int */
+#define DISTRPT_CYCLIM                  (3)     /* float */
+/* DISTORT_INTP */
+#define DISTINTP_MULTIPLY               (0) /* int */
+#define DISTINTP_SKIPCNT                (1) /* int */
+
+/* DISTORT_DEL */
+#define DISTDEL_CYCLECNT                (0) /* int */
+#define DISTDEL_SKIPCNT                 (1) /* int */
+
+/* DISTORT_RPL */
+#define DISTRPL_CYCLECNT                (0) /* int */
+#define DISTRPL_SKIPCNT                 (1) /* int */
+
+/* DISTORT_TEL */
+#define DISTTEL_CYCLECNT                (0) /* int */
+#define DISTTEL_SKIPCNT                 (1) /* int */
+#define DISTTEL_AVG_FLAG                (2)     /* flagname only */
+
+/* DISTORT_FLT */
+#define DISTFLT_LOFRQ_CYCLELEN  (0)
+#define DISTFLT_HIFRQ_CYCLELEN  (1)
+#define DISTFLT_SKIPCNT                 (2) /* int */
+        /* internal ??  */
+#define DISTFLT_SRATE                   (3)
+#define DISTFLT_NYQUIST                 (4)
+
+/* DISTORT_PCH */
+#define DISTPCH_OCTVAR                  (0)
+#define DISTPCH_CYCLECNT                (1) /* int */
+#define DISTPCH_SKIPCNT                 (2) /* int */
+
+/* DISTORT_OVERLOAD */
+#define DISTORTER_MULT                  (0)
+#define DISTORTER_DEPTH                 (1)
+#define DISTORTER_FRQ                   (2)
+
+/************ NAMES FOR PARAMS, ,OPTIONS, VARIANTS, INTERNAL PARAMS ************/
+
+/* CREATE, EXTRACT, WARPING, REPLOTTING, CONVERT */
+#define ENV_WSIZE               (0)             /* MSECS */
+/* SWELL */
+#define ENV_PEAKTIME    (0)     /* double OR int : depends on MODE */
+/* DOVETAILING */
+#define ENV_STARTTRIM   (0)     /* double OR int : depends on MODE */
+#define ENV_ENDTRIM             (1)     /* double OR int : depends on MODE */
+#define ENV_STARTTYPE   (2) /* int */
+#define ENV_ENDTYPE             (3) /* int */
+/* CURTAILING */
+#define ENV_STARTTIME   (0)     /* double : but will pre-convert?? to int, depending on ENV_TIMETYPE */
+#define ENV_ENDTIME             (1)     /* double : but will pre-convert?? to int, depending on ENV_TIMETYPE */
+/* CURTAILING AND SWELL */
+#define ENV_ENVTYPE         (2) /* int */
+
+/* ATTACK */
+#define ENV_ATK_GATE    (0)
+#define ENV_ATK_ATTIME  (0)
+#define ENV_ATK_GAIN    (1)
+#define ENV_ATK_ONSET   (2)
+#define ENV_ATK_TAIL    (3)
+
+/* DOVETAILING, CURTAILING */
+#define ENV_TIMETYPE    (4) /* int */
+
+/* ATTACK */
+#define ENV_ATK_ENVTYPE (4) /* int */
+
+
+/* WARPING_RESHAPING,REPLOTTING */
+#define ENV_EXAG                (1)
+#define ENV_ATTEN               (1)
+#define ENV_LIFT                (1)
+#define ENV_FLATN               (1)     /* int */
+#define ENV_GATE                (1)
+#define ENV_TROFDEL             (1)     /* int */
+#define ENV_LIMIT               (1)
+#define ENV_AVERAGE             (1)     /* int */
+#define ENV_TSTRETCH    (1)
+
+/* various */
+#define ENV_THRESHOLD   (2)
+#define ENV_MIRROR              (2)
+/* korrug */
+#define ENV_PKSRCHWIDTH (2)     /* int */
+/* trigger */
+#define ENV_TRIGRISE    (2)
+
+/* trigger */
+#define ENV_TRIGDUR             (3)
+/* expand and gate */
+#define ENV_SMOOTH              (3)     /* int */
+
+/* EXTRACT, REPLOTTING, CONVERT : OPTION */
+#define ENV_DATAREDUCE  (4)
+
+/* INTERNAL */
+#define ENV_SAMP_WSIZE  (5)     /* int */                  /*RWD*/
+#define ENV_ATK_TIME    (6)     /* int */
+
+/* PLUCK */
+#define ENV_PLK_ENDSAMP (0)
+#define ENV_PLK_WAVELEN (1)
+#define ENV_PLK_CYCLEN  (4)
+#define ENV_PLK_DECAY   (5)
+/* INTERNAL for PLUCK */
+#define ENV_PLK_OBUFLEN         (6)
+#define ENV_PLK_OWRAPLEN        (7)
+
+/* TREMOL */
+#define ENV_TREM_FRQ        (0)
+#define ENV_TREM_DEPTH      (1)
+#define ENV_TREM_AMP        (2)
+
+/************ NAMES FOR PARAMS, ,OPTIONS, VARIANTS, INTERNAL PARAMS ************/
+
+/* ZIGZAG */
+#define ZIGZAG_START  (0)
+#define ZIGZAG_END        (1)
+#define ZIGZAG_DUR        (2)
+#define ZIGZAG_MIN        (3)
+#define ZIGZAG_SPLEN  (4)
+#define ZIGZAG_MAX        (5)
+#define ZIGZAG_RSEED  (6)
+/* internal */
+#define ZIG_SPLICECNT (7)
+#define ZIG_SPLBYTES  (8)
+#define ZIG_SPLSAMPS  (9)
+#define ZIG_RUNSTOEND (10)
+
+/* LOOP */
+#define LOOP_OUTDUR     (0)
+#define LOOP_REPETS     (1)     /* int */
+#define LOOP_START      (2)
+#define LOOP_LEN        (3)
+#define LOOP_STEP       (4)
+#define LOOP_SPLEN      (5)
+#define LOOP_SRCHF      (6)
+/* flag only : only for names */
+#define FROM_START_FLAG (7)
+/* internal */
+/* as ZIGZAG (7) */
+/* as ZIGZAG (8) */
+/* as ZIGZAG (9) */
+/* as ZIGZAG (10)*/
+
+/* SCRAMBLE */
+#define SCRAMBLE_MIN     (0)
+#define SCRAMBLE_LEN     (0) /* different mode */
+#define SCRAMBLE_MAX     (1)
+#define SCRAMBLE_SCAT    (1) /* different mode */
+#define SCRAMBLE_DUR     (2)
+#define SCRAMBLE_SPLEN   (3)
+#define SCRAMBLE_SEED    (4) /* int */
+/* flag only : only for names : DO NOT CONFUSE WITH INTERNAL FLAG NAMES !!!! */
+#define FROM_START_SCRAMBLE (5)
+#define TO_END_SCRAMBLE         (6)
+/* internal */
+#define SCRAMBLE_OUTLEN  (5) /* int */
+#define SCRAMBLE_CHCNT   (6) /* int */
+/* as ZIGZAG (7) */
+/* as ZIGZAG (8) */
+/* as ZIGZAG (9) */
+/* as ZIGZAG (10)*/
+
+#define ITER_DUR                (0)
+#define ITER_REPEATS    (0)
+#define ITER_DELAY              (1)
+#define ITER_RANDOM             (2)
+#define ITER_PSCAT              (3)
+#define ITER_ASCAT              (4)
+#define ITER_FADE               (5)
+#define ITER_GAIN               (6)
+#define CHUNKSTART              (5)
+#define CHUNKEND                (6)
+#define ITER_RSEED              (7)
+/* internal params */
+#define ITER_STEP               (8)
+#define ITER_MSAMPDEL   (10)
+#define ITER_DO_SCALE   (11)
+#define ITER_PROCESS    (12)
+
+#define ITER_LGAIN      (7)
+#define ITER_RRSEED (8)
+#define ITER_SSTEP  (9)
+
+/* DRUNKWALK */
+#define DRNK_TOTALDUR    (0)    /* d */
+#define DRNK_LOCUS               (1)    /* D */
+#define DRNK_AMBITUS     (2)    /* D */
+#define DRNK_GSTEP               (3)    /* D */
+#define DRNK_CLOKTIK     (4)    /* D */
+#define DRNK_MIN_DRNKTIK (5)    /* I */
+#define DRNK_MAX_DRNKTIK (6)    /* I */
+/* option */
+#define DRNK_SPLICELEN   (7)    /* d */
+/* flagged */
+#define DRNK_CLOKRND     (8)    /* D */
+#define DRNK_OVERLAP     (9)    /* D */
+#define DRNK_RSEED               (10)   /* i */
+#define DRNK_MIN_PAUS    (11)   /* D */
+#define DRNK_MAX_PAUS    (12)   /* D */
+/* internal params */
+#define DRNK_LGRAIN               (13)  /* int */
+#define DRNK_DWNSHIFT     (14)  /* int */
+#define DRNK_MAXHOLD      (15)  /* int */
+#define DRNK_MAX_OVLAP    (16)  /* int */
+#define DRNK_DRNKTIK_RANG (17)  /* int */
+#define DRNK_PAUS_RANG    (18)  /* int */
+#define DRNK_LAST_LOCUS   (19)  /* int */
+
+/******************* PARAMS ********************/
+
+#define FLT_Q           (0)
+/* filteq */
+#define FLT_BW          (0)
+#define FLT_GAIN        (1)
+/* eq */
+#define FLT_BOOST       (1)
+#define FLT_LOFRQ       (2)
+/* eq, fstatvar */
+#define FLT_ONEFRQ      (2)
+/* lphp */
+#define FLT_PASSFRQ     (2)
+/* allpass, fltiter */
+#define FLT_DELAY       (2)
+/* allpass */
+#define FLT_HIFRQ       (3)
+/* fltiter */
+#define FLT_OUTDUR      (3)
+/* lphp */
+#define FLT_STOPFRQ     (3)
+
+/* fltbankn */
+#define FLT_INCOUNT     (4)     /* CARE!! don't confuse with FLT_CNT */
+#define FLT_INTSIZE     (4)
+#define FLT_OFFSET      (4)
+/* fltsweep */
+#define FLT_SWPFRQ      (4)
+//TW NEW
+#define FILT_TAIL       (5)
+#define FILT_TAILV      (3)
+/*----------- options ------------*/
+//TW NEW, NUMBERING MODIFIED
+/* fltbnkhv */
+#define FLT_HARMCNT     (4)     /* int */
+#define FLT_ROLLOFF     (5)
+#define FLT_PRESCALE (6)
+/* fltbankn */
+#define FLT_RANDFACT (6)
+/* fltsweep */
+#define FLT_SWPPHASE (6)
+/* fltiter */
+#define FLT_RANDDEL  (7)
+#define FLT_PSHIFT       (8)
+#define FLT_AMPSHIFT (9)
+/*----------- internal -----------*/
+//TW NEW, NUMBERING MODIFIED
+#define FLT_WORDCNT             (8)
+#define FLT_ENTRYCNT    (9)             /* int */       /* no of entries on a fltbankv line */
+#define FLT_INV_SR              (10)                                    /* inverse of srate */
+#define FLT_CNT                 (11)    /* int */  /* number of filters */
+#define FLT_SAMS                (12)    /* int */  /* Q-(or delay-)brkpnt_segment sample-counter */
+#define FLT_OVFLW               (13)    /* int */  /* overflows counter */
+#define FLT_BLOKSIZE    (14)    /* int */  /* bloksize before filter-val altered */
+#define FLT_BLOKCNT             (15)    /* int */  /* counter inside filter block */
+#define FLT_Q_INCR              (16)                       /* samp-to-samp increment of Q in current Q-blok */
+
+/* allpass */
+//TW NEW, NUMBERING MODIFIED
+#define FLT_D_INCR              (10)                                    /* samp-to-samp increment of delay in current delay-blok */
+#define FLT_MAXDELSAMPS (11)    /* int */   /* max delay in (stereo-pairs-counted-as-1) samples */
+#define FLT_DELBUFPOS   (15)    /* int */       /* current position for writing to delay buffer */
+#define FLT_PHSAMS              (16)    /* int */       /* phasing strength brkpnt counter */
+#define FLT_PH_INCR         (17)                                /* samp-to-samp increment of strength in current strength-blok */
+
+/* eq */
+//TW NEW, NUMBERING MODIFIED
+#define FLT_A0                  (11)                            /* filter coeff for eq */
+#define FLT_A1                  (12)                            /* filter coeff for eq */
+#define FLT_A2                  (14)                            /* filter coeff for eq */
+#define FLT_B1                  (15)                            /* filter coeff for eq */
+#define FLT_B2                  (16)                            /* filter coeff for eq */
+
+/* lphp */
+//TW NEW, NUMBERING MODIFIED
+#define FLT_MUL                   (10)
+#define FLT_INTERNAL_GAIN (12)
+
+/* time-varying filter frq-amps */
+//TW NEW, NUMBERING MODIFIED
+#define FLT_FSAMS               (17)    /* int */  /* timed-filter-'brkpnt'_segment sample-counter */
+#define FLT_F_INCR              (18)                       /* samp-to-samp increment of Filt frq in current flt-blok */
+/* above 2 also used in FSTATVAR */
+#define FLT_TIMESLOTS   (19)    /* int */  /* number of timeslotes for changing filter */
+#define FLT_TIMES_CNT   (20)    /* int */  /* runnig counter of tvary-filter timeslots */
+#define FLT_FRQ_INDEX   (21)    /* int */  /* base index for next set of filter-data, tvarying filter */
+#define FLT_A_INCR              (22)                       /* samp-to-samp increment of Filt amp in current flt-blok */
+#define HRM_ENTRYCNT    (23)
+#define HRM_WORDCNT             (24)
+#define FLT_TIMESTEP    (25)
+#define FLT_TOTALTIME   (26)
+
+/* fltsweep */
+//TW NEW, NUMBERING MODIFIED
+#define FLT_CYCPOS      (17)                       /* position in sweep-wave cycle */
+#define FLT_SWINCR              (18)                       /* samp-to-samp increment of sweepfrq in current sfrq blok */
+/* NB This has to be at 18, because FSTATVAR also uses it */
+#define FLT_QFAC                (19)                       /* Q derived factor entering into filter calcs */
+#define FLT_SWSAMS              (20)                       /* sweepfrq-brkpnt segment sample-counter */
+#define FLT_LOINCR              (21)                       /* samp-to-samp increment of lofrq in current lofrq blok */
+#define FLT_LOSAMS              (22)                       /* lofrq-brkpnt segment sample-counter */
+#define FLT_HIINCR              (23)                       /* samp-to-samp increment of hifrq in current hifrq blok */
+#define FLT_HISAMS              (24)                       /* hifrq-brkpnt segment sample-counter */
+/* fltiter */
+//TW NEW, NUMBERING MODIFIED
+#define FLT_INMSAMPSIZE (14)    /* int */  /* input size counted in (stereopair = 1) samples */
+#define FLT_MSAMPDEL    (15)    /* int */  /* iteration delay counted ditto */
+#define FLT_SMPDEL              (16)    /* int */  /* iteration delay counted in standard (short) samples */
+#define FLT_DOFLAG              (17)    /* int */  /* internal flag for fltiter */
+#define FLT_OVFLWSIZE   (18)    /* int */  /* size of overflow buffer for fltiter */
+#define FLT_INFILESPACE (19)    /* int */  /* size of input buffers for fltiter */
+#define FLT_WRITESTART  (20)    /* int */  /* position in buffer to write next filtered copy, for fltiter */
+#define FLT_MAXOVERLAY  (21)    /* int */  /* maximum superimpositions of infile, for fltiter */
+#define FLT_SAMPATTEN   (22)                       /* sample-by-sample attenuation */
+
+/************ NAMES FOR PARAMS, ,OPTIONS, VARIANTS, INTERNAL PARAMS ************/
+
+/* params : PARTICULAR */
+/* OMIT */
+#define GR_KEEP                         (0)  /* I */
+#define GR_OUT_OF                       (1)  /* i */
+/* DUPLICATE */
+#define GR_DUPLS                        (0)  /* I */
+/* TIMEWARP */
+#define GR_TSTRETCH                     (0)  /* D */
+/* POSITION, ALIGN */
+#define GR_OFFSET                       (0)  /* d */
+/* ALIGN */
+#define GR_GATE2                        (1)  /* D */
+/*---------------------*/
+/* options/flags with params : UNIVERSAL: MUST BE SO, for preprocessing to work!!! */
+#define GR_BLEN                         (2)  /* d */
+#define GR_GATE                         (3)  /* I */
+#define GR_MINTIME                      (4)      /* d */
+#define GR_WINSIZE                      (5)      /* d */
+/*---------------------*/
+/* flag name ONLY */
+#define LOSE_LAST_GRAIN_FLAG (6)  /* 0 */
+/*---------------------*/
+/* internal : UNIVERSAL */
+#define GR_NGATE                        (6)
+#define GR_MINHOLE                      (7)  /* int */
+/*#define       GR_WSIZE_BYTES          (7)*/    /* int */
+#define GR_WSIZE_SAMPS          (8)                                                /* RWD */
+#define GR_WINCNT                       (9)      /* int */
+#define GR_SPLICELEN            (10)  /* int */
+#define GR_SPLUS1                       (11) /* int */
+#define GR_ABS_SPLICELEN        (12) /* int */
+#define GR_ABS_SPLICEX2         (13) /* int */
+#define GR_THISBRKSAMP          (14) /* int */
+#define GR_NEXTBRKSAMP          (15) /* int */
+#define GR_NEXTGATE                     (16)
+#define GR_FGATE                        (17)
+#define GR_GATESTEP                     (18)
+#define GR_UP                           (19) /* int */
+#define GR_TESTLIM                      (20) /* int */
+/*---------------------*/
+/* internal : PARTICULAR */
+/* reposition, [find?] & align only */
+#define GR_SYNCCNT                      (21) /* int */
+/* reverse */
+#define GR_ARRAYSIZE            (21) /* int */
+/* reordr only */
+#define GR_REOSTEP                      (21) /* int */
+#define GR_REOCNT                       (22) /* int */
+#define GR_REOLEN                       (23) /* int */
+/* repitch, rerhythm, remotif only */
+#define GR_RATIOCNT                     (21) /* int */
+/* repitch: remotif only */
+#define GR_STORESIZE            (22) /* int */
+
+/************************** MIX PARAMS *********************/
+
+/* inbetween */
+#define INBETW                  (0)
+/* cyc_inbetween */
+#define BTWN_HFRQ               (1)
+/* cross */
+#define MCR_STAGGER             (0)
+#define MCR_BEGIN               (1)
+#define MCR_END                 (2)
+#define MCR_POWFAC              (3)
+        /* internal */
+#define MCR_CONTOUR             (4)     /* int */
+#define MCR_INDEX               (5)     /* int */
+#define MCR_CROSFACT    (6)
+
+/* merge */
+#define MIX_STAGGER             (0)
+#define MIX_SKIP                (1)
+#define MIX_SKEW                (2)
+#define MIX_STTA                (3)
+#define MIX_DURA                (4)
+        /* internal */
+#define MIX2_GAIN1              (5)
+#define MIX2_GAIN2              (6)
+
+/* twarp */
+#define MTW_PARAM                       (0)
+/* sync */
+#define MSY_WFAC                        (0)     /* int */
+        /* flagname only */
+#define MSY_POWMETHOD_FLAG      (1)
+        /* internal */
+#define MSY_SRFAC                       (1)     /* int */
+/* swarp */
+#define MSW_TWLINE                      (0)
+#define MSW_NARROWING           (0)
+#define MSW_POS1                        (0)
+#define MSW_POS2                        (1)
+/* gain */
+#define MIX_GAIN                        (0)
+/* shuffle, twarp, swarp, gain */
+#define MSH_STARTLINE           (2)
+#define MSH_ENDLINE                     (3)
+#define MSH_NOCHECK_FLAG        (4)
+
+/* real mix */
+#define MIX_START                       (0)
+#define MIX_END                         (1)
+#define MIX_ATTEN                       (2)
+        /* flagname only */
+#define ALTERNATIVE_MIX_FLAG    (2)
+        /* internal */
+#define MIX_STRTPOS                             (2)     /* int */
+#define MIX_STRTPOS_IN_ACTION   (3)     /* int */
+#define MIX_TOTAL_ACTCNT                (4)     /* int */
+
+/* FLAGS */
+
+/* mix */
+#define ALTERNATIVE_MIX         (0)
+/* mixshufl */
+#define MSH_NOCHECK                     (0)
+
+#define MSY_POWMETHOD           (0)
+
+/* ARRAYS (double) */
+
+/* sync */
+#define MSY_TIMESTOR            (0)
+#define MSY_STARTSRCH           (1)
+#define MSY_ENDSRCH                     (2)
+/* timewarp */
+#define MTW_TIMESTOR            (0)
+#define MTW_TIMEDIFF            (1)
+/* spacewarp */
+#define MSW_TIMESTOR            (0)
+/* gain */
+#define MIX_LLEVELSTOR          (0)
+#define MIX_RLEVELSTOR          (1)
+/* merge */
+#define MCR_COSTABLE            (0)
+
+/* ARRAYS (long) */
+
+/* sync */
+#define MSY_PEAKSAMP            (0)
+#define MSY_SAMPSIZE            (1)
+#define MSY_ENVEL                       (2)
+
+/* ARRAYS (int) */
+
+/* sync */
+#define MSY_CHANS                       (0)
+#define MSY_ENVPOS                      (1)
+
+/******* PARAMS ******/
+/* brassage */
+#define GRS_VELOCITY            (0)
+#define GRS_DENSITY                     (1)
+#define GRS_HVELOCITY           (2)
+#define GRS_HDENSITY            (3)
+#define GRS_GRAINSIZE           (4)
+#define GRS_PITCH                       (5)
+#define GRS_AMP                         (6)
+#define GRS_SPACE                       (7)
+#define GRS_BSPLICE                     (8)
+#define GRS_ESPLICE                     (9)
+#define GRS_HGRAINSIZE          (10)
+#define GRS_HPITCH                      (11)
+#define GRS_HAMP                        (12)
+#define GRS_HSPACE                      (13)
+#define GRS_HBSPLICE            (14)
+#define GRS_HESPLICE            (15)
+#define GRS_SRCHRANGE           (16)
+#define GRS_SCATTER                     (17)
+#define GRS_OUTLEN                      (18)
+#define GRS_CHAN_TO_XTRACT      (19)
+/* flagnames only */
+//#define GRS_NO_DECCEL_FLAG    (20)
+//#define GRS_EXPON_FLAG                (21)
+//#define GRS_NO_INTERP_FLAG    (22)
+/* internal */
+#define GRS_PRANGE                      (20)
+#define GRS_SPRANGE                     (21)
+#define GRS_VRANGE                      (22)
+#define GRS_DRANGE                      (23)
+#define GRS_INCHANS                     (24)
+#define GRS_OUTCHANS            (25)
+#define GRS_BUF_SMPXS           (26)
+#define GRS_BUF_XS                      (27)
+#define GRS_GLBUF_SMPXS         (28)
+#define GRS_LBUF_SMPXS          (29)
+#define GRS_LBUF_XS                     (30)
+#define GRS_IS_BTAB                     (31)
+#define GRS_IS_ETAB                     (32)
+#define GRS_CHANNELS            (33)
+#define ORIG_SMPSIZE            (34)
+#define SAMPS_IN_INBUF          (35)
+#define GRS_ARANGE                      (36)
+#define GRS_GRANGE                      (37)
+#define GRS_BRANGE                      (38)
+#define GRS_ERANGE                      (39)
+#define GRS_LONGS_BUFLEN        (40)
+#define GRS_ARRAYSIZE           (41)
+
+/************ NAMES FOR PARAMS, ,OPTIONS, VARIANTS, INTERNAL PARAMS ************/
+
+#define TEXTURE_DUR                     (0)
+#define TEXTURE_PACK            (1)     /* for applics with no prior timed set of notes */
+#define TEXTURE_SKIP            (1)     /* for applics with a timed set already */
+#define TEXTURE_SCAT            (2)
+#define TEXTURE_TGRID           (3)
+#define TEXTURE_INSLO           (4)       /* int */
+#define TEXTURE_INSHI           (5)   /* int */
+#define TEXTURE_MINAMP          (6)
+#define TEXTURE_MAXAMP          (7)
+#define TEXTURE_MINDUR          (8)
+#define TEXTURE_MAXDUR          (9)
+#define TEXTURE_MINPICH         (10)
+#define TEXTURE_MAXPICH         (11)
+
+#define TEX_PHGRID                      (12)
+#define TEX_GPSPACE                     (13)  /* int */
+#define TEX_GRPSPRANGE          (14) /* current spatial range of group */
+#define TEX_AMPRISE                     (15)
+#define TEX_AMPCONT                     (16)  /* int */
+#define TEX_GPSIZELO            (17)  /* int */
+#define TEX_GPSIZEHI            (18)  /* int */
+#define TEX_GPPACKLO            (19)
+#define TEX_GPPACKHI            (20)
+#define TEX_GPRANGLO            (21)
+#define TEX_GPRANGHI            (22)
+#define TEX_MULTLO                      (23)
+#define TEX_MULTHI                      (24)
+#define TEX_DECPCENTRE          (25)  /* int */
+        /* options or variants */
+#define TEXTURE_ATTEN           (26)
+#define TEXTURE_POS                     (27)
+#define TEXTURE_SPRD            (28)
+#define TEXTURE_SEED            (29)
+
+#define TEX_IGNOREDUR_FLAG        (30)
+#define DONT_KEEP_MTFDUR_FLAG (31)
+#define INS_TO_SCATTER_FLAG       (32)
+#define FORCEHI_FLAG              (33)
+#define FORCE_EVERY_FLAG          (34)
+#define DISCARD_ORIGLINE_FLAG (35)
+
+/* internal params */
+#define SPINIT                  (30) /* int */ /* flags spatialisation of motif beginning */
+#define SPCNT                   (31) /* int */ /* count of spatialised motif items */
+#define DIRECTION               (32) /* int */ /* spatial direction of motif */
+#define CPOS                    (33)               /* central position of a motion at time x */
+#define TPOSITION               (34)               /* spatial position of note in tset */
+#define THISSPRANGE             (35)               /* current spatial range */
+#define TEX_MAXOUT              (36) /* float */ /* abs max output level */             /*RWD*/
+
+/* PVOC */
+
+#define PVOC_CHANS_INPUT                (0)
+#define PVOC_WINOVLP_INPUT              (1)
+#define PVOC_CHANSLCT_INPUT             (2)
+#define PVOC_LOCHAN_INPUT               (3)
+#define PVOC_HICHAN_INPUT               (4)
+#define PVOC_CHANS                              (5)
+#define PVOC_WIN_OVERLAP                (6)
+#define PVOC_MINSAMP                    (7)
+#define PVOC_MAXSAMP                    (8)
+#define PVOC_SELECTED_CHAN              (9)
+#define PVOC_PARTIAL_RESYNTH    (10)
+#define PVOC_AF_PAIR_LO                 (11)
+#define PVOC_AF_PAIR_HI                 (12)
+#define PVOC_ANAL_ONLY                  (13)
+#define PVOC_ENVOUT_ONLY                (14)
+#define PVOC_MAGOUT_ONLY                (15)
+#define PVOC_SYNTH_ONLY                 (16)
+
+/* MOD_LOUDNESS */
+
+#define LOUD_GAIN                               (0)
+#define LOUD_LEVEL                              (1)
+
+/* MOD_SPACE */
+
+#define PAN_PAN                                 (0)
+#define PAN_PRESCALE                    (1)
+
+#define NARROW                                  (0)
+
+/* MOD_PITCH */
+
+        /* strans, vtrans */
+#define VTRANS_TRANS                    (0)
+        /* accel */
+#define ACCEL_ACCEL                             (0)
+#define ACCEL_GOALTIME                  (1)
+#define ACCEL_STARTTIME                 (2)
+        /* vibrato */
+#define VIB_FRQ                                 (0)
+#define VIB_DEPTH                               (1)
+        /* internal */
+        /* strans, accel, vibrato */
+#define VTRANS_HBUFSIZE                 (3)
+        /* vtrans */
+#define UNITSIZE                                (1)
+#define UNIT_BUFLEN                             (2)
+#define UNITS_READ                              (3)
+#define TOTAL_UNITS_READ                (4)
+#define UNITS_RD_PRE_THISBUF    (5)
+#define VTRANS_SR                               (6)
+
+        /* MOD_REVECHO */
+#define DELAY_DELAY                             (0)
+#define DELAY_MIX                               (1)
+#define DELAY_FEEDBACK                  (2)
+#define DELAY_LFOMOD                    (3)
+#define DELAY_LFOFRQ                    (4)
+#define DELAY_LFOPHASE                  (5)
+#define DELAY_LFODELAY                  (6)
+#define DELAY_TRAILTIME                 (7)
+#define DELAY_PRESCALE                  (8)
+#define DELAY_SEED                              (9)     /* int */
+                /* flags only */
+#define DELAY_INVERT_FLAGNAME   (10)
+                /* internal */
+#define DELAY_INVERT                    (10)
+#define DELAY_MODRANGE                  (11)
+#define DELAY_LFOFLAG                   (12) /* int */
+#define DELAY_MODLEN                    (13)
+#define DELAY_MDELAY                    (14) /* int */
+                /* stadium */
+#define STAD_PREGAIN                    (0)
+#define STAD_ROLLOFF                    (1)
+#define STAD_SIZE                               (2)
+#define STAD_ECHOCNT                    (3) /* int */
+                /* internal */
+#define STAD_MAXDELAY                   (4)
+#define STAD_OVFLWSZ                    (5)
+
+/* MOD_RADICAL */
+        /* reverse */
+        /* internal */
+#define REV_BUFCNT                              (0) /* int */
+/*#define REV_RBYTES                            (1)*/   /* int */                         /*RWD*/
+#define REV_RSAMPS                              (1)
+#define REV_SECOFFSET                   (2) /* int */
+#define REV_WRAPBYTES                   (3)        /* int */                      /*RWD NOT USED NOW*/
+
+        /* SHRED */
+#define SHRED_CNT                               (0)  /* int */
+#define SHRED_CHLEN                             (1)
+#define SHRED_SCAT                              (2)
+        /* internal */
+#define SHRED_SPLEN                             (3)  /* int */
+#define SHRED_HSPLEN                    (4)  /* int */
+#define SHRED_SPLENPOW2                 (5)  /* int */
+#define SHR_LAST_BUFLEN                 (6)  /* int */
+#define SHR_LAST_CHCNT                  (7)  /* int */
+#define SHR_LAST_SCAT                   (8)  /* int */
+#define SHR_UNITLEN                             (9)  /* int */
+#define SHR_RAWLEN                              (10) /* int */
+#define SHR_ENDRAWLEN                   (11) /* int */
+#define SHR_SCATGRPCNT                  (12) /* int */
+#define SHR_RANGE                               (13) /* int */
+#define SHR_CHCNT_LESS_ONE              (14) /* int */
+#define SHR_ENDSCAT                             (15) /* int */
+#define SHR_ENDRANGE                    (16) /* int */
+#define SHR_CHCNT                               (17) /* int */
+        /* SCRUB */
+#define SCRUB_TOTALDUR                  (0)
+#define SCRUB_MINSPEED                  (1)
+#define SCRUB_MAXSPEED                  (2)
+#define SCRUB_STARTRANGE                (3)
+#define SCRUB_ESTART                    (4)
+        /* internal */
+#define SCRUB_ENDRANGE                  (5)      /* int */
+#define SCRUB_SPEEDRANGE                (6)
+#define SCRUB_LENGTH                    (7)      /* int */
+#define SCRUB_SININTEGRAL               (8)
+#define SCRUB_TABINC                    (9)
+#define SCRUB_DROPOUT                   (10) /* int */
+#define SCRUB_BUFCNT                    (11) /* int */
+        /* LOBIT */
+#define LOBIT_BRES                              (0)
+#define LOBIT_TSCAN                             (1)
+        /* internal */
+#define LOBIT_HF_BRES                   (2)
+#define LOBIT_BRES_SHIFT                (3)
+#define LOBIT_HF_TSCAN                  (4)
+#define LOBIT_TSCAN_SHIFT               (5)
+        /* RINGMOD */
+#define RM_FRQ                                  (0)
+
+        /* EDIT */
+#define CUT_CUT                                 (0)
+#define CUT_END                                 (1)
+#define CUT_SPLEN                               (2)
+#define INSERT_LEVEL                    (3)
+
+        /* internal */
+#define END_SPLICE_ADDR                 (4)  /* int */  /* join ONLY */
+#define CUT_BYTECUT                             (4)  /* int */
+#define CUT_BYTEEND                             (5)      /* int */
+/* #define CUT_BYTELEN                          (6) */ /* int */
+#define CUT_LEN                         (6)                                              /*RWD*/
+#define CUT_HLFSPLEN                    (7)  /* int */
+#define CUT_BYTESPLEN                   (8)  /* int */
+#define CUT_BUFXS                               (9)  /* int */
+#define CUT_BYTEBUFXS                   (10) /* int */
+#define CUT_BUFOFFSET                   (11) /* int */
+#define CUT_BYTEBUFOFFSET               (12) /* int */
+#define CUT_BUFREMNANT                  (13) /* int */
+#define CUT_BUFCNT                              (14) /* int */
+#define CUT_BUFCNT2                             (15) /* int */
+#define CUT_SECCNT                              (16) /* int */
+#define CUT_SECCNT2                             (17) /* int */
+#define CUT_BYTEREMAIN                  (18) /* int */
+#define CUT_SECSREMAIN                  (19) /* int */
+#define CUT_SECSREMAIN2                 (20) /* int */
+#define CUT_SMPSREMAIN                  (21) /* int */
+#define CUT_GOES_TO_END                 (22) /* int */
+#define CUT_NO_END                              (23) /* int */
+#define CUT_NO_STT                              (24) /* int */
+#define EXCISE_CNT                              (25) /* int */
+#define SMALLBUFSIZ                             (26) /* int */
+
+/* RANDCUTS */
+
+#define RC_CHLEN                (0)
+#define RC_SCAT                 (1)
+#define RC_CHCNT                (2)     /* internal */
+#define RC_SCATGRPCNT   (3)     /* internal */
+#define RC_ENDSCAT              (4) /* internal */
+#define RC_RANGE                (5) /* internal */
+#define RC_ENDRANGE             (6) /* internal */
+#define RC_UNITLEN              (7) /* internal */
+
+        /* RANDCHUNKS ONLY */
+#define CHUNKCNT                                (0)
+#define MINCHUNK                                (1)
+#define MAXCHUNK                                (2)
+
+/* HOUSE_COPY */
+#define COPY_CNT                                (0)  /* int */
+
+/* HOUSE_CHANS */
+#define CHAN_NO                                 (0)  /* int */
+
+/* HOUSE_SORT */
+#define SORT_SMALL                              (0)
+#define SORT_LARGE                              (1)
+#define SORT_STEP                               (2)
+/* internal */
+#define SORT_LENCNT                             (3)     /* int */
+
+/* HOUSE_SPEC */
+#define HSPEC_SRATE                             (0)     /* int */
+#define HSPEC_CHANS                             (1)     /* int */
+#define HSPEC_TYPE                              (2)     /* int */
+/* internal */
+#define RSMP_OBUFSIZE                   (3)     /* int */
+#define RSMP_OBUFLEN                    (4)     /* int */
+#define RSMP_HISR                               (5)     /* int */
+#define RSMP_QIK                                (6)     /* int */
+
+/* HOUSE_EXTRACT */
+#define RECTIFY_SHIFT                   (0)     /* int */
+#define TOPN_GATE                               (0)     /* int */
+#define TOPN_SPLEN                              (1)
+        /* internal */
+#define TOPN_NGATE                              (2)     /* int */
+#define LAST_TOTALSAMPS_READ    (3)     /* int */
+
+#define CUTGATE_GATE            (0)     /* int */
+#define CUTGATE_SPLEN           (1)     /* int */
+#define CUTGATE_ENDGATE         (2)     /* int */
+#define CUTGATE_THRESH          (3)     /* int */
+#define CUTGATE_SUSTAIN         (4)     /* int */
+#define CUTGATE_BAKTRAK         (5)     /* int */
+#define CUTGATE_INITLEVEL       (6)     /* int */
+#define CUTGATE_MINLEN          (7)
+        /* internal or not */
+#define CUTGATE_WINDOWS         (8)     /* int */
+        /* internal */
+#define CUTGATE_NUMSECS         (9)      /* int */
+#define CUTGATE_NSEC            (10) /* int */
+#define CUTGATE_NBUFS           (11) /* int */
+//#define CUTGATE_BYTEBLOK      (12) /* int */
+#define CUTGATE_SAMPBLOK        (12) /* int */
+#define CUTGATE_SHRTBLOK        (13) /* int */
+#define CUTGATE_TYPFACT         (14) /* int */
+#define CUTGATE_SPLCNT          (15) /* int */
+
+//TW : REDUNDANT ITEMS REMOVED
+
+/* HOUSE RECOVER */
+#define DUMP_OK_CNT                     (0)
+#define DUMP_OK_PROP            (1)
+#define DUMP_OK_SAME            (2)
+#define SFREC_SHIFT                     (3)
+//TW : REDUNDANT ITEM REMOVED
+/* internal recover */
+//TW : RENUMBERED PLUS SOME REMOVED
+#define SFD_OUTFILESIZE         (4)     /* i */
+#define HEADER_CNT                      (5)     /* i */
+#define OK_HEADER_CNT           (6) /* i */
+#define TRUE_HEADER_CNT         (7) /* i */
+#define HEADER_VARIANT_CNT      (8) /* i */
+#define CRC_AT                          (9) /* i */
+#define OK_CORRESPONDENCE       (10) /* i */
+#define UNKNOWN_CNT                     (11) /* i */
+#define RENAME_CNT                      (12) /* i */
+
+
+/* SNDINFO */
+#define TIMESUM_SPLEN           (0)
+#define INFO_SAMPS                      (0)     /* int */
+#define INFO_TIME                       (0)
+#define HOLE_THRESH                     (0)     /* int */
+#define SFDIFF_THRESH           (0)
+#define SFDIFF_CNT                      (1) /* int */
+#define PRNT_START                      (0)
+#define PRNT_END                        (1)
+
+/* MUSUNITS */
+#define MUSUNIT                         (0)
+
+/* SYNTH */
+#define SYN_SRATE                       (0)
+#define SYN_CHANS                       (1)
+#define SYN_DUR                         (2)
+#define SYN_FRQ                         (3)
+#define SYN_AMP                         (4)
+#define SYN_TABSIZE                     (5)
+
+/* SYNTH_SPEC */
+#define SS_DUR                          (0)
+#define SS_CENTRFRQ                     (1)
+#define SS_SPREAD                       (2)
+#define SS_FOCUS                        (3)
+#define SS_FOCUS2                       (4)
+#define SS_TRAND                        (5)
+#define SS_SRATE                        (6)
+
+/* UTILS */
+
+#define U0                                      (0)
+#define U1                                      (1)
+
+/* SINTAB */
+
+#define SIN_FRQ                         (0)
+#define SIN_AMP                         (1)
+#define SIN_DUR                         (2)
+#define SIN_QUANT                       (3)
+#define SIN_PHASE                       (4)
+
+/* ACC_STREAM */
+
+#define ACC_ATTEN                       (0)
+
+/* INFO_MAXSAMP2 */
+
+#define MAX_STIME                       (0)
+#define MAX_ETIME                       (1)
+
+/* HF_PERM1 */
+
+#define HP1_SRATE                       (0)
+#define HP1_ELEMENT_SIZE        (1)
+#define HP1_GAP_SIZE            (2)
+#define HP1_GGAP_SIZE           (3)
+#define HP1_MINSET                      (4)
+#define HP1_BOTNOTE                     (5)
+#define HP1_BOTOCT                      (6)
+#define HP1_TOPNOTE                     (7)
+#define HP1_TOPOCT                      (8)
+#define HP1_SORT1                       (9)
+        /* internal */
+#define HP1_HFCNT                       (10)
+
+/* DEL_PERM */
+/* DEL_PERM2 */
+
+#define DP_SRATE        (0)
+#define DP_DUR          (1)
+#define DP_CYCCNT       (2)
+        /* internal */
+#define DP_NOTECNT      (3)
+#define DP_PERMCNT      (4)
+
+/* TWIXT */
+
+#define IS_SPLEN        (0)
+#define IS_SEGCNT       (1)
+#define IS_WEIGHT       (2)
+        /* internal */
+#define IS_SPLICETIME   (3)
+#define IS_SHSECSIZE    (4)
+
+//TW NEW -->>
+
+/* P_VOWELS */
+#define PV_HWIDTH       (0)
+#define PV_CURVIT       (1)
+#define PV_PKRANG       (2)
+#define PV_FUNBAS       (3)
+#define PV_OFFSET       (4)
+/* VFILT */
+#define VF_THRESH       (3)
+/* HOUSE_GATE */
+#define GATE_ZEROS      (0)
+/* P_GEN */
+#define PGEN_SRATE      (0)
+#define PGEN_CHANS_INPUT (1)
+#define PGEN_WINOVLP_INPUT (2)
+/* CUT_MANY */
+#define CM_SPLICELEN (0)
+/* internal */
+//TW REVISED FOR FLTS
+//#define CM_SPLICEBYTES (1)
+#define CM_SPLICE_TOTSAMPS (1)
+#define CM_SPLICESAMPS (2)
+#define CM_SPLICEINCR  (3)
+/* STACK */
+#define STACK_CNT               (0)
+#define STACK_LEAN              (1)
+#define STACK_OFFSET    (2)
+#define STACK_GAIN              (3)
+#define STACK_DUR               (4)
+/* internal */
+#define STACK_MINTRANS  (5)
+/* DISTORT_PULSED */
+#define PULSE_STARTTIME (0)     /* starttime of impulses in input-sound */
+#define PULSE_DUR               (1)     /* duration of impulse stream */
+#define PULSE_FRQ               (2)     /* frq of impulses */
+#define PULSE_FRQRAND   (3)     /* frq of impulses */
+#define PULSE_TIMERAND  (4)     /* randomisation of pulse shape, timewise */
+#define PULSE_SHAPERAND (5)     /* randomisation of pulse shape, ampwise  */
+#define PULSE_WAVETIME  (6)     /* duration of wavcycle-group to cycle round, within impulse [synth option only] */
+#define PULSE_TRANSPOS  (7)     /* transposition envelope of material inside impulse */
+#define PULSE_PITCHRAND (8)     /* randomisation of transposition envelope */
+/* internal */
+#define PULSE_ENVSIZE   (9)     /* no of paired vals in envelope of impulse */
+#define PULSE_TRNSIZE   (10) /* no of paired vals in transposition envelope of impulse */
+/* noise suppress */
+#define NOISE_SPLEN     (0)
+#define NOISE_MINFRQ (1)
+#define MIN_NOISLEN     (2)
+#define MIN_TONELEN     (3)
+/* time grid */
+#define GRID_COUNT      (0)
+#define GRID_WIDTH      (1)
+#define GRID_SPLEN      (2)
+/* convolve */
+#define CONV_TRANS      (0)
+/* baktobak */
+#define BTOB_CUT        (0)
+#define BTOB_SPLEN      (1)
+/* sequencer */
+#define SEQ_ATTEN       (0)
+#define SEQ_SPLIC       (1)
+/* SHUDDER */
+#define SHUD_STARTTIME  (0)
+#define SHUD_FRQ                (1)
+#define SHUD_SCAT               (2)
+#define SHUD_SPREAD             (3)
+#define SHUD_MINDEPTH   (4)
+#define SHUD_MAXDEPTH   (5)
+#define SHUD_MINWIDTH   (6)
+#define SHUD_MAXWIDTH   (7)
+/* MIX AT STEP */
+#define MIX_STEP                (0)
+/* CLICKS */
+#define CLIKSTART (0)
+#define CLIKEND   (1)
+#define CLIKOFSET (2)
+#define CLICKTIME (3)
+
+/* DOUBLETS */
+#define SEG_DUR (0)
+#define SEG_REPETS (1)
+/* internal */
+#define SEGLEN (2)
+/* SYLLABS */
+#define SYLLAB_SPLICELEN        (0)     /* NB must be same paramno as edit_cutmany CM_SPLICELEN */
+#define SYLLAB_DOVETAIL (1)
+/* BATCH_EXPAND */
+#define BE_INFILE       (0)
+#define BE_OUTFILE      (1)
+#define BE_PARAM        (2)
+/* JOIN_SEQ */
+#define MAX_LEN (3)
+/* ENVSYN */
+#define ENVSYN_WSIZE            (0)
+#define ENVSYN_DUR                      (1)
+#define ENVSYN_CYCLEN           (2)
+#define ENVSYN_STARTPHASE       (3)
+#define ENVSYN_TROF                     (4)
+#define ENVSYN_EXPON            (5)
+/* INEXTEND */
+#define INEXTEND_STT            (0)
+#define INEXTEND_END            (1)
+#define INEXTEND_REP            (2)
+#define INEXTEND_SPL            (3)
+/* RRRR_EXTEND */
+#define RRR_START       (0)
+#define RRR_GATE        (0)
+#define RRR_END         (1)
+#define RRR_GRSIZ       (1)
+#define RRR_STRETCH     (2)
+#define RRR_GET     (3)
+#define RRR_RANGE       (4)
+#define RRR_REPET       (5)
+#define RRR_ASCAT       (6)
+#define RRR_PSCAT       (7)
+#define RRR_SKIP        (8)
+#define RRR_AFTER       (9)
+#define RRR_TEMPO       (10)
+#define RRR_AT          (11)
+/* internal */
+#define RRR_WSIZE       (12)
+#define RRR_SAMP_WSIZE  (13)
+/* VERSION 8+ */
+#define RRR_SLOW    (9)
+#define RRR_REGU    (10)
+/* internal */
+#define RRR_WSIZENU    (11)
+#define RRR_SAMP_WSIZENU    (12)
+/* HOUSE_GATE2 */
+#define GATE2_DUR       (0)
+#define GATE2_ZEROS (1)
+#define GATE2_LEVEL (2)
+#define GATE2_SPLEN (3)
+#define GATE2_FILT      (4)
+/* ZCROSS_RATIO */
+#define ZC_START        (0)
+#define ZC_END          (1)
+/* SSSS_EXTEND */
+#define SSS_DUR                 (0)
+#define  MAX_NOISLEN    (3)
+#define  SSS_GATE        (4)
+/* GREV */
+#define GREV_WSIZE              (0)
+#define GREV_TROFRAC    (1)
+#define GREV_GPCNT              (2)
+#define GREV_TSTR               (3)
+#define GREV_REPETS             (3)
+#define GREV_KEEP               (3)
+#define GREV_DEL                (3)
+#define GREV_OUTOF              (4)
+/* internal */
+#define GREV_SAMP_WSIZE (5)

+ 414 - 0
dev/include/processno.h

@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************* PROGRAM PROCESS NUMBERS ***************************************/
+
+#define MIN_PROCESS_NO  (GAIN)
+/***** SPECTRAL *****/
+/*********** SIMPLE ********/
+#define GAIN            (1)
+#define LIMIT           (2)
+#define BARE            (3)
+#define CLEAN           (4)
+#define CUT                     (5)
+#define GRAB            (6)
+#define MAGNIFY         (7)
+/********* STRETCH ********/
+#define STRETCH         (8)
+#define TSTRETCH        (9)
+/******* PITCH & HARMONY ****/
+#define ALT                     (10)
+#define OCT                     (11)
+#define SHIFTP          (12)
+#define TUNE            (13)
+#define PICK            (14)
+#define MULTRANS        (15)
+#define CHORD           (16)
+/********** HIGHLIGHT ********/
+#define FILT            (17)
+#define GREQ            (18)
+#define SPLIT           (19)
+#define ARPE            (20)
+#define PLUCK           (21)
+#define S_TRACE         (22)
+#define BLTR            (23)
+/***** FOCUS ********/
+#define ACCU            (24)
+#define EXAG            (25)
+#define FOCUS           (26)
+#define FOLD            (27)
+#define FREEZE          (28)
+#define STEP            (29)
+/***** BLUR ******/
+#define AVRG            (30)
+#define BLUR            (31)
+#define SUPR            (32)
+#define CHORUS          (33)
+#define DRUNK           (34)
+#define SHUFFLE         (35)
+#define WEAVE           (36)
+#define NOISE           (37)
+#define SCAT            (38)
+#define SPREAD          (39)
+/******* STRANGE ****/
+#define SHIFT           (40)
+#define GLIS            (41)
+#define WAVER           (42)
+#define WARP            (43)
+#define INVERT          (44)
+/**** MORPH ******/
+#define GLIDE           (45)
+#define BRIDGE          (46)
+#define MORPH           (47)
+/****** REPITCH ******/
+#define PITCH           (48)
+#define TRACK           (49)
+#define P_APPROX        (50)
+#define P_EXAG          (51)
+#define P_INVERT        (52)
+#define P_QUANTISE      (53)
+#define P_RANDOMISE     (54)
+#define P_SMOOTH        (55)
+#define P_TRANSPOSE     (56)
+#define P_VIBRATO       (57)
+#define P_CUT           (58)
+#define P_FIX           (59)
+#define REPITCH         (60)
+#define REPITCHB        (61)
+#define TRNSP           (62)
+#define TRNSF           (63)
+/****** FORMANTS ******/
+#define FORMANTS        (64)
+#define FORM            (65)
+#define VOCODE          (66)
+#define FMNTSEE     (67)
+#define FORMSEE         (68)
+/**** COMBINE *****/
+#define MAKE            (69)
+#define SUM             (70)
+#define DIFF            (71)
+#define LEAF            (72)
+#define MAX                     (73)
+#define MEAN            (74)
+#define CROSS           (75)
+/********** INFO ************/
+#define WINDOWCNT       (76)
+#define CHANNEL         (77)
+#define FREQUENCY       (78)
+#define LEVEL           (79)
+#define OCTVU           (80)
+#define PEAK            (81)
+#define REPORT          (82)
+#define PRINT           (83)
+/********** PITCH INFO ************/
+#define P_INFO          (84)
+#define P_ZEROS         (85)
+#define P_SEE           (86)
+#define P_HEAR          (87)
+#define P_WRITE         (88)
+
+#define TOP_OF_SPEC_PROCESSES           (P_WRITE)
+
+#define FOOT_OF_GROUCHO_PROCESSES       (MANY_ZCUTS)
+
+/**** NON SPECTRAL ***/
+
+#define MANY_ZCUTS               (96) /* several cuts at zero-crossing */
+#define MULTI_SYN                (97) /* synthesize fixed chord */
+#define MIXBALANCE               (98) /* mix two sounds with balance function */
+#define INFO_MAXSAMP2    (99) /* maxsamp over time-range */
+
+/******************* DISTORT **********************/
+
+#define DISTORT_CYCLECNT (100) /* cyclecnt    */
+#define DISTORT          (101)   /* reshape     */
+#define DISTORT_ENV      (102)   /* envelope    */
+#define DISTORT_AVG      (103)   /* average     */
+#define DISTORT_OMT      (104)   /* omit        */
+#define DISTORT_MLT      (105)   /* multiply    */
+#define DISTORT_DIV      (106)   /* divide          */
+#define DISTORT_HRM      (107)   /* harmonic    */
+#define DISTORT_FRC      (108)   /* fractal     */
+#define DISTORT_REV      (109)   /* reverse     */
+#define DISTORT_SHUF (110)       /* shuffle     */
+#define DISTORT_RPT  (111)       /* repeat      */
+#define DISTORT_INTP (112)       /* interpolate */
+#define DISTORT_DEL  (113)       /* delete      */
+#define DISTORT_RPL  (114)       /* replace     */
+#define DISTORT_TEL  (115)       /* telescope   */
+#define DISTORT_FLT  (116)       /* filter      */
+#define DISTORT_INT  (117)       /* interact    */
+#define DISTORT_PCH  (118)       /* pitch       */
+
+/******************* EXTEND **********************/
+
+#define ZIGZAG           (119)   /* zigzag   */
+#define LOOP             (120)   /* loop     */
+#define SCRAMBLE         (121)   /* scramble */
+#define ITERATE          (122)   /* iterate  */
+#define DRUNKWALK        (123)   /* drunk    */
+
+/******************* TEXTURE **********************/
+
+#define SIMPLE_TEX       (124)   /* texture  */
+#define GROUPS           (125)   /* texture  */
+#define DECORATED        (126)   /* texture  */
+#define PREDECOR         (127)   /* texture  */
+#define POSTDECOR        (128)   /* texture  */
+#define ORNATE           (129)   /* texture  */
+#define PREORNATE        (130)   /* texture  */
+#define POSTORNATE       (131)   /* texture  */
+#define MOTIFS           (132)   /* texture  */
+#define MOTIFSIN         (133)   /* texture  */
+#define TIMED            (134)
+#define TGROUPS          (135)
+#define TMOTIFS          (136)
+#define TMOTIFSIN        (137)
+
+/******************* GRAIN **********************/
+
+#define GRAIN_COUNT         (138)
+#define GRAIN_OMIT          (139)
+#define GRAIN_DUPLICATE (140)
+#define GRAIN_REORDER   (141)
+#define GRAIN_REPITCH   (142)
+#define GRAIN_RERHYTHM  (143)
+#define GRAIN_REMOTIF   (144)
+#define GRAIN_TIMEWARP  (145)
+#define GRAIN_GET               (146)
+#define GRAIN_POSITION  (147)
+#define GRAIN_ALIGN     (148)
+#define GRAIN_REVERSE   (149)
+
+/******************* ENVELOPE **********************/
+
+#define ENV_CREATE              (150)
+#define ENV_EXTRACT             (151)
+#define ENV_IMPOSE              (152)
+#define ENV_REPLACE             (153)
+#define ENV_WARPING             (154)
+#define ENV_RESHAPING   (155)
+#define ENV_REPLOTTING  (156)
+#define ENV_DOVETAILING (157)
+#define ENV_CURTAILING  (158)
+#define ENV_SWELL               (159)
+#define ENV_ATTACK              (160)
+#define ENV_PLUCK               (161)
+#define ENV_TREMOL              (162)
+#define ENV_ENVTOBRK    (163)
+#define ENV_ENVTODBBRK  (164)
+#define ENV_BRKTOENV    (165)
+#define ENV_DBBRKTOENV  (166)
+#define ENV_DBBRKTOBRK  (167)
+#define ENV_BRKTODBBRK  (168)
+
+/******************* MIX **********************/
+
+#define MIXTWO           (169)
+#define MIXCROSS         (170)
+#define MIXINTERL        (171)
+#define MIXINBETWEEN (172)
+#define MIX                      (173)
+#define MIXMAX           (174)
+#define MIXGAIN          (175)
+#define MIXSHUFL         (176)
+#define MIXTWARP         (177)
+#define MIXSWARP         (178)
+#define MIXSYNC          (179)
+#define MIXSYNCATT       (180)
+#define MIXTEST          (181)
+#define MIXFORMAT        (182)
+#define MIXDUMMY         (183)
+#define MIXVAR           (184)
+
+/******************* FILTER **********************/
+
+#define EQ                       (185)
+#define LPHP             (186)
+#define FSTATVAR         (187)
+#define FLTBANKN         (188)
+#define FLTBANKC         (189)
+#define FLTBANKU         (190)
+#define FLTBANKV         (191)
+#define FLTSWEEP         (192)
+#define FLTITER          (193)
+#define ALLPASS          (194)
+
+/******************* MODIFY **********************/
+
+#define MOD_LOUDNESS    (195)
+#define MOD_SPACE               (196)
+#define MOD_PITCH               (197)
+#define MOD_REVECHO             (198)
+#define BRASSAGE                (199)
+#define SAUSAGE                 (200)
+#define MOD_RADICAL             (201)
+
+/******************* PVOC **********************/
+
+#define PVOC_ANAL               (202)
+#define PVOC_SYNTH              (203)
+#define PVOC_EXTRACT    (204)
+
+#define WORDCNT (205)   /* temporary test that parsing works */
+
+/******************* EDIT **********************/
+
+#define EDIT_CUT                (206)
+#define EDIT_CUTEND             (207)
+#define EDIT_ZCUT               (208)
+#define EDIT_EXCISE             (209)
+#define EDIT_EXCISEMANY (210)
+#define EDIT_INSERT             (211)
+#define EDIT_INSERTSIL  (212)
+#define EDIT_JOIN               (213)
+
+        /* HOUSEKEEP */
+#define HOUSE_COPY              (214)
+#define HOUSE_CHANS             (215)
+#define HOUSE_EXTRACT   (216)
+#define HOUSE_SPEC              (217)
+#define HOUSE_BUNDLE    (218)
+#define HOUSE_SORT              (219)
+#define HOUSE_BAKUP             (220)
+#define HOUSE_RECOVER   (221)
+#define HOUSE_DISK              (222)
+
+        /* SNDINFO */
+#define INFO_PROPS              (223)
+#define INFO_SFLEN              (224)
+#define INFO_TIMELIST   (225)
+#define INFO_LOUDLIST   (297)
+#define INFO_TIMESUM    (226)
+#define INFO_TIMEDIFF   (227)
+#define INFO_SAMPTOTIME (228)
+#define INFO_TIMETOSAMP (229)
+#define INFO_MAXSAMP    (230)
+#define INFO_LOUDCHAN   (231)
+#define INFO_FINDHOLE   (232)
+#define INFO_DIFF               (233)
+#define INFO_CDIFF              (234)
+#define INFO_PRNTSND    (235)
+#define INFO_MUSUNITS   (236)
+
+#define SYNTH_WAVE              (237)
+#define SYNTH_NOISE             (238)
+#define SYNTH_SIL               (239)
+
+#define UTILS_GETCOL    (240)
+#define UTILS_PUTCOL    (241)
+#define UTILS_JOINCOL   (242)
+#define UTILS_COLMATHS  (243)
+#define UTILS_COLMUSIC  (244)
+#define UTILS_COLRAND   (245)
+#define UTILS_COLLIST   (246)
+#define UTILS_COLGEN    (247)
+
+#define FREEZE2                 (248)
+#define HOUSE_DEL               (249)
+#define UTILS_VECTORS   (250)
+
+/******************* EDIT **********************/
+#define INSERTSIL_MANY  (251)
+#define RANDCUTS                (252)
+#define RANDCHUNKS              (253)
+/******************* MODIFY **********************/
+#define SIN_TAB                 (254)
+/******************* EXTEND (?) **********************/
+#define ACC_STREAM              (255)
+/******************* HFPERM **********************/
+#define HF_PERM1                (289)
+#define HF_PERM2                (290)
+#define DEL_PERM                (291)
+#define DEL_PERM2               (292)
+/******************* SYNTH **********************/
+#define SYNTH_SPEC              (293)
+/******************* DISTORT **********************/
+#define DISTORT_OVERLOAD (294)
+/******************* EDIT **********************/
+#define TWIXT                   (295)
+#define SPHINX                  (296)
+
+/* TW NEW */
+/******************* 2002-3 **********************/
+#define P_SYNTH         (298)
+#define P_INSERT        (299)
+#define P_PTOSIL        (300)
+#define P_NTOSIL        (301)
+#define P_SINSERT       (302)
+#define ANALENV         (303)
+#define MAKE2           (304)
+#define P_VOWELS        (305)
+#define HOUSE_DUMP              (306)
+#define HOUSE_GATE              (307)
+#define MIX_ON_GRID             (308)
+#define P_GEN           (309)
+#define P_INTERP        (310)
+#define AUTOMIX                 (311)
+#define EDIT_CUTMANY    (312)
+#define STACK                   (313)
+#define VFILT                   (314)
+#define ENV_PROPOR              (315)
+#define SCALED_PAN              (316)
+#define MIXMANY                 (317)
+#define DISTORT_PULSED  (318)    /* pulse-train */
+#define NOISE_SUPRESS   (319)
+#define TIME_GRID               (320)
+#define SEQUENCER               (321)
+#define CONVOLVE                (322)
+#define BAKTOBAK                (323)
+#define ADDTOMIX                (324)
+#define EDIT_INSERT2    (325)
+#define MIX_PAN                 (326)
+#define SHUDDER                 (327)
+#define MIX_AT_STEP             (328)
+#define FIND_PANPOS             (329)
+#define CLICK                   (330)
+#define DOUBLETS                (331)
+#define SYLLABS                 (332)
+#define JOIN_SEQ                (333)
+#define MAKE_VFILT              (334)
+#define BATCH_EXPAND    (335)
+#define MIX_MODEL               (336)
+#define CYCINBETWEEN    (337)
+#define JOIN_SEQDYN             (338)
+#define ITERATE_EXTEND  (339)
+#define DISTORT_RPTFL   (340)
+#define TOPNTAIL_CLICKS (341)
+#define P_BINTOBRK              (342)
+#define ENVSYN                  (343)
+#define SEQUENCER2              (344)
+#define RRRR_EXTEND             (345)
+#define HOUSE_GATE2             (346)
+#define GRAIN_ASSESS    (347)
+#define FLTBANKV2               (348)
+#define DISTORT_RPT2    (349)
+#define ZCROSS_RATIO    (350)
+#define SSSS_EXTEND             (351)
+#define GREV                    (352)
+#define MAX_TEMP_PROCESS_NO     (257)
+
+#define MAX_PROCESS_NO  (352)

+ 42 - 0
dev/include/pvoc.h

@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE      (1)
+
+/* Functions in TTPVOC.C */
+
+#define DEFAULT_PVOC_CHANS      (1024)
+#define DEFAULT_WIN_OVERLAP     (3)
+#define VERY_BIG_INT            (100000000)
+#define MAX_PVOC_CHANS          (16380)
+#define PVOC_CONSTANT_A         (8.0)
+#define SAMP_TIME_STEP          (2000)
+
+/* Functions in MXFFT.C */
+
+int fft_(float *, float *,int,int,int,int);
+int fftmx(float *,float *,int,int,int,int,int,int *,float *,float *,float *,float *,int *,int[]);
+int reals_(float *,float *,int,int);

+ 35 - 0
dev/include/repitch.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  spectrnsf(dataptr dz);
+int  spectrnsp(dataptr dz);
+int  outer_pitch_loop(dataptr dz);
+int  outer_pichpich_loop(dataptr dz);
+int      get_anal_envelope(dataptr dz);
+int  generate_pitch(dataptr dz);
+int      convert_pitch_from_binary_to_text(dataptr dz); /*TW March 2004 */

+ 269 - 0
dev/include/science.h

@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* CONSTANTS FOR SCIENCE PROGS */
+
+/* PROCESS NUMBERS */
+
+#ifndef SPEKTRUM
+#define SPEKTRUM        384
+#endif
+#ifndef SPEKVARY
+#define SPEKVARY        385
+#endif
+#ifndef SPEKFRMT
+#define SPEKFRMT        386
+#endif
+#ifndef TS_OSCIL
+#define TS_OSCIL        387
+#endif
+#ifndef TS_TRACE
+#define TS_TRACE        388
+#endif
+#ifndef SPECAV
+#define SPECAV          389
+#endif
+#ifndef SPECANAL
+#define SPECANAL        390
+#endif
+/* PARAMETERS */
+
+/* MAX_PROCESS_NO should be defiend as the maximum process OVERALL */
+#ifdef MAX_PROCESS_NO
+#undef MAX_PROCESS_NO
+#define MAX_PROCESS_NO PARTITION
+#else
+#define MAX_PROCESS_NO PARTITION
+#endif
+
+
+#define SPEKPOINTS      0
+#define SPEKSRATE       1
+#define SPEKDUR         2
+#define SPEKHARMS       3
+#define SPEKBRITE       4
+#define SPEKRANDF       5
+#define SPEKRANDA       6
+#define SPEKSPRED       7
+#define SPEKGAIN        8
+#define SPEKTYPE        9
+#define SPEKWIDTH       10
+#define SPEKMXASP       11
+#define SPEKZOOM        12
+
+#define SPEKDATLO       (5)
+#define SPEKDATHI       (6)
+#define SPEKSPKLO       (7)
+#define SPEKSPKHI       (8)
+#define SPEKMAX         (9)
+#define SPEKWARP        (10)
+#define SPEKAWARP       (11)
+
+/* PARAMETERS */
+
+#define TS_TSTRETCH      0
+#define TS_OMAXDUR       1
+#define TS_FRQ           1
+#define TS_HALFRANGE 2
+#define TS_TMAXDUR       3
+
+/* ARRAYS */
+
+#define TS_DATA          0
+#define TS_HARMONICS 1
+#define TS_SINETAB   2
+
+/* CONSTANTS */
+
+#define TS_SINTABSIZE 4096
+#define TS_MAXLEVEL     0.9
+#define TS_MAXTSTRETCH 10000
+#define TS_MAXOCT 16
+#define TS_MAXRANGE             48      /*      Max halfrange of pitch variation of time-series from mean freq: in semitones */
+#define TS_DFLTRANGE    12      /*      Default halfrange of ditto */
+#define TS_MINFRQ       16.0
+
+#define SPEKSR          44100
+#define SPEKFADE        12              /* Number of windows over which spectrum fades in and out */
+
+
+/*      INPUT FILE LOGIC */
+
+#define NUMLIST_ONLY    (34)
+
+/* SPECIAL DATA */
+
+#define TS_HARM         94
+
+/* SPECANAL */
+
+#define PA_DEFAULT_PVOC_CHANS   (1024)
+#define PA_VERY_BIG_INT                 (100000000)
+#define PA_MAX_PVOC_CHANS               (16380)
+#define PA_PVOC_CONSTANT_A              (8.0)
+
+#define FILTR_DUR       (0)
+#define FILTR_CNT       (1)
+#define FILTR_MMIN      (2)
+#define FILTR_MMAX      (3)
+#define FILTR_DIS       (4)
+#define FILTR_RND       (5)
+#define FILTR_AMIN      (6)
+#define FILTR_ARND      (7)
+#define FILTR_ADIS      (8)
+#define FILTR_STEP      (9)
+#define FILTR_SRND      (10)
+#define FILTR_SEED      (11)
+
+/* ITERFOF */
+
+#define ITF_DEL  0
+#define ITF_DUR  1
+#define ITF_PRND 2
+#define ITF_AMPC 3
+#define ITF_TRIM 4
+#define ITF_TRBY 5
+#define ITF_SLOP 6
+#define ITF_RAND 7
+#define ITF_VMIN 8
+#define ITF_VMAX 9
+#define ITF_DMIN 10
+#define ITF_DMAX 11
+#define ITF_SEED1 12
+#define ITF_GMIN 12
+#define ITF_GMAX 13
+#define ITF_UFAD 14
+#define ITF_FADE 15
+#define ITF_GAPP 16
+#define ITF_PORT 17
+#define ITF_PINT 18
+#define ITF_SEED2 19
+
+/* PULSER */
+
+#define PLS_DUR          0
+#define PLS_PITCH        1
+#define PLS_TRANSP       1
+#define PLS_MINRISE      2
+#define PLS_MAXRISE      3
+#define PLS_MINSUS       4
+#define PLS_MAXSUS   5
+#define PLS_MINDECAY 6
+#define PLS_MAXDECAY 7
+#define PLS_SPEED        8
+#define PLS_SCAT         9
+#define PLS_EXP          10
+#define PLS_EXP2         11
+#define PLS_PSCAT        12
+#define PLS_ASCAT        13
+#define PLS_OCT          14
+#define PLS_BEND         15
+#define PLS_SEED         16
+#define PLS_SRATE        17
+#define PLS_CNT          18
+
+/* CHIRIKOV */
+
+#define CHIR_DUR        0
+#define CHIR_FRQ        1
+#define CHIR_DAMP       2
+#define CHIR_SRATE      3
+#define CHIR_SPLEN      4
+#define CHIR_PMIN       3
+#define CHIR_PMAX       4
+#define CHIR_STEP       5
+#define CHIR_RAND       6
+
+/* MULTIOSC */
+
+#define MOSC_DUR        0
+#define MOSC_FRQ1       1
+#define MOSC_FRQ2       2
+#define MOSC_AMP2       3
+#define MOSC_FRQ3       4
+#define MOSC_AMP3       5
+#define MOSC_FRQ4       6
+#define MOSC_AMP4       7
+#define MOSC_SRATE      8
+#define MOSC_SPLEN      9
+
+/* SYNFILT */
+
+#define SYNFLT_SRATE    0
+#define SYNFLT_CHANS    1
+#define SYNFLT_Q                2
+#define SYNFLT_HARMCNT  3
+#define SYNFLT_ROLLOFF  4
+#define SYNFLT_SEED             5
+
+/* STRANDS */
+#define STRAND_DUR              0       //      OUTPUT DURATION
+#define STRAND_BANDS    1       //      NUMBER OF BANDS
+#define STRAND_THRDS    2       //      NUMBER OF THREADS PER BAND
+#define STRAND_TSTEP    3       //      TIME-STEP BETWEEN OUTPUT DATA POINTS
+#define STRAND_BOT              4       //      LOWEST PITCH OF ALL BANDS
+#define STRAND_TOP              5       //      HIGHEST PITCH OF ALL BANDS
+#define STRAND_TWIST    6       //      SPEED OF OSCILLATION OF THREAD-PITCHES
+#define STRAND_RAND             7       //      RANDOMISATION SPEED BETWEEN BANDS
+#define STRAND_SCAT             8       //      SCATTER OF SPEED AMONGST THREADS
+#define STRAND_VAMP             9       //      WAVY VORTEX SIZE
+#define STRAND_VMIN             10      //      WAVY VORTEX MINIMUM SPEED
+#define STRAND_VMAX             11      //      WAVY VORTEX MAXIMUM SPEED
+#define STRAND_TURB             12      //      TURBULENCE SETTING
+#define STRAND_SEED             13      //      SEED FOR RANDOM PROCESSES
+#define STRAND_GAP              14      //      MINIMUM PITCH INTERVAL BETWEEN BANDS
+#define STRAND_MINB             15      //      MINIMUM PITCH-WIDTH OF BANDS
+#define STRAND_3D               16      //      DEPTH-MOTION TYPE
+
+/* REFOCUS */
+#define REFOC_DUR               0
+#define REFOC_BANDS             1
+#define REFOC_RATIO             2
+#define REFOC_TSTEP             3
+#define REFOC_RAND              4
+#define REFOC_OFFSET    5
+#define REFOC_END               6
+#define REFOC_XCPT              7
+#define REFOC_SEED              8
+
+/* UNKNOT */
+#define KNOT_PATREP             0
+#define KNOT_COMBOREP   1
+#define KNOT_ALLREP             2
+#define KNOT_UNKNOTREP  3
+#define KNOT_GOALREP    4
+#define KNOT_SPACETYP   5
+#define KNOT_CHANA              6
+#define KNOT_CHANB              7
+#define KNOT_MIN                8
+#define KNOT_CLIP               9
+
+/* RHYMORPH : RHYMORPH2 */
+#define RHYM_PATREP             0
+#define RHYM_MORPHREP   1
+#define RHYM_GOALREP    2
+#define RHYM_STEPS              3
+#define RHYM_RESPACE    4

+ 126 - 0
dev/include/sfdump.h

@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define SFD_BLEEP       (0)
+#define SFD_HEADERS     (1)
+#define SFD_SOUND       (2)
+#define SFD_SHORT       (3)
+
+#define DUMPFILE_CHANNELS   (2)
+#define DUMPFILE_SRATE      (48000)
+
+#define SFD_CYCLECNT       (512)        /* number of square wave cycles in bleep */
+#define SFD_HALFCYCLE           (50)    /* square-wave is 50 * 2 samples long    */
+                                                                        /* at 44100,stereo = 882 Hz for .58 secs */
+#define SFD_SQUAREAMP        (8000)     /* amplitude of square-wave bleep        */
+#define SFD_HEADSIZE  (SECSIZE * 2)     /* bytesize of sndfile header in dumpfile*/
+#define SFD_HALFHEADSIZE  (SECSIZE)     /* half size of sndfile header, in bytes */
+#define SFD_HEADCOPIES        (100)     /* number of bakup copies of header      */
+#define SFD_DUMPDATSIZE ((SFD_CYCLECNT*SFD_HALFCYCLE*2*sizeof(short))+(SFD_HEADSIZE*SFD_HEADCOPIES))
+#define TW_MAGIC    (271828182)         /* e */
+
+#define FIRST_HALF_SF_MAGIC             (30244)
+#define SECOND_HALF_SF_MAGIC    (5522)
+#define FIRST_HALF_TW_MAGIC             (-15146)
+#define SECOND_HALF_TW_MAGIC    (4147)
+
+#define SFD_HEADSEARCHSIZE  ((HEADSIZE*HEADCOPIES)+SECSIZE)
+
+#define SFD_COPY_HEADER_WRITTEN (0)
+#define SFD_HEADER_SIZE_DEFINED (0)
+
+#define SFD_NAMESIZE            (64)
+
+#define BUFFER_START    (0)
+#define BUFFER_END              (1)
+#define SFD_INBUF               (2)
+
+#define SFD_DATAPTR             (0)
+#define SFD_DATAEND             (1)
+#define SFD_OUTBUF              (2)
+#define SFD_OUTBUFEND   (3)
+
+extern  char    *headend, *hdataend;
+extern int      sfd_outfilesize;
+extern int              magicsize;
+extern int              crcsize;
+extern int              sizesize;
+extern char             sfd_outfilename[];
+extern int              short_secsize;
+
+/* SFREC1.C     MAIN    */
+
+int  read_bytes_aa(char *bbuf,int bytes_to_read,dataptr dz);
+int  write_bytes_recover
+        (char *bbuf,int bytes_to_write,int total_bytes_left,int *bytes_written,dataptr dz);
+void um(char *,char *,int,int,dataptr dz);
+
+/* SFREC2.C     WRITE SOUND     */
+
+int relocate_search_position(int *bufpos,int *buffer_full,short *snd_data_end,dataptr dz);
+int align_sound_to_buffer(int *buffer_full,int *bufpos,int cnt,int *total_bytes_left,dataptr dz);
+int fill_rest_of_buf(int refill_sects,int *buffer_full,dataptr dz);
+int adjust_alignment(int bufpos,int buffer_full,short **bptr,dataptr dz);
+
+/* SFREC3.C     WRITE SOUND     */
+
+int write_snd_rec(int sfd_outfilesize,int *buffer_full,int *total_bytes_left,short **snd_data_end,dataptr dz);
+
+/* SFREC4.C     LOCATE HEADER   */
+
+int locate_header(int *bufpos,headptr *head_variant,int *buffer_full,int *total_bytes_left,dataptr dz);
+int get_true_header(headptr *head_variant,char *headstore,int *sfd_outfilesize,char *sfd_outfilename,dataptr dz);
+
+/* SFREC5.C     VERIFY HEADER   */
+
+int recover_header(char *headstore,int *sfd_outfilesize,char *sfd_outfilename,dataptr dz);
+
+/************************************************************************
+ ************************ BUFFER MANIPULATION ***************************
+ ************************************************************************
+ *
+ *                      STAGGERED BUFFERING
+ *                      -------------------
+ *
+ *       ____________extended_buffer_size_______________
+ *      |                                               |
+ *      |                                               |
+ *      |       ..............buffer_size...............|
+ *      |       :                                       :
+ *      |       :             INPUT BUFFER              :
+ *      |_______|_______|_______|_______|_______|_______|
+ *              |       |       |       |               |                       O  = outbuf
+ *         O    I                                                               OE                      I  = inbuf
+ *         |              OUTPUT BUFFER                            |            OE = outbufend
+ *         |                                       |
+ *         |_______|_______buffer_size_____|_______|remnant
+ *         :    :                                                                  :    :
+ *         :....:                                                                  :....:
+ *            ^                                                                  |
+ *            |                                                                  V
+ *            |___move remnant to start of outbuf____|
+ *
+ */

+ 33 - 0
dev/include/simple.h

@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specgain(dataptr dz);
+int  speclimit(dataptr dz);
+int  specclean(dataptr dz);
+int  speccut(dataptr dz);
+int  specgrab_or_magnify(int frztime_paramno,dataptr dz);

+ 36 - 0
dev/include/sndinfo.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE      (1)
+
+#define MAX_TIMESUM_SPLEN               (2000.0)        /* ms */
+#define TIMESUM_DEFAULT_SPLEN   (15.0)          /* ms */
+#define MAX_SFDIFF_CNT                  (1000)
+#define MU_MAXGAIN                              (128.0)
+#define MAX_OCTSHIFT                    (8.0)
+
+int     do_sndinfo(dataptr dz);
+int     do_musunits(dataptr dz);

+ 251 - 0
dev/include/speccon.h

@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************* SPEC ***************/
+
+#define SPEC_MINFRQ                             (10.0)
+#define PITCHZERO                               (SPEC_MINFRQ/2.0)
+
+#define SIGNOIS_MAX                             (1000.0)
+
+/* Constant vals for SPEC ARPE */
+
+#define DOWNRAMP                (1)
+#define SIN                     (2)
+#define SAW                             (3)
+#define UPRAMP                  (4)
+#define ARPE_TABSIZE    (1024)
+
+#define AP_NORMAL                                                                               (0)
+#define AP_SUSTAIN_PITCH                                                                (1)
+#define AP_LIMIT_SUSTAIN                                                                (2)
+#define AP_SUSTAIN_PITCH_AND_LIMIT_SUSTAIN                              (3)
+#define AP_NONLIN                                                                               (4)
+#define AP_NONLIN_AND_SUSTAIN_PITCH                                             (5)
+#define AP_NONLIN_AND_LIMIT_SUSTAIN                                             (6)
+#define AP_NONLIN_AND_SUSTAIN_PITCH_AND_LIMIT_SUSTAIN   (7)
+
+/* constants for SPEC CHORD */
+
+#define CHD_NORMAL      (0)
+/* change JAN 1998 ****
+#define CHD_FULLER      (1)
+*/
+/* change JAN 1998 ****/
+#define CHD_LESSFUL     (1)
+
+/* Constant vals for SPEC CHORUS */
+
+#define A_FIX        (1)        /* 0001 */
+#define A_VAR        (2)        /* 0010 */
+#define F_FIX        (4)        /* 0100 */
+#define F_VAR        (8)        /* 1000 */
+#define AF_FIX       (5)        /* 0101 */
+#define AF_VAR      (10)        /* 1010 */
+#define A_FIX_F_VAR  (9)        /* 1001 */
+#define A_VAR_F_FIX  (6)        /* 0110 */
+#define IS_A         (3)        /* 0011 */
+#define IS_F        (12)        /* 1100 */
+
+#define BOTH_ACCESSES_OF_RANDTABLE_REACH_END_TOGETHER (0)
+#define FIRST_ACCESS_OF_RANDTABLE_REACHES_END_FIRST   (1)
+#define SECOND_ACCESS_OF_RANDTABLE_REACHES_END_FIRST  (2)
+
+/* constants for SPEC CROSS */
+
+#define CROS_FULL   (0)
+#define CROS_INTERP     (1)
+
+/* constant values for SPEC FMNTSEE */
+
+#define SPACER          (4)             /* gap left between formants in pseudosnd-display */
+
+/* constant values for FOCUS and REPORT */
+
+#define MAXPKCNT                (16)            /* max number of peaks for FOCU */
+#define MAXSTABIL               (4097)          /* max value of stabl in FOCU */
+
+/* constants for SPEC FREEZE */
+
+#define FRZ_BEFORE      (-1)
+#define FRZ_LIMIT       (0)
+#define FRZ_AFTER       (1)
+
+/* constants for SPEC GLIS */
+
+#define GLIS_SHIFT_DEFAULT (50.0)
+#define GLIS_REFERENCE_FRQ (dz->chwidth * 2.0)
+
+/* Constant vals for SPEC MORPH */
+
+#define MPH_COSTABSIZE (512)
+
+/* constant values for SPEC P_APPROX */
+
+#define BLOKCNT         (4)
+
+/* constant values for P_FIX */
+
+#define IS_HIPASS   (1)
+#define IS_LOPASS   (2)
+#define IS_BANDPASS (3)
+
+/* constant values for P_INVERT and SPEC P_RANDOMISE */
+
+#define MAXINTRANGE     (96.0)
+
+/* constant values for SPEC P_VIBRATO */
+
+#define P_TABSIZE       (256)
+
+/* Constant values for SPEC PITCH and SPEC TRACK */
+
+#define EIGHTH_TONE      (1.014545335)  /* tuning tolerance for data-reduction in pitch brkpnt files */
+#define SILENCE_RATIO                   (80.0)  /* 80dB signal-to-noise ratio */
+#define BLIPLEN                         (2)     /* Max no adj pitched windows needed to confirm a pitch */
+#define MAXIMI                                  (8)             /* Number of loudest-spectral-peaks-per-window to test */
+#define ACCEPTABLE_MATCH                (5)             /* Number of MAXIMI which must be harmonics */
+#define PARTIALS_IN_TEST_TONE   (6)
+#define PARTIAL_DECIMATION              (.25)
+#define CHANSCAN                                (8)             /* Number of adjacent chans to search for a frq that */
+                                                                                /* should be in current channel */
+#define PEAKSCAN                                (2)
+#define MAXHARM                                 (8)     /* Max harmonic than can be lowest (signif) partial */
+                                                                        /* in a pitched sound */
+
+/* constant values for SPEC REPITCH */
+
+#define DEFAULT_FRAMETIME  (0.002F)             /* default for REPITCH with no binary files in */
+
+/* Constant vals for SPEC SPLIT */
+
+#define ASCTOINT                         (-48)
+#define DO_AMPLITUDE_CHANGE        (3)  /* 0011 */
+#define DO_RAMPED_AMPLITUDE    (2)      /* 0010 */
+#define DO_TRANSPOSITION           (4)  /* 0100 */
+#define DO_ADD_TO_SPECTRUM         (8)  /* 1000 */
+
+/* constant values for SPEC WARP */
+
+#define WARP_MININT     (1.0)   /* min interval for pitch to be marked as moving: semitones */
+#define CHANSPAN        (4)             /* frq can lie +- 4 channels outside the expected channel for that frq */
+#define BLOKCNT         (4)
+#define WCHTOP          (4)
+#define WCHBOT          (5)
+
+/* constants usd in get_statechanges() */
+
+#define IS_FRQ          (0)
+#define IS_PITCH        (1)
+
+
+
+#define DEFAULT_NYQUIST (10000) /* Fudge to allow brkpnt pitchdata to be tested */
+
+#define DEFAULT_OCTBANDS                (10)    /* octvu */
+
+/************** CONSTANTS FOR DEFINING RANGES *****************/
+
+#define CHORU_MAXAMP                    (1028.0)
+#define CHORU_MINAMP                    (1.0)
+#define CHORU_MAXFRQ                    (4.0)
+#define CHORU_MINFRQ                    (1.0)
+#define OCT_MAX_HMOVE                   (4096.0)                        /* frq ratio for 12 octs  OCT   */
+#define MINFWINDOW                              (0.2)                           /* minimum frq window for PEAK (semitones) */
+#define MINTSTR                                 (0.0001)                        /* min timestretch val for TSTRETCH */
+#define MAXTSTR                                 (10000.0)                       /* max timestretch val for TSTRETCH */
+#define MAXPRANGE                               (96.0)                          /* max pitch-variation in WARP */
+#define MAXSMOOTH                               (100.0)                         /* max number of smoothings in P_FIX : arbitrary!! */
+#define MAXGLISRATE                             (0.0625)                        /* approx 1/16th octave per window */
+
+#define DEFAULT_STABILITY               (9)                                     /* default value of stabl in FOCU */
+#define DEFAULT_TWINDOW         (.1)
+#define DEFAULT_FWINDOW         (6.0)
+#define DEFAULT_SRANGE                  (0.1 * SECS_TO_MS)      /* time (secs) to scan pitch-contour. Rise by semitone  */
+                                                                                                        /* over SRANGE  indicates rising pitch-contour                  */
+#define DEFAULT_PRANGE                  (0.38)                          /* >third_tone: pitch mistuning allowed in approx_pitch */
+#define DEFAULT_TRANGE                  (0.05 * SECS_TO_MS)
+#define DEFAULT_NOISEGAIN               (2.0)
+#define DEFAULT_ARPE_SUSTAIN    (3.0)
+#define DEFAULT_ARPE_AMPLIF             (10.0)
+#define DEFAULT_AVRG                    (13.0)
+#define DEFAULT_CHORU_AMPSPREAD (2.0)
+#define DEFAULT_CHORU_FRQSPREAD (1.1)
+#define DEFAULT_MAX_DRUNK_STEP  (32.0)
+#define DEFAULT_EXAG                    (2.0)
+#define DEFAULT_FILT_FRQ                (CONCERT_A)
+#define DEFAULT_Q                               (20.0)
+#define DEFAULT_OCTAVE_BWIDTH   (0.333333)                      /* Third Octave Band */
+#define DEFAULT_GLISRATE                (1.0)
+#define DEFAULT_DURATION                (2.0)
+#define DEFAULT_GRABTIME                (duration/2.0)
+#define DEFAULT_WINDOW_STEP             (16.0)
+#define DEFAULT_TIME_STEP               (DEFAULT_WINDOW_STEP * frametime * SECS_TO_MS)
+#define DEFAULT_STEP                    (0.25)
+#define DEFAULT_SLEW                    (1.0001)
+#define DEFAULT_VIBRATO_FRQ             (8.0)
+#define DEFAULT_VIBRATO_RANGE   (0.333333)
+#define DEFAULT_TRACE                   (16.0)
+#define DEFAULT_BLUR                    (16.0)
+#define DEFAULT_OCT_TRANSPOS    (2.0)
+
+#define CONCERT_A                               (440.0)
+#define CONCERT_A_MIDI                  (69.0)
+
+/******* SPEC TRNSF : TRNSP ******/
+
+#define MIN_TRANSPOS                    (0.00383)       /* 8 octaves dn */
+#define MAX_TRANSPOS                    (256.0)         /* 8 octaves up */
+#define DEFAULT_TRANSPOS                (1.0)
+
+#define ARPE_MAX_AMPL   (10000.0)
+#define ARPE_MIN_NONLIN (0.02)
+#define ARPE_MAX_NONLIN (50.0)
+#define CL_MAX_GAIN             (40.0)
+#define PH_MAX_GAIN             (40.0)
+#define FILT_MAX_PG             (10000.0)
+#define GAIN_MAX_GAIN   (10000.0)
+#define FORM_MAX_GAIN   (40.0)
+#define MPH_MIN_EXP             (0.02)
+#define MPH_MAX_EXP             (50.0)
+#define OCT_MAX_BREI    (50.0)
+#define PEX_MAX_RANG    (128.0)
+#define PR_MIN_SLEW             (0.02)
+#define PR_MAX_SLEW             (50.0)
+#define PSEE_MAX_SCF    (10000.0)
+#define PW_MIN_DRED             (.00002)
+#define PW_MAX_DRED             (12.0)
+#define PLUK_MAX_GAIN   (1000.0)
+#define STR_MIN_EXP             (0.02)
+#define STR_MAX_EXP             (50.0)
+#define VOCO_MAX_GAIN   (10.0)
+#define WAVER_MIN_EXP   (0.02)
+#define WAVER_MAX_EXP   (50.0)
+#define ACCU_MIN_DECAY  (0.001)
+
+#define SPEC_MAXOCTS    (8.0)
+
+int is_harmonic(int *iratio,double frq1, double frq2);

+ 154 - 0
dev/include/special.h

@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************* SPECIAL DATA TYPES : GROUCHO  ***************************************/
+
+/* DISTORT */
+#define NO_SPECIAL_TYPE                 (0)
+#define DISTORT_ENVELOPE                (1)             /* FILE */
+#define HARMONIC_DISTORT                (2)             /* FILE */
+#define SHUFFLE_DATA                    (3)             /* STRING */
+/* EXTEND */
+#define ZIGDATA                                 (4)              /* FILE */
+/* TEXTURE */
+#define TEX_NOTEDATA                    (6)      /* FILE */
+/* GRAIN */
+#define GRAIN_REORDER_STRING    (7)              /* STRING */
+#define GRAIN_PITCH_RATIOS              (8)              /* FILE */
+#define GRAIN_TIME_RATIOS               (9)              /* FILE */
+#define GRAIN_TWO_RATIOS                (10)     /* FILE */
+#define GRAIN_TIMINGS                   (11)     /* FILE */
+/* ENVEL */
+#define ENV_CREATEFILE                  (12)     /* FILE */
+#define ENV_TRIGGER_RAMP                (13)     /* FILE */
+/* MIX */
+#define SNDFILENAME                             (14)     /* STRING */
+/* FILTERS */
+#define FILTERBANK                              (15)     /* FILE */
+#define TIMEVARYING_FILTERBANK  (16)     /* FILE */
+/* EXTEND */
+#define ATTACK_STREAM                   (41)     /* FILE */
+/* HOUSEKEEP */
+#define BY_HAND                                 (42)     /* FILE */
+/* HF_PERM */
+#define DELPERM                                 (43)     /* FILE */
+#define DELPERM2                                (44)     /* FILE */
+/* SFEDIT */
+#define SWITCH_TIMES                    (45)     /* FILE */
+#define MANY_SWITCH_TIMES               (46)     /* FILE */
+/* REPITCH */
+#define PITCH_SPECTRUM                  (47)     /* FILE */
+#define ZERO_INSERTTIMES                (48)     /* FILE */
+#define PITCH_VOWELS                    (49)     /* FILE or STRING */
+/* SUBMIX */
+#define GRIDDED_MIX                             (50)     /* FILE */
+/* REPITCH */
+#define PITCH_CREATE                    (51)     /* FILE */
+/* SUBMIX */
+#define AUTO_MIX                                (52)     /* FILE */
+/* SFEDTSUBMIX */
+#define MANYCUTS                                (53)     /* FILE */
+/* STACK */
+#define STACKDATA                               (54)     /* FILE or VAL */
+/* DISTORT PULSE */
+#define PULSE_ENVELOPE                  (55)     /* FILE */
+/* SEQUENCER */
+#define SEQUENCER_VALUES                (56)     /* FILE */
+/* CLICK */
+#define CLICKTRACK                              (57)     /* FILE */
+/* SYLLABS */
+#define SYLLTIMES                               (58)     /* FILE */
+/* JOIN_SEQ */
+#define JOINSEQ                                 (59)     /* FILE */
+/* BATCH_EXPAND */
+#define BATCH                                   (60)     /* FILE */
+/* BATCH_EXPAND */
+#define INBTWN_RATIOS                   (61)     /* FILE */
+/* PROPORTIONAL LOUDNESS */
+#define LOUDNESS                                (62)     /* FILE */
+/* JOIN_SEQDYN */
+#define JOINSEQDYN                              (63)     /* FILE */
+/* ENVSYN */
+#define ENVSYN_ENVELOPE                 (64)     /* FILE */
+/* SEQUENCER2 */
+#define SEQUENCER2_VALUES               (65)     /* FILE */
+/* MULTI_SYN */
+#define CHORD_SYN                               (66)     /* FILE */
+/* FLTBANKV2 */
+#define TIMEVARY2_FILTERBANK    (67)     /* FILE */
+
+/******************* SPECIAL DATA TYPES : SPEC ***************************************/
+
+
+#define TRANSPOS_RATIO_OR_CONSTANT      (17) /* FILE OR VAL */
+#define TRANSPOS_OCTAVE_OR_CONSTANT     (18) /* FILE OR VAL */
+#define TRANSPOS_SEMIT_OR_CONSTANT      (19) /* FILE OR VAL */
+#define SPECSPLI_DATA                           (20) /* FILE */
+                                                                                                                        /*      Data for the spec split prog specifying filter
+                                                                                                                        bands and what happens to them
+                                                                                                                        Original data format crazy, better as grafix-in */
+#define FRQ_OR_FRQSET                           (21) /* FILE OR VAL */
+                                                                                                                        /* frqs for Spec tune in mode that takes frq data */
+#define PITCH_OR_PITCHSET                       (22) /* FILE OR VAL */  /* midipitches for Spec tune in mode that takes midi */
+#define FILTER_FRQS                                     (23) /* FILE */                 /* Filter frqs for spec greq in single bandwidth mode */
+#define FILTER_BWS_AND_FRQS                     (24) /* FILE */                 /* Filter frqs and bws for spec greq in variable bwidth mode */
+#define SEMIT_TRANSPOS_SET                      (25) /* FILE */                 /* semitone transposition vals for spec chord */
+#define FREEZE_DATA                                     (26) /* FILE */                 /* Freeze points (with flags) for spec freeze - better grafik */
+#define SPEC_SHUFFLE_DATA                       (27) /* STRING */               /* Strings demo-ing shuffling for spec shuffle */
+#define WEAVE_DATA                                      (28) /* FILE */                 /* Number seq defining weave for spec weave - better grafix */
+#define INTERVAL_MAPPING                        (29) /* FILE OR VAL */  /* Map interval-->interval for spec pinvert */
+#define PITCHQUANTISE_SET                       (30) /* FILE */                 /* Midi pitchvals for quantising pitch on, for spec pquantise */
+#define OUT_PFILE                                       (31) /* STRING */               /* Causes process to OPEN 2nd outfile - pitchdata file */
+#define OUT_PBRKFILE                            (32) /* STRING */               /* Causes process to OPEN 2nd outfile - pitch brkpnt(text)file */
+
+
+/* especially for handling infile in SPEC REPITCH */
+
+#define PITCH_BINARY_OR_BRKPNT1         (33)
+#define PITCH_BINARY_OR_BRKPNT2         (34)
+#define TRANSPOS_BINARY_OR_BRKPNT1      (35)
+#define TRANSPOS_BINARY_OR_BRKPNT2      (36)
+
+/* EDIT */
+#define EXCISE_TIMES                            (37)     /* FILE */
+/* INFO */
+#define NOTE_REPRESENTATION                     (38)     /* STRING */
+#define INTERVAL_REPRESENTATION         (39)     /* STRING */
+
+#define FREEZE2_DATA                            (40) /* FILE */         /* Hold points & durs for spec freeze2 */
+
+/********** SPECIAL DATA VALS ************/
+
+#define MIN_HARMONIC    (2.0)
+#define MAX_HARMONIC    (1024.0)
+#define MIN_HARM_AMP    (1.0/(double)MAXSHORT)
+#define MAX_HARM_AMP    (32.0)
+
+/*RWD 6:2001 purged decls of local statics */
+
+int  read_shuffle_data(int dmnparam,int imgparam,int mapparam,char *str,dataptr dz);
+int  read_new_filename(char *str,dataptr dz);
+int  read_env_ramp_brk(char *str,dataptr dz);

+ 34 - 0
dev/include/specinfo.h

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specwcnt(dataptr dz);
+int  specchan(dataptr dz);
+int  specfrq(dataptr dz);
+int  speclevel(dataptr dz);
+int  specoctvu(dataptr dz);
+int  outer_textout_only_loop(dataptr dz);

+ 32 - 0
dev/include/specpinfo.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specpinfo(dataptr dz);
+int  specpsee(dataptr dz);
+int  specphear(dataptr dz);
+int  specpwrite(dataptr dz);

+ 63 - 0
dev/include/srates.h

@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*rates.h: portable set of defines for sample rates on PC/SGI/FALCON */
+
+#ifdef ATARI
+
+#define IS_HISR(x) ((x)==49170 || (x)==48000 || (x)==44100 || \
+        (x)==32780 || (x)==32000)
+
+#define IS_LOSR(x) ((x)==24585 || (x)==24000 || (x)==22050 || (x)==19668 \
+        || (x)==16390 || (x)==16000 || (x)==12292 || (x)==9834 || (x)==8195)
+
+#define IS_FALSR(x) ((x)==49170 || (x)==32780 || (x)==24585 || (x)==19668 \
+        || (x)== 16390 || (x)== 12292 || (x)== 9834 || (x)==8195)
+
+#define IS_HIFR(x) ((x)==49170 || (x)==32780)
+#define IS_LOFR(x) ((x)==24585 || (x)==19668 || (x)==16390 || \
+        (x)==12292 || (x)==9834 || (x)==8195)
+
+#define BAD_SR(x) (x!=49170 && x!=44100 && x!=32780 && x!=32000 \
+        && x!=24585 && x!= 24000 && x!= 22050 && x!=19668  && x!=16390  \
+        && x!=16000 && x!= 12292 && x!= 9834 && x!= 8195)
+
+#define SR_DEFAULT (24585)
+#define D_SR_DEFAULT (24585.0)
+
+static const char *FalconRates =
+        "49170, 32780, 24585, 19668, 16390, 12292, 9834 or 8195";
+
+#else
+/*RWD April 2005 added new high srates */
+#define IS_HISR(x) ((x)== 96000 || (x) == 88200 || (x)==48000 || (x)==44100 || (x)==32000)
+#define IS_LOSR(x) ((x)==24000 || (x)==22050 || (x)== 16000)
+#define SR_DEFAULT (22050)
+#define D_SR_DEFAULT (22050.0)
+#define BAD_SR(x) ((x)!=44100 && (x)!=22050 && (x)!=32000 && (x)!=16000  \
+        && (x)!=48000 && (x)!= 24000 && (x)!=88200 && (x)!=96000)
+
+#endif

+ 1137 - 0
dev/include/standalone.h

@@ -0,0 +1,1137 @@
+/*
+ * Copyright (c) 1983-2020 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+ 
+ The CDP System is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+ 
+ The CDP System is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public
+ License along with the CDP System; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA
+ *
+ */
+/* These are new programs which don't require libs to be recompiled
+   but don't act differently to standard CDP programs */
+
+#define SPECTOVF2   89
+#define MTON        90
+#define FLUTTER     91
+#define SETHARES    92
+#define MCHSHRED    93
+#define MCHZIG      94
+#define MCHSTEREO   95
+
+#define MIXMULTI    256
+#define ANALJOIN    257
+#define PTOBRK      258
+#define PSOW_STRETCH    259
+#define PSOW_DUPL       260
+#define PSOW_DEL        261
+#define PSOW_STRFILL    262
+
+#define ONEFORM_GET     263
+#define ONEFORM_PUT     264
+#define ONEFORM_COMBINE 265
+#define PSOW_FREEZE     266
+#define PSOW_CHOP       267
+#define PSOW_INTERP     268
+#define NEWGATE         269
+#define PSOW_FEATURES   270
+#define PSOW_SYNTH      271
+#define PSOW_IMPOSE     272
+#define PSOW_SPLIT      273
+#define PSOW_SPACE      274
+#define PSOW_INTERLEAVE 275
+#define PSOW_REPLACE    276
+#define PSOW_EXTEND     277
+#define PSOW_LOCATE     278
+#define PSOW_CUT        279
+#define SPEC_REMOVE     280
+#define PSOW_EXTEND2    281
+#define PREFIXSIL       282
+#define STRANS          283
+#define PSOW_REINF      284
+#define PARTIALS_HARM   285
+#define SPECROSS        286
+#define MCHITER         287
+
+/* These are new programs which behave differently to standard CDP progs */
+/* These numbers follow on consecutively from values processno.h */
+
+#define TAPDELAY    353
+#define RMRESP      354
+#define RMVERB      355
+
+/* simil: these are multichannel toolkit programs */
+
+#define ABFPAN      900
+#define ABFPAN2     901
+#define CHANNELX    902
+#define CHORDER     903
+#define CHXFORMAT   904
+#define COPYSFX     905
+#define FMDCODE     906
+#define INTERLX     907
+#define NJOIN       908
+#define NMIX        909
+#define RMSINFO     910
+#define SFEXPROPS   911
+#define CHXFORMATM  912
+#define CHXFORMATG  913
+#define NJOINCH     914
+#define ABFPAN2P    915
+
+/* These are new programs which behave exactly as standard CDP progs */
+/* These numbers follow on consecutively from values processno.h */
+
+#define LUCIER_GETF 356
+#define LUCIER_GET  357
+#define LUCIER_PUT  358
+#define LUCIER_DEL  359
+#define SPECLEAN    360
+#define SPECTRACT   361
+#define PHASE       362
+#define FEATURES    363
+#define BRKTOPI     364
+#define SPECSLICE   365
+#define FOFEX_EX    366
+#define FOFEX_CO    367
+#define GREV_EXTEND 368
+#define PEAKFIND    369
+#define CONSTRICT   370
+#define EXPDECAY    371 
+#define PEAKCHOP    372 
+#define MCHANPAN    373 
+#define TEX_MCHAN   374 
+#define MANYSIL     375
+#define RETIME      376
+#define SPECTOVF    377
+#define HOVER       378
+#define MULTIMIX    379
+#define FRAME       380
+#define SEARCH      381
+#define MCHANREV    382
+#define WRAPPAGE    383
+// Intervening numbers are in science.h 
+
+#define SPEKTRUM    384
+#define SPEKVARY    385
+#define SPEKFRMT    386
+#define TS_OSCIL    387
+#define TS_TRACE    388
+#define SPECAV      389
+#define SPECANAL    390
+#define SPECSPHINX  391
+#define SUPERACCU   392
+#define PARTITION   393
+#define SPECGRIDS   394
+#define GLISTEN     395
+#define TUNEVARY    396
+#define ISOLATE     397
+#define REJOIN      398
+#define PANORAMA    399
+#define TREMOLO     400
+#define ECHO        401
+#define PACKET      402
+#define SYNTHESIZER 403
+#define TAN_ONE     404
+#define TAN_TWO     405
+#define TAN_SEQ     406
+#define TAN_LIST    407
+#define SPECTWIN    408
+
+#define TRANSIT     409
+#define TRANSITF    410
+#define TRANSITD    411
+#define TRANSITFD   412
+#define TRANSITS    413
+#define TRANSITL    414
+#define CANTOR      415
+#define SHRINK      416
+#define NEWTEX      417
+#define CERACU      418
+#define MADRID      419
+#define SHIFTER     420
+#define FRACTURE    421
+#define SUBTRACT    422
+#define SPEKLINE    423
+#define SPECMORPH   424
+#define SPECMORPH2  425
+#define NEWDELAY    426
+#define FILTRAGE    427
+#define ITERLINE    428
+#define ITERLINEF   429
+#define SPECVU      430
+#define SPECRAND    431
+#define SPECSQZ     432
+#define HOVER2      433
+#define SELFSIM     434
+#define ITERFOF     435
+#define PULSER      436
+#define PULSER2     437
+#define PULSER3     438
+#define CHIRIKOV    439
+#define MULTIOSC    440
+#define SYNFILT     441
+#define STRANDS     442
+#define REFOCUS     443
+#define UNKNOT      444
+#define RHYMORPH    445
+#define RHYMORPH2   446
+#define CHANPHASE   447
+#define SILEND      448
+#define SPECULATE   449
+#define SPECTUNE    450
+#define REPAIR      451
+#define DISTSHIFT   452
+#define QUIRK       453
+#define ROTOR       454
+#define DISTCUT     455
+#define ENVCUT      456
+#define DISTWARP    457
+#define SPECFOLD    458
+#define BROWNIAN    459
+#define SPIN        460
+#define SPINQ       461
+#define CRUMBLE     462
+#define TESSELATE   463
+#define MULTISYN    464
+#define PHASOR      465
+#define CRYSTAL     466
+#define WAVEFORM    467
+#define DVDWIND     468
+#define CASCADE     469
+#define SYNSPLINE   470
+#define FRACTAL     471
+#define FRACSPEC    472
+#define SPLINTER    473
+#define REPEATER    474
+#define VERGES      475
+#define MOTOR       476
+#define STUTTER     477
+#define SCRUNCH     478
+#define IMPULSE     479
+#define TWEET       480
+#define BOUNCE      481
+#define SORTER      482
+#define SPECFNU     483
+#define FLATTEN     484
+#define WAVMEDIAN   485
+#define DISTORTT    486
+#define SPECTSTR    487
+#define DISTMARK    488
+#define FTURANAL    489
+#define FTURSYNTH   490
+#define DISTBRIGHT  491
+#define DISTDOUBLE  492
+#define SEGSBKWD    493
+#define SEGSZIG     494
+#define SPIKE       495
+#define DISTREP     496
+#define TOSTEREO    497
+#define SUPPRESS    498
+#define CALTRAIN    499
+#define SPECENV     500
+#define PAIREX      501
+#define NUCLICK     502
+#define CLIP        503
+#define SPECEX      504
+#define ONSET       505
+#define MATRIX      506
+#define TRANSPART   507
+#define SPECINVNU   508
+#define SPECCONV    509
+#define SPECSND     510
+#define SPECFRAC    511
+#define ENVSPEAK    512
+#define EXTSPEAK    513
+#define ENVSCULPT   514
+#define TREMENV     515
+//#define   TOPTAIL     497 //  nOT USEFUL: Tops and tails only where ALL channels fall below gate
+// MAX_PROCESS_NO should be defiend as the maximum number above 
+#ifdef MAX_PROCESS_NO
+#undef MAX_PROCESS_NO
+#define MAX_PROCESS_NO TREMENV
+#else
+#define MAX_PROCESS_NO TREMENV
+#endif
+
+#define MIX_MULTI   (ROTOR) // 1110000000000000 filetype
+
+// These numbers follow on consecutively from values in special.h 
+#define TAPDELAY_DATA   68
+#define TAPDELAY_OPTION 69
+#define P_BRK_DATA      70
+#define SYNTHBANK       71
+#define TIMEVARYING_SYNTHBANK   72
+#define PSOW_REINFORCEMENT      73
+#define PSOW_INHARMONICS        74
+#define FOFEX_EXCLUDES  75
+#define FOFBANK_INFO    76
+#define MCHANDATA       77
+#define MANYSIL_DATA    78
+#define RETIME_DATA     79
+#define FRAMEDATA       80
+#define IDEAL_DATA      81
+#define MCHANDATA2      82
+#define RETIME_FNAM     83
+#define WRAP_FOCUS      84
+#define ANTIPHON        85
+#define CROSSPAN        86
+#define RETEMPO_DATA    87
+#define RETIME_MASK     88
+#define OCHANDATA       89
+#define FLUTTERDATA     90
+#define CHANXDATA       91
+#define CHORDATA        92
+#define MZIGDATA        93
+/* #define TS_HARM      94  in science.h */
+#define TUNING          95
+#define TUNELOW_DATA    96
+#define ISOLATES        97
+#define ISOGROUPS       98
+#define ISOSLICES       99
+#define ISOSYLLS        100
+#define PANOLSPKRS      101
+#define PAK_TIMES       102
+#define SYN_PARTIALS    103
+#define SHRFOC          104
+#define NTEX_TRANPOS    105
+#define CYCLECNTS       106
+#define MAD_SEQUENCE    107
+#define SHFCYCLES       108
+#define ENVSERIES       109
+#define SPEKLDATA       110
+#define MPEAKS          111
+#define ITERTRANS       112
+#define ITERTRANSF      113
+#define SYN_SPEK        114
+#define SYN_FILTERBANK  115
+#define COUTHREADS      116
+#define RHYMORLINK      117
+#define TUNINGLIST      118
+#define ROTORDAT        119
+#define TESSELATION     120
+#define SCOREDATA       121
+#define CRYSTALDAT      122
+#define CASCLIPS        123
+#define FRACSHAPE       124
+#define REPEATDATA      125
+#define VERGEDATA       126
+#define MOTORDATA       127
+#define SPSYNCDAT       -1
+#define FFILT           -2
+#define HFIELD          -3
+#define HFIELD_OR_ZERO  -4
+#define SEGMENTLIST     -5
+#define MARKLIST        -6
+#define FTURDATA        -7
+#define SPIKEDATA       -8
+#define SPACEDATA       -9
+#define MATRIX_DATA     -10
+#define XSPK_PATTERN    -11
+#define XSPK_CUTS       -12
+#define XSPK_CUTPAT     -13
+#define XSPK_CUTARG     -14
+#define XSPK_CUPATA     -15
+#define RHYTHM          -16
+// these numbers follow on consecutively DOWNwards from vals in tkglobals.h 
+#define FILE_OR_ZERO    -7
+#define FNAM_STRING     -8
+// these numbers follow on consecutively from vals in cdparams.h 
+#define OPTIONAL_FILE   25
+
+#define SPEED_OF_SOUND (346.5)
+
+/* parameters for PSOW_FREEZE */
+#define PS_TIME (1)
+#define PS_DUR  (2)
+#define PS_SEGS (3)
+#define PS_DENS (4)
+#define PS_TRNS (5)
+#define PS_RAND (6)
+#define PS_GAIN (7)
+/* parameters for PSOW_INTERP */
+#define PS_SDUR (0)
+#define PS_IDUR (1)
+#define PS_EDUR (2)
+#define PS_VIBFRQ    (3)
+#define PS_VIBDEPTH  (4)
+#define PS_TREMFRQ   (5)
+#define PS_TREMDEPTH (6)
+/* parameters for PSOW_FEATURES */
+#define PSF_SEGS (1)
+#define PSF_TRNS (2)
+#define PSF_SPEC (5)
+#define PSF_RAND (6)
+#define PSF_GAIN (7)
+#define PSF_SUB (8)
+#define PSF_SUBGAIN (9)
+#define PSF_FOFSTR (10)
+/* parameters for PSOW_IMPOSE */
+#define PS_DEPTH     (1)
+#define PS_WSIZE     (2)
+#define PS_GATE      (3)
+#define PS_SCNT      (4)
+#define PS_ENTRYCNT  (5)
+#define PS_WORDCNT   (6)
+#define PS_TIMESLOTS (7)
+#define PS_FRQ_INDEX (8)
+#define PS_TIMES_CNT (9)
+/* parameters for PSOW_SPLIT */
+#define PS_SUBNO     (1)
+#define PS_UTRNS     (2)
+#define PS_ATTEN     (3)
+/* parameters for PSOW_SPACE */
+#define PS_SEPAR     (2)
+#define PS_RELEV     (3)
+#define PS_RELV2     (4)
+/* parameters for PSOW_INTERLEAVE */
+#define PS_GCNT      (2)
+#define PS_BIAS      (3)
+#define PS_WEIGHT    (5)
+/* ARRAY NAMES FOR for PSOW_SYNTH */
+#define PS_OSCFRQ   (0)
+#define PS_OSCAMP   (1)
+#define PS_INFRQ    (2)
+#define PS_INAMP    (3)
+#define PS_FBRK     (4)
+/* parameters for PSOW_EXTEND */
+#define PSE_VFRQ    (4)
+#define PSE_VDEP    (5)
+#define PSE_TRNS    (6)
+#define PSE_GAIN    (7)
+/* parameters for PSOW_EXTEND2 */
+#define PS2_VFRQ    (3)
+#define PS2_VDEP    (4)
+#define PS2_NUJ     (5)
+
+#define PS_SAMPTIME (0)
+
+/* parameters for PSOW_REINF */
+#define ISTR        (1)
+
+/* parameters for SPECROSS */
+#define PICH_THRESH     (6)
+#define SPCMPLEV        (7)
+#define SPECHINT        (8)
+    /* internal */
+#define PICH_PICH2      (9)
+/* flags for SPECROSS */
+#define AMP_SCALING     (0)
+#define STABLE_PITCH    (1)
+
+/* params for LUCIER GET */
+#define MIN_ROOM_DIMENSION  (0)
+#define ROLLOFF_INTERVAL    (1)
+/* extra param for LUCIER GETF */
+#define LUCIER_CUT          (2)
+/* params for LUCIER IMPOSE */
+#define RESON_CNT           (0)
+#define RES_EXTEND_ATTEN    (1)
+/* params for LUCIER SUPPRESS */
+#define SUPR_COEFF      (0)
+
+#define MAX_OUTCHAN (64)
+
+#define NEW_DEFAULT_NOISEGAIN (1.2)
+
+#define FORM_WIDTH      (0)
+#define FORM_ACCURACY   (1)
+#define FORM_PKCNT      (2)
+#define FORM_GATE       (3)
+#define FORM_RATIO      (4)
+#define FORM_FWIDTH     (5)
+
+#define FOFEX_FOFSAMPLE_SIZE (32)
+
+/* modes for FOFEX_CO */
+#define FOF_SINGLE  (0)
+#define FOF_SUM     (1)
+#define FOF_LOSUM   (2)
+#define FOF_MIDSUM  (3)
+#define FOF_HISUM   (4)
+#define FOF_LOHI    (5)
+#define FOF_TRIPLE  (6)
+#define FOF_MEASURE (7)
+
+#define FOF_NORM    (0)
+#define FOF_UNWIN   (0)
+
+#define LOCALMAX_WINDOW (10)
+#define LOCALMIN_WINDOW_DIV (3)
+#define LOCALPEAK_DECIMATE (5)
+
+/* params for PEAKCHOP */
+#define PKCH_WSIZE  (0)
+#define PKCH_WIDTH  (1)
+#define PKCH_SPLICE (2)
+#define PKCH_TEMPO  (3)
+#define PKCH_GAIN   (4)
+#define PKCH_GATE   (5)
+#define PKCH_SKEW   (6)
+#define PKCH_SCAT   (7)
+#define PKCH_NORM   (8)
+#define PKCH_REPET  (9)
+#define PKCH_MISS   (10)
+
+#define PKCH_RISE   (1)
+#define PKCH_DECDUR (2)
+#define PKCH_STEEP  (3)
+#define PKCH_ZSTT   (4)
+#define PKCH_ZEND   (5)
+#define PKCH_RATIO  (6)
+
+/* params for TEX_MCHAN */
+#define TEXTURE_OUTCHANS    (12)
+
+#define SVF_RANGE   (0)
+#define SVF_MATCH   (1)
+#define SVF_LOLM    (2)
+#define SVF_HILM    (3)
+
+   /********************************************************/
+   /* ELEMENTS IN PLAYLIST FOR MAKING MULTICHANNEL TEXTURE */
+   /********************************************************/
+
+struct soundoutmchan {         
+float *inbuf;
+unsigned long ibufcnt;
+unsigned long st_sstttime;
+unsigned long st_sendtime;
+unsigned long obufpos;
+long st_splicpos;
+double ibufpos;
+double step;
+double lgain;
+double rgain;
+int    lchan;
+int    rchan;
+struct soundoutmchan *next;
+struct soundoutmchan *last;
+};
+
+typedef struct soundoutmchan *sndoutmchptr;
+
+/* Retime */
+
+#define SIL_SPLICELEN   (0)
+#define MM  (0)
+#define RETIME_WIDTH    (1)
+#define RETIME_SPLICE   (2)
+
+#define SILMIN  (0.5)
+
+#define BEAT_AT         (1)
+#define BEAT_CNT        (2)
+#define BEAT_REPEATS    (3)
+#define BEAT_SILMIN     (4)
+
+#define RETIME_SYNCAT   (4)
+
+/* Mchanrev*/
+
+#define REV_OCHANS 4
+#define REV_CENTRE 5
+#define REV_SPREAD 6
+
+#define STRING_E    (26)
+
+
+/******* WRAPPAGE PARAMS, FLAGS ETC.******/
+
+#define WRAP_OUTCHANS       (0)
+#define WRAP_SPREAD         (1)
+#define WRAP_DEPTH          (2)
+#define WRAP_VELOCITY       (3)
+#define WRAP_HVELOCITY      (4)
+#define WRAP_DENSITY        (5)
+#define WRAP_HDENSITY       (6)
+#define WRAP_GRAINSIZE      (7)
+#define WRAP_HGRAINSIZE     (8)
+#define WRAP_PITCH          (9)
+#define WRAP_HPITCH         (10)
+#define WRAP_AMP            (11)
+#define WRAP_HAMP           (12)
+#define WRAP_BSPLICE        (13)
+#define WRAP_HBSPLICE       (14)
+#define WRAP_ESPLICE        (15)
+#define WRAP_HESPLICE       (16)
+#define WRAP_SRCHRANGE      (17)
+#define WRAP_SCATTER        (18)
+#define WRAP_OUTLEN         (19)
+#define WRAP_BUFXX          (20)
+
+#define WRAP_PRANGE         (21)
+#define WRAP_SPRANGE        (22)
+#define WRAP_VRANGE         (23)
+#define WRAP_DRANGE         (24)
+#define WRAP_INCHANS        (25)
+#define WRAP_BUF_SMPXS      (26)
+#define WRAP_BUF_XS         (27)
+#define WRAP_GLBUF_SMPXS    (28)
+#define WRAP_LBUF_SMPXS     (29)
+#define WRAP_LBUF_XS        (30)
+#define WRAP_IS_BTAB        (31)
+#define WRAP_IS_ETAB        (32)
+#define WRAP_CHANNELS       (33)
+#define WRAP_ORIG_SMPSIZE   (34)
+#define WRAP_SAMPS_IN_INBUF (35)
+#define WRAP_ARANGE         (36)
+#define WRAP_GRANGE         (37)
+#define WRAP_BRANGE         (38)
+#define WRAP_ERANGE         (39)
+#define WRAP_LONGS_BUFLEN   (40)
+#define WRAP_ARRAYSIZE      (41)
+
+#define WRAP_BSPLICETAB     (0)
+#define WRAP_ESPLICETAB     (1)
+#define WRAP_NORMFACT       (2)
+#define WRAP_CENTRE         (3)
+
+#define WRAP_FLAGS          (0)
+
+#define WRAP_LBUF           (0)
+#define WRAP_LBUFEND        (1)
+#define WRAP_LBUFMID        (2)
+#define WRAP_LTAILEND       (3)
+
+#define WRAP_PERM           (1)
+
+/* #define WRAP_BUF  (1) */
+/* #define WRAP_IBUF (2) */
+/* extrabuf_names */
+#define WRAP_GBUF   (0)
+/* bitflags */
+#define WRAP_VARIABLE_HI_BOUND  (8)
+#define WRAP_HI_BOUND           (4)
+#define WRAP_VARIABLE_VAL       (2)
+#define WRAP_FIXED_VAL          (1)
+/* defaults and internal counters */
+#define WRAP_MIN_GRSAMPSIZE     (4)     /* smaalest grainsize in (multichan-group=1) samps */
+#define WRAP_MAX_VFLAGS         (3)
+#define WRAP_DEFAULT_DENSITY    (2.0)
+#define WRAP_MAX_DENSITY        (16384.0)
+#define WRAP_MAX_VELOCITY       (32767.0)
+#define WRAP_DEFAULT_GRAINSIZE        (50.0)
+#define WRAP_DEFAULT_REVERB_PSHIFT    (0.33)
+#define WRAP_DEFAULT_REVERB_SRCHRANGE (50.0)    /* ??? */
+#define WRAP_DEFAULT_SPLICELEN        (5.0)     /* ??? */
+#define WRAP_MIN_SPLICELEN            (1.0)     /* ??? */
+#define WRAP_DEFAULT_SCATTER          (0.5)     /* ??? */   
+#define WRAP_DEFAULT_REVERB_DENSITY   (8.0)     /* ??? */
+
+#define WRAP_VELOCITY_FLAG  (0)
+#define WRAP_DENSITY_FLAG   (1)
+#define WRAP_GRAINSIZE_FLAG (2)
+#define WRAP_PITCH_FLAG     (3)
+#define WRAP_AMP_FLAG       (4)
+#define WRAP_SPACE_FLAG     (5)
+#define WRAP_BSPLICE_FLAG   (6)
+#define WRAP_ESPLICE_FLAG   (7)
+#define WRAP_RANGE_FLAG     (8)
+#define WRAP_SCATTER_FLAG   (9)
+
+#define WRAP_MIN_LIKELY_PITCH   (10.0)
+
+#define WRAP_SFLAGCNT  (8)  /* structured flags */
+#define WRAP_FLAGCNT   (2)  /* other flags */
+
+#define WRAP_EXPON  (0)
+#define WRAP_OTIME  (1)
+
+#define FIXED       (1)
+#define VARIABLE    (2)
+#define RANGED      (5)
+#define RANGE_VLO   (6)
+#define RANGE_VHI   (9)
+#define RANGE_VHILO (10)
+/* granula */
+/* multichannel 2009
+#define BOTH_CHANNELS (-1)
+#define ALL_CHANNELS  (-1)
+*/
+/* param names for SPECTOVF2 */
+#define SVF2_HILM   0
+#define SVF2_PKNG   1
+#define SVF2_CTOF   2
+#define SVF2_WNDR   3
+#define SVF2_PSST   4
+#define SVF2_TSTP   5
+#define SVF2_SGNF   6
+#define SVF2_LOLM   7
+#define SVF2_WSIZ   8
+
+/*  params for SETHARES */
+#define M_WINSIZE   0
+#define M_PEAKING   1
+#define M_AMPFLOOR  2
+#define M_LOFRQ     3
+#define M_HIFRQ     4
+#define M_INTUNE    5
+
+/* MCHSHRED */
+/* PARAMS */
+#define MSHR_CNT            (0)  /* int    */
+#define MSHR_CHLEN          (1)  /* double */
+#define MSHR_SCAT           (2)  /* double */
+#define MSHR_OUTCHANS       (3)  /* int    */
+/* internal */
+#define MSHR_SPLEN          (4)  /* int */
+#define MSHR_LAST_BUFLEN    (5)  /* int */
+#define MSHR_LAST_CHCNT     (6)  /* int */
+#define MSHR_LAST_SCAT      (7)  /* int */
+#define MSHR_UNITLEN        (8)  /* int */
+#define MSHR_RAWLEN         (9)  /* int */
+#define MSHR_ENDRAWLEN      (10) /* int */
+#define MSHR_SCATGRPCNT     (11) /* int */
+#define MSHR_RANGE          (12) /* int */
+#define MSHR_CHCNT_LESS_ONE (13) /* int */
+#define MSHR_ENDSCAT        (14) /* int */
+#define MSHR_ENDRANGE       (15) /* int */
+#define MSHR_CHCNT          (16) /* int */
+/* ARRAYS */
+#define MSHR_PERM           (0)     /* int array */
+#define MSHR_PERMCH         (1)     /* int array */
+#define MSHR_CHUNKPTR       (0)     /* long array */
+#define MSHR_CHUNKLEN       (1)     /* long array */
+#define MSHR_ROTATE         (0)     /* float array */
+/* CONSTANTS */
+#define MSHR_SPLICELEN      (256)
+#define MSHR_MAX_SCATTER    (8)
+#define MSHR_MAX            (10000)
+ 
+/*MCHZIG */
+#define MZIG_START  (0)
+#define MZIG_END    (1)
+#define MZIG_DUR    (2)
+#define MZIG_MIN    (3)
+#define MZIG_OCHANS (4)
+#define MZIG_SPLEN  (5)
+#define MZIG_MAX    (6)
+#define MZIG_RSEED  (7)
+/* constants */
+#define MZIG_SPLICELEN     (15.0)
+#define MZIG_MIN_UNSPLICED (1.0)
+#define MZIG_EXPON         (1.0)
+#define MMIN_ZIGSPLICE     (1.0)
+#define MMAX_ZIGSPLICE     (5000.0)
+#define MDEFAULT_LPSTEP    (200.0)
+
+/*MCHITER */
+#define MITER_OCHANS    (0)
+#define MITER_DUR       (1)
+#define MITER_REPEATS   (1)
+#define MITER_DELAY     (2)
+#define MITER_RANDOM    (3)                
+#define MITER_PSCAT     (4)            
+#define MITER_ASCAT     (5)            
+#define MITER_FADE      (6)            
+#define MITER_GAIN      (7)
+#define MITER_RSEED     (8)
+/* internal params */
+#define MITER_STEP      (9)
+#define MITER_MSAMPDEL  (10)
+#define MITER_DO_SCALE  (11)
+#define MITER_PROCESS   (12)
+
+/* ISOLATE */
+/* params */
+#define ISO_THRON   0
+#define ISO_THROFF  1
+#define ISO_SPL 2
+#define ISO_DOV 3
+#define ISO_MIN 3
+#define ISO_LEN 4
+/* modes */
+#define ISO_SEGMNT  0
+#define ISO_GROUPS  1
+#define ISO_THRESH  2
+#define ISO_SLICED  3
+#define ISO_OVRLAP  4
+
+/* PANORAMA */
+/* params */
+#define PANO_LCNT 0
+#define PANO_LWID 1
+#define PANO_SPRD 2
+#define PANO_OFST 3
+#define PANO_CNFG 4
+#define PANO_RAND 5
+
+/* TREMOLO  && TREMENV */
+/* params */
+#define TREMOLO_FRQ 0
+#define TREMOLO_DEP 1
+#define TREMOLO_WIN 2
+#define TREMOLO_AMP 2
+#define TREMOLO_SQZ 3
+/* sintable size */
+#define TREMOLO_TABSIZE 4096
+
+/* ECHO */
+/* params */
+#define ECHO_DELAY  0
+#define ECHO_ATTEN  1
+#define ECHO_DUR    2
+#define ECHO_RAND   3
+#define ECHO_CUT    4
+
+/* PACKET */
+/* params */
+#define PAK_DUR 0
+#define PAK_SQZ 1
+#define PAK_CTR 2
+
+/* SYNTHESIZE */
+/* params */
+#define SYNTHSRAT (0)
+#define SYNTH_DUR (1)
+#define SYNTH_FRQ (2)
+#define SYNTH_SQZ (3)
+#define SYNTH_CTR (4)
+
+#define SYNTH_DAMP  (3)
+#define SYNTH_K     (4)
+#define SYNTH_B     (5)
+
+#define SYNTH_ATK       (3)
+#define SYNTH_EATK      (4)
+#define SYNTH_DEC       (5)
+#define SYNTH_EDEC      (6)
+#define SYNTH_ATOH      (7)
+#define SYNTH_GTOW      (8)
+#define SYNTH_RAND      (9)
+#define SYNTH_FLEVEL    (10)
+
+/* sintable size */
+#define SYNTH_TABSIZE   131072
+#define SYNTH_CHANS (3)
+#define SYNTH_MAX   (4)
+#define SYNTH_RATE  (5)
+#define SYNTH_RISE  (6)
+#define SYNTH_FALL  (7)
+#define SYNTH_STDY  (8)
+#define SYNTH_SPLEN (9)
+#define SYNTH_NUM   (10)
+#define SYNTH_EFROM (11)
+#define SYNTH_ETIME (12)
+#define SYNTH_CTO   (13)
+#define SYNTH_CTIME (14)
+#define SYNTH_STYPE (15)
+#define SYNTH_RSPEED (16)
+
+/* TANGENT */
+/* params */
+#define TAN_DUR     (0)
+#define TAN_STEPS   (1)
+#define TAN_MANG    (2)
+#define TAN_SKEW    (2)
+#define TAN_DEC     (3)
+#define TAN_FBAL    (4)
+#define TAN_FOCUS   (5)
+#define TAN_JITTER  (6)
+#define TAN_SLOW    (7)
+
+/* SPECTWIN */
+/* params */
+#define TWIN_FRQINTP    (0)
+#define TWIN_ENVINTP    (1)
+
+/* TRANSIT */
+/* params */
+#define TRAN_FOCUS  (0) /*  Centre of motion */
+#define TRAN_DUR    (1) /*  Duration */
+#define TRAN_STEPS  (2) /*  Number of events in stream */
+#define TRAN_MAXA   (3) /*  Maxangle, or (mode4) maxdistance */
+#define TRAN_DEC    (4) /*  Gain from 1 event to next, away from centre */
+#define TRAN_FBAL   (5) /*  Progreesive mix-in of filtered sound, away from centre */
+#define TRAN_THRESH (6) /*  Gain at which gain-decrement starts to increase */
+#define TRAN_DECLIM (7) /*  Mix level of decrement after it dtarts to increase */
+#define TRAN_MINLEV (8) /*  Minimum gain level for event to end */
+#define TRAN_MAXDUR (9) /*  Maximum duration to curtail event */
+/* modes */
+#define GLANCING    (0)
+#define EDGEWISE    (1)
+#define CROSSING    (2)
+#define CLOSE       (3)
+#define CENTRAL     (4)
+/* arrays */
+#define TR_SPKRPAIR (0)
+#define TR_SNDFILE  (1)
+#define TR_LEVEL    (0)
+#define TR_POSITION (1)
+#define TR_TIME     (2)
+#define TR_FLTMIX   (3)
+
+/* CANTOR */
+/* params */
+#define CA_HOLEN    (0)
+#define CA_HOLEDIG  (1)
+#define CA_TRIGLEV  (2)
+#define CA_WOBBLES  (2)
+#define CA_WOBDEC   (3)
+#define CA_SPLEN    (3)
+#define CA_MAXDUR   (4)
+
+/* SHRINK */
+/* params */
+#define SHR_TIME    (0)
+#define SHR_INK     (1)
+#define SHR_GAP     (2)
+#define SHR_WSIZE   (2)
+#define SHR_CNTRCT  (3)
+#define SHR_DUR     (4)
+#define SHR_AFTER   (4)
+#define SHR_SPLEN   (5)
+#define SHR_SMALL   (6)
+#define SHR_MIN     (7)
+#define SHR_RAND    (8)
+#define SHR_GATE    (9)
+#define SHR_LEN     (10)
+#define SHR_SKEW    (11)
+/* modes */
+#define SHRM_START  (0)
+#define SHRM_END    (1)
+#define SHRM_CENTRE (2)
+#define SHRM_TIMED  (3)
+#define SHRM_FINDMX (4)
+#define SHRM_LISTMX (5)
+/* flags */
+#define SHRNK_NORM   (0)
+#define SHRNK_INVERT (1)
+#define SHRNK_EVENLY (2)
+#define SHR_SUPPRESS (3)
+/* double arrays */
+#define LOCAL_PK_VAL  (0)
+#define SHR_INPUT_PKS (1)
+#define SHR_INVTGAPS  (2)
+/* long arrays */
+#define SHR_PEAKS     (0)
+#define SHR_TROFS     (1)
+#define LOCAL_PK_AT   (2)
+/* TINY WINDOW, TO FIND MINIMUM */
+#define TINY_WSIZE  (8)
+
+/* spacebox */
+
+#define SB_LRRAND       1
+#define SB_FBRAND       2
+#define SB_ROTATE       3
+#define SB_SUPERSPACE   4
+#define SB_SUPERSPACE2  5
+#define SB_SUPERSPACE3  6
+#define SB_SUPERSPACE4  7
+#define SB_LR           8
+#define SB_FB           9
+#define SB_FRAMESWITCH  10
+#define SB_TRIROT1      11
+#define SB_TRIROT2      12
+#define SB_ANTITRIROT1  13
+#define SB_ANTITRIROT2  14
+
+/* NEWTEX */
+/* params */
+#define NTEX_DUR    (0)
+#define NTEX_CHANS  (1)
+#define NTEX_MAX    (2)
+#define NTEX_RATE   (3)
+#define NTEX_STYPE  (4)
+#define NTEX_DEL    (5)
+#define NTEX_LOC    (6)
+#define NTEX_AMB    (7)
+#define NTEX_GST    (8)
+#define NTEX_SPLEN  (9)
+#define NTEX_NUM    (10)
+#define NTEX_EFROM  (11)
+#define NTEX_ETIME  (12)
+#define NTEX_CTO    (13)
+#define NTEX_CTIME  (14)
+#define NTEX_RSPEED (15)
+/* constants */
+#define NTEX_OBUFSIZE (512 * 512)
+
+/* CERACU */
+#define CER_MINDUR  (0)
+#define CER_OCHANS  (1)
+#define CER_CUTOFF  (2)
+#define CER_DELAY   (3)
+#define CER_DSTEP   (4)
+/* FLAGS */
+#define CER_OVERRIDE (0)
+#define CER_LINEAR   (1)
+
+/* MADRID */
+#define MAD_DUR    (0)
+#define MAD_CHANS  (1)
+#define MAD_STRMS  (2)
+#define MAD_DELF   (3)
+#define MAD_STEP   (4)
+#define MAD_RAND   (5)
+#define MAD_SEED   (6)
+/* FLAGS */
+#define MAD_GAPS   (0)
+#define MAD_LINEAR (1)
+#define MAD_INPERM (2)
+#define MAD_INRAND (3)
+
+/* SHIFTER */
+#define SHF_CYCDUR (0)
+#define SHF_OUTDUR (1)
+#define SHF_OCHANS (2)
+#define SHF_SUBDIV (3)
+#define SHF_LINGER (4)
+#define SHF_TRNSIT (5)
+#define SHF_LBOOST (6)
+/* flags */
+#define SHF_ZIG (0)
+#define SHF_RND (1)
+#define SHF_LIN (2)
+
+/* FRACTURE */
+#define FRAC_CHANS   (0)
+#define FRAC_STRMS   (1)
+#define FRAC_PULSE   (2)
+#define FRAC_DEPTH   (3)
+#define FRAC_STACK   (4)
+#define FRAC_CENTRE  (5)
+#define FRAC_FRONT   (6)
+#define FRAC_MDEPTH  (7)
+#define FRAC_ROLLOFF (8)
+#define FRAC_INRND   (9)
+#define FRAC_OUTRND (10)
+#define FRAC_SCAT   (11)
+#define FRAC_LEVRND (12)
+#define FRAC_ENVRND (13)
+#define FRAC_STKRND (14)
+#define FRAC_PCHRND (15)
+#define FRAC_SEED   (16)
+#define FRAC_MIN    (17)
+#define FRAC_MAX    (18)
+#define FRAC_ATTEN  (19)
+#define FRAC_ZPOINT   (20)
+#define FRAC_CONTRACT (21)
+#define FRAC_FPOINT   (22)
+#define FRAC_FFACTOR  (23)
+#define FRAC_FFREQ    (24)
+#define FRAC_UP       (25)
+#define FRAC_DN       (26)
+#define FRAC_GAIN     (27)
+
+/* SPECMORPH */
+// params
+#define NMPH_STAG       (0)
+#define NMPH_ASTT       (1)
+#define NMPH_AEND       (2)
+#define NMPH_AEXP       (3)
+#define NMPH_APKS       (4)
+#define NMPH_OCNT       (5)
+#define NMPH_RAND       (6)
+// modes
+#define NMPH_LINE   (0)
+#define NMPH_COSIN  (1)
+#define NMPH_LINEX  (2)
+#define NMPH_COSINX (3)
+#define NMPH_LINET  (4)
+#define NMPH_COSINT (5)
+#define NMPH_GETTEX (6)
+#define NMPH_LINTEX (7)
+#define NMPH_COSTEX (8)
+
+/* SPECTUNE */
+#define ST_MATCH    0
+#define ST_LOPCH    1
+#define ST_HIPCH    2
+#define ST_STIME    3
+#define ST_ETIME    4
+#define ST_INTUN    5
+#define ST_WNDWS    6
+#define ST_NOISE    7
+
+#define ST_INTUN5   3           //  different param numbering for mode 4
+#define ST_WNDWS5   4
+#define ST_NOISE5   5
+
+#define ST_CNT      0
+
+#define ST_ACCEPTABLE_MATCH 5
+
+/* DISTCUT */
+#define DCUT_CNT    0
+#define DCUT_STP    1
+#define DCUT_EXP    2
+#define DCUT_LIM    3
+
+/* ENVCUT */
+#define ECUT_CNT    0
+#define ECUT_STP    1
+#define ECUT_ATT    2
+#define ECUT_EXP    3
+#define ECUT_LIM    4
+
+/* PHASOR */
+#define PHASOR_STREAMS  0
+#define PHASOR_FRQ      1
+#define PHASOR_SHIFT    2
+#define PHASOR_OCHANS   3
+#define PHASOR_OFFSET   4
+
+/* SPECSYNC */
+#define IBUF    0   
+#define OBUF    1   
+#define OEND    2   
+#define IHERE   3
+#define INEXT   4
+#define OHERE   5
+#define SYNCBUFSCNT 8
+
+/* SORTER */
+#define SORTER_SIZE     0
+#define SORTER_SEED     1
+#define SORTER_SMOOTH   2
+#define SORTER_OMIDI    3
+#define SORTER_IMIDI    4
+#define SORTER_META     5
+
+/* MODES FOR MATRIX */
+#define MATRIX_MAKE     0
+#define MATRIX_USE      1
+/* PNAMES FOR MATRIX */
+#define MATRIX_CHANS    0
+#define MATRIX_OVLAP    1
+/* PNAMES FOR FRACTAL */
+#define FRACDEPTH       0
+#define FRACSPLICE      1
+/* PNAMES FOR ENVSPEAK */
+#define ESPK_WINSZ  0
+#define ESPK_SPLEN  1
+#define ESPK_OFFST  2
+#define ESPK_REPET  3
+#define ESPK_GAIN   4
+#define ESPK_WHICH  5
+/* FLAG NAMES EXTSPEAK */
+#define XSPK_TRANSPOSE  0
+#define XSPK_ENV        1
+#define XSPK_KEEP       2
+#define XSPK_ORIGSZ     3
+#define XSPK_INJECT     4
+#define XSPK_RAND       5
+/* PNAMES NAMES EXTSPEAK */
+#define XSPK_WINSZ  0
+#define XSPK_SPLEN  1
+#define XSPK_OFFST  2
+#define XSPK_N      3
+#define XSPK_GAIN   4
+#define XSPK_SEED   5
+#define MAX_PATN    100

+ 33 - 0
dev/include/strange.h

@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specshift(dataptr dz);
+int  specglis(dataptr dz);
+int  specinvert(dataptr dz);
+int      specwaver(dataptr dz);
+int      specwarp(dataptr dz);

+ 30 - 0
dev/include/stretch.h

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_SPEC_COMPILE         (1)
+
+int  specstretch(dataptr dz);
+int  spectstretch(dataptr dz);

+ 586 - 0
dev/include/structures.h

@@ -0,0 +1,586 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/* floatsam version */
+   /*********************************************/
+   /* STORAGE OF DUPLICATE HEADERS IN SFRECOVER */
+   /*********************************************/
+#ifndef  _STRUCTURES_H_INCLUDED
+#define  _STRUCTURES_H_INCLUDED
+
+#include <sfsys.h>  /* for CHPEAK */
+
+struct hhead {
+        char  *addr;
+        short cnt;
+};
+
+typedef struct hhead *headptr;
+
+   /*******************************************/
+   /* ELEMENTS IN PLAYLIST FOR MAKING TEXTURE */
+   /*******************************************/
+
+struct soundout {
+float *inbuf;
+unsigned int ibufcnt;
+unsigned int st_sstttime;
+unsigned int st_sendtime;
+unsigned int obufpos;
+int st_splicpos;
+double ibufpos;
+double step;
+double lgain;
+double rgain;
+struct soundout *next;
+struct soundout *last;
+};
+
+typedef struct soundout *sndoutptr;
+
+/*************************************************/
+/*  STORE CHAN DATA IN RINGBUF (TRACE,SUPR etc)  */
+/*************************************************/
+
+struct chanval {
+        float   val;
+        int             loc;
+        struct  chanval *next;
+        struct  chanval *last;
+};
+
+typedef struct chanval *chvptr;
+
+/*************************************************/
+/*              STORE LOUDEST-CHANNEL DATA (BLTR)               */
+/*************************************************/
+
+struct chanstore {
+    float amp;
+    int   chan;
+};
+
+typedef struct chanstore *chsptr;
+
+/*************************************************/
+/*                STORES SPEC SPLIT BANDING DATA                 */
+/*************************************************/
+
+struct bandd {
+        int  bdoflag;           /*RWD these two were short */
+        int  badditive;
+        double bfrqlo;
+        double bfrqhi;
+        double bfrqdif;
+        double bamp;
+        double bampdif;
+        double btrans;
+};
+
+typedef struct bandd *bandptr;
+
+/*************************************************/
+/*      WHICH CHANS ARE PEAKS, & HOW OFTEN (FOCU)        */
+/*************************************************/
+
+struct design {
+        int     chan;
+        int score;
+        double amp;
+};
+
+typedef struct design *desptr;
+
+/*************************************************/
+/* FOCU: DATA FOR CALCULATING STABILITY OF PEAKS */
+/*************************************************/
+
+struct stability {
+        int     offset;
+        float *sbufstore;
+        float *specstore;
+        float **sbuf;                   /* pointers to windows within it        */
+        float **spec;
+        int *fpkstore;                  /* baktraking spectral-peaks buffer */
+        int *total_pkcnt;               /* count of total peaks found per baktrak buffer */
+        int *design_score;              /* array for designing filter           */
+        int **fpk;                      /* pointers to peakstores within it */
+        desptr *des;
+};
+
+typedef struct stability *stabptr;
+
+   /*******************************************/
+   /* ELEMENTS IN NOTELIST, STORING NOTE DATA */
+   /*******************************************/
+
+struct nnote {
+        float pitch;
+        float amp;
+        float dur;
+        float ntime;
+        float spacepos;
+        float motioncentre;
+        unsigned char instr;
+        struct nnote *next;
+        struct nnote *last;
+};
+
+typedef struct nnote *noteptr;
+
+   /**********************************************/
+   /* ELEMENTS IN MOTIFLIST, STORING NOTE-MOTIFS */
+   /**********************************************/
+
+struct motif {
+        noteptr firstnote;
+        struct motif *next;
+        struct motif *last;
+};
+
+typedef struct motif *motifptr;
+
+   /*************************************************/
+   /* PROPERTIES OF INPUT FILES, FOR TEXTURE APPLICS*/
+   /*************************************************/
+
+struct insample {
+float *buffer;
+double pitch;
+};
+
+typedef struct insample *insamptr;
+
+   /***********************************************/
+   /* ADDITIONAL DATA STORAGE FOR TEXTURE APPLICS */
+   /***********************************************/
+
+struct textural {
+unsigned int txflag;
+motifptr      motifhead;
+motifptr      timeset;
+motifptr      hfldmotif;
+motifptr      *phrase;
+insamptr      *insnd;
+int           **perm;
+unsigned char dectypstor;
+unsigned char dectypcnt;
+unsigned char amptypstor;
+unsigned char amptypcnt;
+int           phrasecnt;
+int           ampdirectd;
+};
+
+typedef struct textural *texptr;
+
+   /***********************************************/
+   /*           DATA STORAGE FOR MIXING ACTIONS           */
+   /***********************************************/
+
+struct actval {
+int  ifd;               /* file from which to read samples */
+int  bufno;             /* these must be assigned before we start using this struct */
+int samplen;            /* number of samples produced from whole file */
+double llscale;         /* this is left  weighting of left-inchan  * 32768 */
+double lrscale;         /* this is right weighting of left-inchan  * 32768 */
+double rlscale;         /* this is left  weighting of right-inchan * 32768 */
+double rrscale;         /* this is right weighting of right-inchan * 32768 */
+int  stereo;            /* mono, stereo, mono-to-stereo, stereo_panned */
+} ;
+
+typedef struct actval  *actvalptr;
+
+   /***********************************************/
+   /*                           MIXING ACTIONS                    */
+   /***********************************************/
+
+struct action {
+int       position;     /* time of action, in samples                 */
+actvalptr val;          /* all associated values, stored in an actval */
+int       role;         /* ON , REFILL, or OFF                        */
+} ;
+
+typedef struct action  *actptr;
+
+
+   /***********************************************/
+   /*                           MIXING BUFFERS                 */
+   /***********************************************/
+
+
+struct bufitem {
+short status;            /* Buffer is in use or not */
+float *buf;              /* Location of buffer      */
+float *here;             /* Location in buffer      */
+} ;
+
+typedef struct bufitem *mixbufptr;
+
+   /***********************************************/
+   /*   APPLICATION (Possibly only for CMDLINE??  */
+   /***********************************************/
+
+struct applic {
+char    max_param_cnt;          /* Max number of parameter taken by prog */
+char    internal_param_cnt;     /* Number of internal parameters */
+                                /****** ENTRY OF DATA TO PROGRAM ******/
+char    formant_flag;           /* Indicates whether formant data is entered */
+char    formant_qksrch;         /* Indicates alternative formant calculation */
+char    **param_name;
+char    **flagname;
+char    *special_data_name;
+char    *special_data_name2;
+char    special_data;           /* Indicates if (and which) special data (pitch,filter params etc) is used by prog */
+int     special_range;          /* Flag when range of special_data can be displayed in dialog-box */
+int     other_special_range;    /* Flag when range of 2nd item of special_data CAN be displayed */
+int     data_in_file_only;
+int     input_process_type;
+int     accepts_conflicting_srates;
+double  min_special;            /* range for special_data */
+double  max_special;
+double  default_special;        /* default value of special_data */
+double  min_special2;           /* range for 2nd item of special_data */
+double  max_special2;
+int     no_pitchwise_formants;
+int     min_fbands;
+int     max_freqwise_fbands;
+int     max_pichwise_fbands;
+int     no_pichwise_formants;
+char    param_cnt;               /* Number of parameter taken by prog */
+char    option_cnt;              /* Number of options on options menu, or cmdline */
+char    vflag_cnt;               /* Total number of variants in menu, or possible on cmdline */
+char    variant_param_cnt;       /* Number of variants with parameters */
+char    total_input_param_cnt;
+
+char*   display_type;           /* normal, log etc */
+char*   has_subrange;
+                                /* total number of params that can be input, including options & variants */
+                                /* PARAMETER TYPE (int, double, brkpnt. brkpnt-int) for ... */
+double *lo;                     /* parameter range min */
+double *hi;                     /* parameter range max */
+double *default_val;            /* parameter range max */
+double *lolo;                   /* displayed parameter range min */
+double *hihi;                   /* displayed parameter range max */
+char   *param_list;             /* each param in turn */
+char   *option_list;            /* each option in turn */
+char   *variant_list;           /* each variant in turn */
+char   *internal_param_list;    /* internal param types */
+                                /* CMDLINE FLAGS */
+char   *option_flags;           /* Cmdline flags used to differentiate options */
+char   *variant_flags;          /* Cmdline flags used to differentiate variants */
+};
+
+typedef struct applic *aplptr;
+
+
+   /***********************************************/
+   /*            INFILE DATA STORAGE AT PARSING           */
+   /***********************************************/
+/* RWD FEB 2010: need unsigned values for file sizes */
+struct filedata {
+    int     filetype;
+                        /* FILE DESCRIPTOR AND SIZES */
+/*unsigned*/ int infilesize;
+/*unsigned*/ int insams;    /*RWD FEB 2010 */
+                        /* FILE PROPERTIES */
+    int     srate;                          /* cdp file properties */
+    int     channels;
+    int     stype;
+    int     origstype;
+    int     origrate;
+    int     Mlen;
+    int     Dfac;
+    int     origchans;
+    int     specenvcnt;
+    int     wanted;                         /* floats per window */
+    int     wlength;                        /* length in windows */
+    int     out_chans;                      /* outchans of mixfile */
+    int     descriptor_samps;
+                                /* FLAGS */
+    int     is_transpos;            /* flags transpos, rather than pitch, in floatarray */
+    int     could_be_transpos;      /* flags textfile data COULD be transpos data */
+    int     could_be_pitch;         /* flags textfile data COULD be pitch data  */
+    int     different_srates;       /* flags program can accept insnds of different srates */
+    int     duplicate_snds;         /* flags there are duplicated sndfiles in mixfile */
+                                /* COUNTERS */
+    int     brksize;                        /* (paired) size of brkpnt data  */
+    int     numsize;                        /* unpaired size of numeric data */
+
+                                /* TEXTFILE DATA */
+    int     linecnt;                    /* number of lines */
+    int     all_words;                  /* number of words */
+
+    float   arate;
+    float   frametime;                  /* duration of window */
+    float   window_size;            /* duration of (envelope) window */
+    double  nyquist;
+                                    /* BRKPNT DATA */
+    double  duration;                       /* duration of brkpnt data */
+    double  minbrk;
+    double  maxbrk;
+    double  minnum;
+    double  maxnum;
+};
+
+typedef struct filedata *infileptr;
+
+   /***********************************************/
+   /*               INFILE PROPERTIES STORAGE             */
+   /***********************************************/
+
+struct fileprops {
+    int     filetype;
+    int     srate;
+    int     stype;
+    int     origstype;
+    int     origrate;
+    int     channels;
+    int     origchans;      /* pitch, formant,transpos only */
+    int     specenvcnt;     /* formants only */
+    int     Mlen;
+    int     Dfac;
+    float   arate;
+    float   window_size;    /* duration of (envelope) window */
+};
+
+typedef struct fileprops *fileptr;
+
+   /***********************************************/
+   /*             PROGRAM PRINCIPAL STRUCTURE             */
+   /***********************************************/
+
+
+struct datalist {
+int                     process;                /* which application is being run */
+int                     maxmode;                /* number of modes of operation of process */
+int                     mode;                   /* actual mode of operation of process */
+/* PROCESS TYPES */
+int                     input_data_type;
+int                     outfiletype;
+int                     process_type;
+char            *outfilename;  /* need this for synth */
+/*RWD.10.98 force floatsam outfile*/
+int                     floatsam_output;
+double          peak_fval;
+int             true_outfile_stype;
+int                     clip_floatsams;
+
+/* all this is to do with PEAK handling! */
+
+int                     outchans;
+int                     otheroutchans;
+int                     needpeaks;
+int                     needotherpeaks;
+CHPEAK          *outpeaks;               /* for running PEAK counting */
+CHPEAK          *otherpeaks;                    /* for 'otherfile' output;*/
+unsigned int            *outpeakpos;     /* tracking position of peak, for each channel */
+unsigned int            *otherpeakpos;
+
+/* APPLICATION */
+aplptr          application;    /* structure to store details of particular process */
+/* BUFFERS */
+float           *bigbuf;                /* internal large buffer */
+float           **sampbuf;              /* buffer starts and ends */
+float           **sbufptr;              /* buffer pointers */
+float           *bigfbuf;               /* internal large buffer for floats */
+float           **flbufptr;             /* buffer pointers for float bufs */
+float           **windowbuf;    /* additional window_size buffers for floats */
+float           **extrabuf;             /* extra non-standard-length snd-buffer pointers */
+float           **extrabufptr;  /* extra_buffer pointers */
+float           *amp;
+float           *freq;
+/* BRKPNT TABLES */
+double          **brk;
+double          **brkptr;
+int             *brksize;
+double          *lastind;
+double          *lastval;
+int                     *brkinit;
+double          *firstval;
+/* PARAMETERS */
+double          *param;                 /* parameter storage */
+int                     *iparam;                /* integer parameter storage */
+char            *vflag;                 /* internal program flags set by variants in cmdline/menu */
+/* PARAMETER MARKERS */
+char            *is_int;                /* mark integer parameters, INCLUDING internal parameters */
+char            *no_brk;                /* mark parameters which cannot be entered as brkpntfiles */
+char            *is_active;             /* mark parameters which COULD actually be in use */
+/* ARRAYS */
+double          **parray;               /* parameter array storage */
+int                     **iparray;              /* integer parameter array storage */
+/* RWD used for submix syncatt  instead of lparray      */
+float           **lfarray;
+int             **lparray;              /* int parameter array storage */
+float           *sndbuf;                /* short parameter array storage, for (pseudo) snd output */
+/* INTERNAL POINTERS */
+/*TW NAME CHANGE, TO avoid possible future error (lptrs were paired with lparrays)*/
+float           **fptr;                 /* misc pointers to floats   */
+double          **ptr;                  /* misc pointers to doubles */
+/* FILE PROPERTY STORES */
+fileptr         infile;                 /* first infile */
+fileptr         outfile;                /* main outfile */
+fileptr         otherfile;              /* 2nd infile which CAN have different sr, chans */
+/* INFILE POINTERS AND SIZES */
+int             *ifd;
+/*int                   *infilesize;*/
+int             *insams;
+/* FORMANT ARRAYS */
+float           *specenvfrq;
+float           *specenvpch;
+float           *specenvamp;
+float           *specenvtop;
+float           *specenvamp2;
+/* FOR PITCH CONTOUR, TRANSPOSITION OR CHORDS */
+float           *pitches;
+float           *transpos;
+float           *pitches2;
+float           *transpos2;
+float           *frq_template;
+/* FOR FILTERS */
+float           *fsampbuf;
+double          *filtpeak;
+double          *fbandtop;
+double          *fbandbot;
+int                     *peakno;
+int                     *lastpeakno;
+/* SPECIAL PURPOSE */
+bandptr         *band;           /* for SPLIT */
+stabptr         stable;          /* for FOCUS */
+chsptr          loudest;         /*     FOR BLTR */
+chvptr          ringhead;        /*     FOR SUPR and TRACE & PITCH */
+chvptr          ringhead2;       /*     FOR MEAN */
+double          *temp;
+/* ENVELOPES */
+float           *origenv;
+float           *origend;
+float           *env;
+float           *envend;
+double          *rampbrk;
+/* MIXFILE */
+actvalptr       *valstor;
+actptr          *act;
+mixbufptr       *buflist;
+int                     *activebuf;
+float           **activebuf_ptr;
+/* TEXTTURE */
+texptr          tex;
+/* TEXTFILES */
+int                     *wordcnt;
+char            **wordstor;
+FILE            *fp;
+/* OTHER FILE PONTERS */
+int             ofd;
+int                     other_file;
+/* DATA OR PROCESS CONSTANTS */
+int             outfilesize;
+/*int                   bigbufsize;*/
+/*int                   bigbufsize2;    */
+int             buflen2;
+int             big_fsize;
+int             buflen;
+int             linecnt;
+int             all_words;
+int             extra_word;
+int     numsize;
+int             wanted;
+/*int                   byteswanted;    */
+int             sampswanted;
+int             wlength;
+int             clength;
+int                     infilecnt;
+int                     bptrcnt;
+int                     bufcnt;                 /* buffers used by SND programs */
+int                     extra_bufcnt;   /* extra_buffers used by SND programs */
+int                     array_cnt;
+int                     iarray_cnt;
+int                     larray_cnt;
+/*TW NAME CHANGE*/
+/*int           lptr_cnt;*/
+int                     fptr_cnt;
+int                     ptr_cnt;
+int                     formant_bands;
+int                     specenvcnt;
+/*int                   descriptor_bytes;*/
+int                     descriptor_samps;
+int             out_chans;
+int                     extrabrkno;
+double          nyquist;
+double          chwidth;
+double          halfchwidth;
+double          minbrk;
+double          maxbrk;
+double          minnum;
+double          maxnum;
+double          duration;
+/* COUNTERS */
+int             total_windows;
+int             total_samps_written;
+/*int           total_bytes_written;*/
+/*int           bytes_left;*/
+int             samps_left;
+int             ssampsread;
+int             total_samps_read;
+/*int           bytes_read;*/
+/*int           samps_read;     */              /*RWD  just use ssampsread */
+/*int           total_bytes_read;*/
+int                     itemcnt;
+int                     ringsize;
+int             tempsize;                       /*RWD need both? */
+int             temp_sampsize;          /*RWD my addition for housekeep channels*/
+int             rampbrksize;
+/* TIMERS */
+float           time;
+float           timemark;
+float           frametime;
+/* OTHER */
+double          scalefact;
+double          is_sharp;
+double          is_flat;
+/* FLAGS */
+int                     specenv_type;
+int                     deal_with_chan_data;
+int             different_srates;
+int             duplicate_snds;
+int                     unspecified_filecnt;
+int                     has_otherfile;
+int                     is_transpos;
+int                     could_be_transpos;
+int                     could_be_pitch;
+int                     finished;
+int                     zeroset;
+int                     fzeroset;
+int                     is_mapping;
+int                     is_rectified;
+
+/*RWD */
+/*int                   snd_ofd;*/
+/*int                   snd_ifd;*/ /* just the one */
+};
+
+typedef struct datalist *dataptr;
+
+
+#endif

+ 55 - 0
dev/include/synth.h

@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE      (1)
+
+#define WAVE_TABSIZE    (256)
+#define WAVE_DEFAULT_SR (44100)
+#define MAX_SYN_DUR             (7200.0)        /* 2 hrs */
+#define MIN_SYN_DUR             (0.04)          /* Assumes min samprate = 16000 and max chans = 2 */
+                                                                        /* Otherwise, internal trap */
+#define MAX_SYNTH_FRQ   (22000)         /* lowest conceivable nyquist */
+#define MIN_SYNTH_FRQ   (0.1)           /*arbitrary */
+
+#define SYNTH_SPLICELEN (256)
+
+int do_synth(dataptr dz);
+int do_stereo_specsynth(dataptr dz);
+
+#define CHANUP (4)                              /* half-band of channels over which same frq can occur */
+//TW: total amp of 1.0 seems rational, but causes distorttion on resynth
+//#define SPECSYN_MAXAMP (1.0)  /* maximum total amp of a spectrum : guess */
+#define SPECSYN_MAXAMP (0.5)    /* maximum total amp of a spectrum : guess */
+//#define SPECSYN_SRATE  (48000)
+//#define SPECSYN_MLEN   (4098)
+ /*RWD more economical ones! */
+#define SPECSYN_SRATE  (44100)
+#define SPECSYN_MLEN   (1026)
+#define CLICK_SRATE (48000)
+#define CLICKLEN (20)
+#define CLICKAMP1 (1.0)
+#define CLICKAMP2 (.5)
+#define CLICKAMP3 (.2)

+ 32 - 0
dev/include/texture.h

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE              (1)
+
+#include        <pnames.h>
+#include        <flags.h>
+#include        <txtucon.h>
+#include        <texture1.h>

+ 113 - 0
dev/include/texture1.h

@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+//REMOVED functions that are now LOCAL STATIC
+//int  initialise_texture_structure(dataptr dz);
+//int  set_up_and_fill_insample_buffers(insamptr **insound,dataptr dz);
+//int  setup_texflag(texptr tex,dataptr dz);
+//int  preset_some_internal_texture_params(dataptr dz);
+//int  install_the_internal_flags(int total_flags,int internal_flags,dataptr dz);
+//int  get_the_notedata(texptr tex,dataptr dz);
+int  attenuate_input_sounds(dataptr dz);
+//int  extend_timeset(dataptr dz);
+//int  generate_timeset(dataptr dz);
+//int  do_prespace(motifptr tset,dataptr dz);
+//int  pre_space(noteptr thisnote,dataptr dz);
+//int  assign_timeset_hfset_motifsets(dataptr dz);
+//int  massage_params(dataptr dz);
+
+int  prepare_texture_parameters(dataptr dz);
+int  make_texture(dataptr dz);
+void upsort(double *scti,int scatcnt);
+double quantise(double thistime,double timegrid);
+int  initperm(int ***permm,dataptr dz);
+int  make_new_note(noteptr *thisnote);
+
+void swap(double *a,double *b);
+void iswap(int *a,int *b);
+//int  get_the_notedatafile(char *str,dataptr dz);
+double octadjust(double thispitch);
+int  do_amp_instr_dur(double *thisamp,unsigned char *thisinstr,double *thisdur,
+         noteptr tsetnote,double thistime,dataptr dz);
+int  make_shadow(motifptr tset,int *shadowsize,noteptr **shadow);
+int  erase_shadow(int shadowsize,noteptr *shadow,motifptr tset);
+void setup_decor(double *pptop,double *ppbot,int *shadindex,noteptr *tsetnote,dataptr dz);
+int  setup_ornament
+         (double *timeadjust,double *thistime,int *gpsize,noteptr *phrlastnote,
+         double multiplier,noteptr *phrasenote,int phrno,dataptr dz);
+int  set_motif_amp
+         (noteptr tsetnote,double *thisamp,int gpsize,double ampstep,noteptr phrasenote,
+         double rangemult,double *phraseamp,int phrno,unsigned char amptype);
+int  set_ornament_amp
+         (double *phraseamp,noteptr *phrlastnote,double *thisamp,noteptr phrasenote,int phrno,
+         noteptr tsetnote,double ampstep,double rangemult,int gpsize,dataptr dz);
+int  set_group_params(noteptr tsetnote,noteptr thisnote,double gpdense,double ampstep,double *thisamp,
+        double *thistime,double thisdur,dataptr dz);
+int  check_next_phrasenote_exists(noteptr *phrasenote,int texflag,dataptr dz);
+noteptr getnextevent_to_decorate(noteptr tsetnote,int *shaddoindex,dataptr dz);
+double  getnotetime(noteptr phrasenote,double time,double multiplier,double timeadjust,dataptr dz);
+int     getmtfdur(noteptr tsetnote,noteptr phrasenote,double *dur,double multiplier,dataptr dz);
+int  orn_or_mtf_amp_setup
+        (int ampdirected,double *phrange,int phrno,double thisamp,int gpsize,double *rangemult,
+        double *ampstep,unsigned char *amptype,unsigned char amptypestor,unsigned char amptypecnt,dataptr dz);
+int  init_group_spatialisation
+        (noteptr tsetnote,int shaddoindex,noteptr *shadow,int shadowsize,dataptr dz);
+int  setspace(noteptr tsetnote,noteptr thisnote,int gpsize,dataptr dz);
+int  do_mtf_params
+         (noteptr thisnote,double thisamp,noteptr phrasenote,noteptr tsetnote,
+         double ampdif,double notetime,double multiplier,dataptr dz);
+int  setup_motif_or_ornament
+         (double thistime,double *multiplier,int *phrno,noteptr *phrasenote,
+         motifptr *phrase,dataptr dz);
+int  position_and_size_decoration
+         (double *thistime,double tsettime,double gpdense,int *gpsize,dataptr dz);
+int  set_decor_amp
+         (int ampdirected,double *thisamp,double *ampstep,int gpsize,unsigned char *amptype,
+         unsigned char amptypecnt,unsigned char amptypestor,dataptr dz);
+int  set_group_amp
+         (noteptr tsetnote,double *thisamp,unsigned char *amptype, double *ampstep,int gpsize,
+         unsigned char amptypecnt,unsigned char amptypestor,dataptr dz);
+int  getvalue(int paramhi,int paramlo,double time,int z,double *val,dataptr dz);
+int  igetvalue(int paramhi,int paramlo,double time,int z,int *ival,dataptr dz);
+int  doperm(int k,int pindex,int *val,dataptr dz);
+noteptr gethipitch(noteptr tsetnote,int *shaddoindex);
+int  do_grp_ins(unsigned char thisinstr,unsigned char *val,dataptr dz);
+int  pscatx(double range,double bottom,int pindex,double *val,dataptr dz);
+int  gettritype(int k,unsigned stor,unsigned char *val);
+int  get_density_val(double thistime,double *gpdense,dataptr dz);
+int  set_motifs(int phrcount,motifptr *phrase,int *phrnotecnt,double *phraseamp,
+                double *phrange,noteptr *phrlastnote);
+
+int  make_new_note(noteptr *thisnote);
+void del_note(noteptr thisnote,motifptr thismotif);
+int  arrange_notes_in_timeorder(motifptr mtf);
+
+int  do_texture(dataptr dz);
+int  do_simple_hftexture(dataptr dz);
+int  do_clumped_hftexture(dataptr dz);
+int  produce_texture_sound(dataptr dz);
+
+//int texture_pconsistency(dataptr dz);

+ 228 - 0
dev/include/tkglobals.h

@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/*******************************************************************************************
+ *      TO COMPILE TKLIB4 : COMMENT OUT (ONLY) the 2nd PAIR OF LINES BELOW
+ *      TO COMPILE CDPARSE: COMMENT OUT (ONLY) the 1st PAIR OF LINES BELOW
+ *******************************************************************************************/
+/*RWD we do ALL THIS at COMPILER LEVEL NOW! */
+/**
+#define IS_CDPMAIN              (1)
+#undef  IS_CDPARSE
+**/
+
+/**
+#define IS_CDPARSE              (1)
+#undef  IS_CDPMAIN
+**/
+/* RWD BUT: we can do this for convenience... */
+#ifndef IS_CDPARSE
+#define IS_CDPMAIN
+#endif
+
+/*******************************************************************************************/
+
+#include <math.h>
+#include <headread.h>
+#include <cdpstate.h>
+
+#define FAILED          (-1)    /* check with Ambrose ???? */
+#define SUCCEEDED       (0)             /* check with Ambrose ???? */
+
+
+/*******************************************************************************************
+ * COMPUTER SYSTEM
+ *******************************************************************************************/
+/*RWD: I want this confined to the library somehow... */
+#ifdef _WIN32
+#define IS_PC   (1)
+#endif
+
+#ifdef unix
+#define IS_UNIX (1)
+#define _MAX_PATH (255)
+#endif
+
+#if !defined IS_PC && !defined IS_UNIX
+#error CDP2K (tkglobals.h) Error: no platform defined
+#endif
+/*******************************************************************************************
+ * TYPE OF CDP OUTPUT: FOR CMDLINE OR SOUNDLOOM GRAPHIC INTERFACE
+ *******************************************************************************************/
+
+#ifdef IS_PC
+#ifdef _MSC_VER
+#pragma warning (disable : 4032)
+#pragma warning (disable: 4100)
+#pragma warning (disable: 4702)
+#endif
+#include <conio.h>                                      /* respond to keyboard */
+#endif
+
+
+#define F_SECSIZE       (256)
+
+#ifdef IS_CDPMAIN
+
+/*******************************************************************************************
+ * FUNCTIONS GLOBAL TO CDPARSE, CDPARAMS and CDPMAIN
+ *******************************************************************************************/
+
+#define NOT_SET (0)      /* Cannot be changed from 0, see modify-brasssage constants list */
+
+int  get_maxmode(int process);
+int  allocate_and_initialise_validity_flags(int **valid,int *validcnt);
+int  establish_application_validities(int filetype,int channels,int *valid);
+int  valid_application(int process,int *valid);
+int  assign_input_process_type(int process,int mode,int *inprocess_type);
+int  setup_input_param_range_stores(int total_params,aplptr ap);
+int  set_param_ranges(int process,int mode,double nyquist,float frametime,float arate,int srate,
+                                int wlength,int insams,int channels,int wanted,
+                                int filetype,int linecnt,double duration,aplptr ap);
+int      set_legal_param_structure(int process,int mode,aplptr ap);
+int      set_legal_option_and_variant_structure(int process,int mode,aplptr ap);
+void set_formant_flags(int process,int mode,aplptr ap);
+int  initialise_param_values(int process,int mode,int channels,double nyquist,float frametime,
+                int insams,int srate,int wanted,int linecnt,double duration,double *default_val,int filetype,aplptr ap);
+int  cdparse(char *filename,infileptr inputfile);
+int  setup_special_data_ranges(int mode,int srate,double duration,double nyquist,int wlength,int channels,aplptr ap);
+int readhead(infileptr inputfile,int ifd,char *filename,double *maxamp,double *maxloc, int *maxrep,int getmax,int getmaxinfo);
+
+int  is_a_valid_input_filetype(int filetype);
+int  is_a_valid_file_for_process(int filetype,int input_data_type);
+int  is_a_text_input_filetype(int filetype);
+int  is_a_textfile_type(int filetype);  /* after type conversion: not at input */
+int  could_be_transpos_and_or_pitch_infiletype(int filetype);
+int  is_brkfile_infiletype(int filetype);
+int  is_numlist_infiletype(int filetype);
+int  is_transpos_infiletype(int filetype);
+int  is_pitch_infiletype(int filetype);
+int  is_sndlist_only_infiletype(int filetype);
+void rectify_window(float *flbuf,dataptr dz);
+int      tkusage(int process,int mode);
+void print_outmessage(char *str);
+void print_outmessage_flush(char *str);
+void print_outwarning_flush(char *str);
+//TW NEW
+int  value_is_numeric(char *str);
+
+//TW NEW
+#define VOWEL_STRING            (-6)
+#define INTERVAL_STRING         (-5)
+#define NOTE_STRING                     (-4)
+#define REORDER_STRING          (-3)
+#define SHUFFLE_STRING          (-2)
+#define SNDFILENAME_STRING      (-1)
+
+/* data stored in TK */
+
+#define CDP_PROPS_CNT                           (34)
+
+#define INPUT_FILETYPE                          (0)
+#define INPUT_FILESIZE                          (1)
+#define INPUT_INSAMS                            (2)
+#define INPUT_SRATE                                     (3)
+#define INPUT_CHANNELS                          (4)
+#define INPUT_WANTED                            (5)
+#define INPUT_WLENGTH                           (6)
+#define INPUT_LINECNT                           (7)
+#define INPUT_ARATE                                     (8)
+#define INPUT_FRAMETIME                         (9)
+#define INPUT_NYQUIST                           (10)
+#define INPUT_DURATION                          (11)
+
+#define INPUT_STYPE                                     (12)
+#define INPUT_ORIGSTYPE                         (13)
+#define INPUT_ORIGRATE                          (14)
+#define INPUT_MLEN                                      (15)
+#define INPUT_DFAC                                      (16)
+#define INPUT_ORIGCHANS                         (17)
+#define INPUT_SPECENVCNT                        (18)
+#define INPUT_OUT_CHANS                         (19)
+#define INPUT_DESCRIPTOR_BYTES          (20)
+#define INPUT_IS_TRANSPOS                       (21)
+#define INPUT_COULD_BE_TRANSPOS         (22)
+#define INPUT_COULD_BE_PITCH            (23)
+#define INPUT_DIFFERENT_SRATES          (24)
+#define INPUT_DUPLICATE_SNDS            (25)
+#define INPUT_BRKSIZE                           (26)
+#define INPUT_NUMSIZE                           (27)
+#define INPUT_ALL_WORDS                         (28)
+#define INPUT_WINDOW_SIZE                       (29)
+#define INPUT_MINBRK                            (30)
+#define INPUT_MAXBRK                            (31)
+#define INPUT_MINNUM                            (32)
+#define INPUT_MAXNUM                            (33)
+
+//TW NEW
+#define BUF_MULTIPLIER  (20)    /* arbitrary size for moment */
+
+
+/* RWD ARRRRGH! CANNOT declare a var in a header file! I declare in dzsetup.c, so it goes in the library */
+/*unsigned int superzargo;*/    /* for timing involving several file-writes */
+extern unsigned int superzargo;
+
+#define NUMERICVAL_MARKER       '@'     /* MUST TALLY WITH TK CODE !! */
+void splice_multiline_string(char *str,char *prefix);
+#define PBAR_LENGTH                                     (256)
+
+void splice_multiline_string(char *str,char *prefix);
+
+#ifdef IS_UNIX
+#define FILE_JOINER             '/'
+#endif
+
+#ifdef IS_PC
+#define FILE_JOINER             '\\'
+#endif
+
+/*******  RWD we don't support old MacOS!
+#ifdef IS_MAC
+#define FILE_JOINER             ':'
+#endif
+*******/
+int redefine_textfile_types(dataptr dz);
+int strgetfloat(char **str,double *val);
+//TW NEW
+int strgetfloat_within_string(char **str,double *val);
+void get_other_filename(char *filename,char c);
+int close_and_delete_tempfile(char *filename,dataptr dz);
+int smpflteq(double f1,double f2);
+#define SMP_FLTERR 0.0000005            /* zero (within error) for samprate of 200000 or below */
+void insert_new_number_at_filename_end(char *filename,int num,int overwrite_last_char);
+void insert_new_chars_at_filename_end(char *filename,char * str);
+void replace_filename_extension(char *filename,char *ext);
+void delete_filename_lastchar(char *filename);
+void reset_file_params_for_sndout(int *orig_proctype,int *orig_srate,
+        int *orig_chans,int *orig_stype,dataptr dz);
+int reset_peak_finder(dataptr dz);
+int establish_peak_status(dataptr dz);
+#endif
+//TW names reflecting new status of these data items
+#define CDP_SOUND               SAMP_SHORT
+#define CDP_NONSOUND    SAMP_FLOAT
+
+void copy_to_fileptr(infileptr i, fileptr f);

+ 204 - 0
dev/include/txtucon.h

@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+/******************************** TEXTURE ******************************/
+
+/* CONSTANTS FOR TEXTURE */
+#define TEXTURE_MIN_DUR   (0.01)
+#define TEXTURE_MAX_DUR   (1.0)
+#define MAX_PACKTIME      (60.0)
+#define DENSITY_DEFAULT   (0.1)
+#define DEFAULT_SKIP      (0.25)
+#define MAX_SCAT_TEXTURE  (10.0)
+#define EIGHT_8VA_UP      (96.0)
+#define EIGHT_8VA_DOWN    (-96.0)
+#define DEFAULT_TEXDUR    (4.0)
+#define DEFAULT_TEXDENS   (10.0)
+#define DEFAULT_TEXSCAT   (0.5)
+#define MIN_MULT                  (0.01)
+#define MAX_MULT                  (100.0)
+#define TEXTURE_SPLICELEN (15.0)        /* 15 MS */
+#define TEXTURE_SAFETY    (1.0)         /* 1 MS: min snd-dur between splices */
+#define TEXTURE_DEFAULT_DUR (10.0)
+#define DEFAULT_PITCH     (60.0)        /* middle C */
+#define DEFAULT_HF_GPRANGE        (8.0)
+#define DEFAULT_GPSIZE    (4.0)
+#define HALF_OCTAVE               (6.0)
+#define TEX_CENTRE        (0.5)
+#define TEX_LEFT                  (0.0)
+#define TEX_RIGHT             (1.0)
+#define MAX_SPREAD                (1.0)
+
+#define MAX_GPRANGE               (128.0)
+
+#define TEXTURE_SEPARATOR ('#') /* Character in notedata file to indicate next motif */
+
+/************************* MAX ELEMENT-REPETITIONS ALLOWED IN PERMS *************************/
+
+#define SPACE_REPETS   (2)      /* for param PM_SPACE   */
+#define PITCH_REPETS   (1)      /* for param PM_PITCH   */
+#define AMP_REPETS         (1)  /* for param PM_AMP             */
+#define DUR_REPETS         (1)  /* for param PM_DUR             */
+#define INSNO_REPETS   (2)      /* for param PM_INSNO   */
+#define GPRANG_REPETS  (1)      /* for param PM_GPRANG  */
+#define GPSIZE_REPETS  (1)      /* for param PM_GPSIZE  */
+#define GPDENS_REPETS  (1)      /* for param PM_GPDENS  */
+#define GPCNTR_REPETS  (2)      /* for param PM_GPCNTR  */
+#define GPPICH_REPETS  (1)      /* for param PM_GPPICH  */
+#define ORNPOS_REPETS  (2)      /* for param PM_ORNPOS  */
+#define GPSPAC_REPETS  (1)      /* for param PM_GPSPAC  */
+#define ORIENT_REPETS  (1)      /* for param PM_ORIENT  */
+#define DECABV_REPETS  (1)      /* for param PM_DECABV  */
+#define MULT_REPETS    (1)      /* for param PM_MULT    */
+#define WHICH_REPETS   (1)      /* for param PM_WHICH   */
+#define GPPICH2_REPETS (1)      /* for param PM_GPPICH2 */
+
+/* CONSTANTS connected with these same permutation functions */
+
+#define PM_SPACE        (0)             /* L/R decision on events   :                           Oldname NOUGHT   */
+#define PM_PITCH        (1)             /* PITCH              of events :                               Oldname ONE              */
+#define PM_AMP          (2)             /* AMPLITUDE      of events :                           Oldname TWO              */
+#define PM_DUR          (3)             /* DURATION       of events :                           Oldname THREE    */
+#define PM_INSNO        (4)             /* INSTR_NO       of events :                           Oldname FOUR     */
+#define PM_GPRANG       (5)             /* RANGE                  of group  :                   Oldname FIVE     */
+#define PM_GPSIZE       (6)             /* SIZE                   of group  :                   Oldname SIX              */
+#define PM_GPDENS       (7)             /* DENSITY (notedur)  of group  :                       Oldname SEVEN    */
+#define PM_GPCNTR       (8)             /* SELECT AMP CONTOUR of group  :                       Oldname EIGHT    */
+#define PM_GPPICH       (9)             /* PITCH OF NOTE    in a group  :                       Oldname NINE     */
+#define PM_ORNPOS       (10)    /* PRE- or POST-      ornament  :                       Oldname TEN              */
+#define PM_GPSPAC       (11)    /* SPATIALISE NOTE  in a group  :                       Oldname ELEVEN   */
+#define PM_ORIENT       (12)    /* SELECT RANGE ORIENTATION of decoration   Oldname TWELVE   */
+#define PM_DECABV       (13)    /* SELECT ABOVE/BELOW of centred dec. notes Oldname THIRTEEN */
+#define PM_MULT         (14)    /* MULTIPLIER for duration motifs/ornmnts   Oldname FOURTEEN */
+#define PM_WHICH        (15)    /* Select which motif to use as m or ornmnt Oldname FIFTEEN  */
+#define PM_GPPICH2      (16)    /* as 9 for other half of centred HF  group Oldname SIXTEEN  */
+
+#define DECOR_FIRST             (0)
+#define DECOR_HIGHEST   (1)
+#define DECOR_EVERY             (2)
+
+/************************* TEXTURE PARAMETERS ******************************/
+
+/* SIMPLE_TEX           (0)                00000000 00000000 */
+#define ISPRE_DECORORN  (1)             /* -------- -------1 */
+#define ISPOST_DECORORN (2)             /* -------- ------1- */
+#define IS_HS           (4)             /* -------- -----1-- */
+#define ISMANY_HFLDS    (8)             /* -------- ----1--- */
+#define IS_GROUPS       (16)    /* -------- ---1---- */
+#define IS_DECOR        (32)    /* -------- --1----- */
+#define IS_MOTIFS       (64)    /* -------- -1------ */
+#define IS_ORNATE       (128)   /* -------- 1------- */
+#define MOTIF_IN_HF             (256)   /* -------1 -------- */
+#define ISTIMED                 (512)   /* ------1- -------- */
+#define ISHARM          (1024)  /* -----1-- -------- */
+
+#define GET_DECORNPOS   (3)             /* -------- ------11 */
+
+#define IS_CLUMPED      (0xF0)  /* -------- 1111---- */
+#define IS_DEC_OR_GRP   (0x30)  /* -------- --11---- */
+#define IS_MTF_OR_GRP   (0x50)  /* -------- -1-1---- */
+#define IS_ORN_OR_DEC   (0xA0)  /* -------- 1-1----- */
+#define ORN_DEC_OR_TIMED (0x2A0)/* ------1- 1-1----- */
+#define IS_ORNDEC_OR_MTF (0xE0) /* -------- 111----- */
+#define IS_ORN_OR_MTF   (0xC0)  /* -------- 11------ */
+
+
+extern  int texflag;            /* bitflag for type of texture */
+
+
+#define MAXNAMECNT      (9)
+
+/* AMPLITUDE TYPES SPECIFIED BY USER */
+
+#define IS_MIXED                         (0)
+#define IS_CRESC                         (1)
+#define IS_FLAT                          (2)
+#define IS_DECRESC                       (3)
+#define IS_FLAT_AND_CRESC        (4)
+#define IS_CRESC_AND_DECRESC (5)
+#define IS_FLAT_AND_DECRESC      (6)
+#define IS_DIRECTIONAL           (7)
+#define IS_DIREC_OR_FLAT         (8)
+
+/* AMPLITUDE TYPES RETURNED FROM GETAMPTYPE */
+
+#define FLAT    (0)
+#define CRESC   (1)
+#define DECRESC (2)
+
+#define IS_STILL                (0)
+#define IS_SCATTER              (1)
+#define IS_INWARD               (2)
+#define IS_OUTWARD              (3)
+#define IS_FOLLOWING    (4)
+#define IS_CONTRARY             (5)
+#define IS_DIRECTED(x)  ((x)==IS_FOLLOWING || (x)==IS_CONTRARY)
+
+        /* INTERNAL FLAGS */
+#define INTERNAL_FLAGS_CNT                (2) /* COUNT OF FLAGS BELOW */
+
+#define IS_PRE           (7) /* flags decorations precede decd notes (default) POST */
+#define DECCENTRE                (8) /* flags decorations etc are centred on tset-pitch  */
+
+
+
+
+#define PERMCNT                 (17)    /* number of permutation options, see texture0.h */
+
+/* For more readable code  WHICH_CHORDNOTE */
+/* Externally (to user) FORCEHI flag selects HIGH (as against FIRST) note */
+/* Internally that flag can have 3 vals (FIRST,HIGHEST,EVERY..NOTE) */
+/* So the NEW, more informative, name is used internally */
+
+/******* GLOBAL VALUES ****/
+
+#define MIDITOP         (127.0)            /* Maximum pitch midi note     */
+#define MIDIBOT         (1.0)              /* Minimum pitch midi note     */
+
+#define BANDCNT         (5) /* no.of range-bands each param divided into, for randperms */
+#define LAYERCNT        (8) /* for weighted bands, there are 8 equal layers
+                                                        band 1 = layer 1:
+                                                        band 2 = layers 2 & 3:
+                                                        band 3 = layers 4 & 5:
+                                                        band 4 = layers 6 & 7:
+                                                        band 5 = layer 8:
+                                                */
+#define LOW_A           (6.875)            /* Frequency of A below MIDI 0 */
+
+
+/* HOW DECORATION PITCHES CENTRE ON DECORATED LINE PITCHES */
+
+#define DEC_CENTRED     (0)
+#define DEC_ABOVE               (1)
+#define DEC_BELOW               (2)
+#define DEC_C_A                 (3)
+#define DEC_C_B                 (4)
+#define DEC_A_B                 (5)
+#define DEC_C_A_B               (6)
+
+#define TEXTURE_MAX_SKIP                (100.0)
+#define TEXTURE_MAX_TGRID               (10000.0)
+#define TEXTURE_MAX_PHGRID              (1000.0)

+ 27 - 0
dev/include/utils.h

@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define IS_GROUCHO_COMPILE      (1)

+ 186 - 0
dev/include/vowels.h

@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define VOWEL_EE        (1)
+#define VOWEL_I         (2)
+#define VOWEL_AI        (3)
+#define VOWEL_E         (4)
+#define VOWEL_A         (5)
+#define VOWEL_AR        (6)
+#define VOWEL_O         (7)
+#define VOWEL_OR        (8)
+#define VOWEL_U         (9)
+#define VOWEL_XX        (10)
+#define VOWEL_X         (11)
+#define VOWEL_OO        (12)
+#define VOWEL_OA        (13)
+#define VOWEL_AII       (14)    /* scottish 'ai' as in educAted */
+#define VOWEL_UU        (15)    /* scottish edUcated, or 'you' : near german Uber */
+#define VOWEL_N         (16)    /* 'n' */
+#define VOWEL_UI        (17)    /* scottish 'could' */
+#define VOWEL_M         (18)    /* 'm' */
+#define VOWEL_R         (19)    /* 'r' on neutral vowel */
+#define VOWEL_TH        (20)    /* 'r' on neutral vowel */
+
+/* heed  */
+#define EE_FORMANT1     (300)
+#define EE_FORMANT2     (2600)
+#define EE_FORMANT3     (2800)
+#define EE_F2ATTEN              (0.85)
+#define EE_F3ATTEN              (0.85)
+
+/* hid   */
+#define I_FORMANT1              (360)
+#define I_FORMANT2              (2100)
+#define I_FORMANT3              (2300)
+#define I_F2ATTEN               (1.0)
+#define I_F3ATTEN               (1.0)
+
+/* scottish educAted  */
+#define AII_FORMANT1    (500)
+#define AII_FORMANT2    (2250)
+#define AII_FORMANT3    (2450)
+#define AII_F2ATTEN     (.92)
+#define AII_F3ATTEN     (0.25)
+
+/* laid  */
+#define AI_FORMANT1     (465)
+#define AI_FORMANT2     (2250)
+#define AI_FORMANT3     (2450)
+#define AI_F2ATTEN              (.92)
+#define AI_F3ATTEN              (0.25)
+
+/* head  */
+#define E_FORMANT1              (570)
+#define E_FORMANT2              (1970)
+#define E_FORMANT3              (2450)
+#define E_F2ATTEN               (1.0)
+#define E_F3ATTEN               (0.75)
+
+/* had   */
+#define A_FORMANT1              (750)
+#define A_FORMANT2              (1550)
+#define A_FORMANT3              (2450)
+#define A_F2ATTEN               (1.0)
+#define A_F3ATTEN               (0.85)
+
+/* hard  */
+#define AR_FORMANT1     (680)
+#define AR_FORMANT2     (1100)
+#define AR_FORMANT3     (2450)
+#define AR_F2ATTEN              (1.0)
+#define AR_F3ATTEN              (0.92)
+
+/* hod */
+#define O_FORMANT1              (600)
+#define O_FORMANT2              (900)
+#define O_FORMANT3              (2450)
+#define O_F2ATTEN               (1.0)
+#define O_F3ATTEN               (0.5)
+
+/* horde */
+#define OR_FORMANT1     (450)
+#define OR_FORMANT2     (860)
+#define OR_FORMANT3     (2300)
+#define OR_F2ATTEN              (1.0)
+#define OR_F3ATTEN              (0.82)
+
+/* coke (North England) */
+#define OA_FORMANT1     (410)
+#define OA_FORMANT2     (810)
+#define OA_FORMANT3     (2300)
+#define OA_F2ATTEN              (1.0)
+#define OA_F3ATTEN              (0.82)
+
+/* hood : mud (North England) */
+#define U_FORMANT1              (380)
+#define U_FORMANT2              (850)
+#define U_FORMANT3              (2100)
+#define U_F2ATTEN               (1.0)
+#define U_F3ATTEN               (0.6)
+
+/* scottish 'you'  */
+#define UU_FORMANT1     (380)
+#define UU_FORMANT2     (850)
+#define UU_FORMANT3     (2800)
+#define UU_F2ATTEN              (0.85)
+#define UU_F3ATTEN              (0.85)
+
+/* scottish could  */
+#define UI_FORMANT1     (380)
+#define UI_FORMANT2     (1000)
+#define UI_FORMANT3     (2450)
+#define UI_F2ATTEN              (.92)
+#define UI_F3ATTEN              (0.25)
+
+/* mood */
+#define OO_FORMANT1     (300)
+#define OO_FORMANT2     (850)
+#define OO_FORMANT3     (2100)
+#define OO_F2ATTEN              (1.0)
+#define OO_F3ATTEN              (0.6)
+
+/* (hub : South England) */
+#define XX_FORMANT1     (720)
+#define XX_FORMANT2     (1240)
+#define XX_FORMANT3     (2300)
+#define XX_F2ATTEN              (0.85)
+#define XX_F3ATTEN              (0.3)
+
+/* herd  */
+#define X_FORMANT1              (580)
+#define X_FORMANT2              (1380)
+#define X_FORMANT3              (2450)
+#define X_F2ATTEN               (1.0)
+#define X_F3ATTEN               (0.5)
+
+/* n  */
+#define N_FORMANT1              (580)
+#define N_FORMANT2              (1380)
+#define N_FORMANT3              (2625)
+#define N_F2ATTEN               (0.0)
+#define N_F3ATTEN               (0.1)
+
+/* m  */
+#define M_FORMANT1              (580)
+#define M_FORMANT2              (850)
+#define M_FORMANT3              (2100)
+#define M_F2ATTEN               (0.0)
+#define M_F3ATTEN               (0.0)
+
+/* r  */
+#define R_FORMANT1              (880)
+#define R_FORMANT2              (2100)
+#define R_FORMANT3              (2450)
+#define R_F2ATTEN               (0.2)
+#define R_F3ATTEN               (0.0)
+
+/* th  */
+#define TH_FORMANT1     (400)
+#define TH_FORMANT2     (1000) /* 880 */
+#define TH_FORMANT3     (2450)
+#define TH_F2ATTEN              (0.3) /* 0.3 */
+#define TH_F3ATTEN              (0.2)

+ 30 - 0
dev/include/vowels2.h

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
+ * http://www.trevorwishart.co.uk
+ * http://www.composersdesktop.com
+ *
+ This file is part of the CDP System.
+
+    The CDP System is free software; you can redistribute it
+    and/or modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    The CDP System is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with the CDP System; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+    02111-1307 USA
+ *
+ */
+
+
+
+#define V_HWIDTH                 (.25)  /* hwidth of formants (in Hz) as fraction of their centre-frq */
+#define CURVIT                   (3)    /* formant slope */
+#define PEAK_RANGE               (.95)  /* proportion of signal taken up by formant peaking */
+#define FUNDAMENTAL_BASE (.45)  /* level of fundamental if not in formant */