speccon.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd
  3. * http://www.trevorwishart.co.uk
  4. * http://www.composersdesktop.com
  5. *
  6. This file is part of the CDP System.
  7. The CDP System is free software; you can redistribute it
  8. and/or modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The CDP System is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the CDP System; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18. 02111-1307 USA
  19. *
  20. */
  21. /******************* SPEC ***************/
  22. #define SPEC_MINFRQ (10.0)
  23. #define PITCHZERO (SPEC_MINFRQ/2.0)
  24. #define SIGNOIS_MAX (1000.0)
  25. /* Constant vals for SPEC ARPE */
  26. #define DOWNRAMP (1)
  27. #define SIN (2)
  28. #define SAW (3)
  29. #define UPRAMP (4)
  30. #define ARPE_TABSIZE (1024)
  31. #define AP_NORMAL (0)
  32. #define AP_SUSTAIN_PITCH (1)
  33. #define AP_LIMIT_SUSTAIN (2)
  34. #define AP_SUSTAIN_PITCH_AND_LIMIT_SUSTAIN (3)
  35. #define AP_NONLIN (4)
  36. #define AP_NONLIN_AND_SUSTAIN_PITCH (5)
  37. #define AP_NONLIN_AND_LIMIT_SUSTAIN (6)
  38. #define AP_NONLIN_AND_SUSTAIN_PITCH_AND_LIMIT_SUSTAIN (7)
  39. /* constants for SPEC CHORD */
  40. #define CHD_NORMAL (0)
  41. /* change JAN 1998 ****
  42. #define CHD_FULLER (1)
  43. */
  44. /* change JAN 1998 ****/
  45. #define CHD_LESSFUL (1)
  46. /* Constant vals for SPEC CHORUS */
  47. #define A_FIX (1) /* 0001 */
  48. #define A_VAR (2) /* 0010 */
  49. #define F_FIX (4) /* 0100 */
  50. #define F_VAR (8) /* 1000 */
  51. #define AF_FIX (5) /* 0101 */
  52. #define AF_VAR (10) /* 1010 */
  53. #define A_FIX_F_VAR (9) /* 1001 */
  54. #define A_VAR_F_FIX (6) /* 0110 */
  55. #define IS_A (3) /* 0011 */
  56. #define IS_F (12) /* 1100 */
  57. #define BOTH_ACCESSES_OF_RANDTABLE_REACH_END_TOGETHER (0)
  58. #define FIRST_ACCESS_OF_RANDTABLE_REACHES_END_FIRST (1)
  59. #define SECOND_ACCESS_OF_RANDTABLE_REACHES_END_FIRST (2)
  60. /* constants for SPEC CROSS */
  61. #define CROS_FULL (0)
  62. #define CROS_INTERP (1)
  63. /* constant values for SPEC FMNTSEE */
  64. #define SPACER (4) /* gap left between formants in pseudosnd-display */
  65. /* constant values for FOCUS and REPORT */
  66. #define MAXPKCNT (16) /* max number of peaks for FOCU */
  67. #define MAXSTABIL (4097) /* max value of stabl in FOCU */
  68. /* constants for SPEC FREEZE */
  69. #define FRZ_BEFORE (-1)
  70. #define FRZ_LIMIT (0)
  71. #define FRZ_AFTER (1)
  72. /* constants for SPEC GLIS */
  73. #define GLIS_SHIFT_DEFAULT (50.0)
  74. #define GLIS_REFERENCE_FRQ (dz->chwidth * 2.0)
  75. /* Constant vals for SPEC MORPH */
  76. #define MPH_COSTABSIZE (512)
  77. /* constant values for SPEC P_APPROX */
  78. #define BLOKCNT (4)
  79. /* constant values for P_FIX */
  80. #define IS_HIPASS (1)
  81. #define IS_LOPASS (2)
  82. #define IS_BANDPASS (3)
  83. /* constant values for P_INVERT and SPEC P_RANDOMISE */
  84. #define MAXINTRANGE (96.0)
  85. /* constant values for SPEC P_VIBRATO */
  86. #define P_TABSIZE (256)
  87. /* Constant values for SPEC PITCH and SPEC TRACK */
  88. #define EIGHTH_TONE (1.014545335) /* tuning tolerance for data-reduction in pitch brkpnt files */
  89. #define SILENCE_RATIO (80.0) /* 80dB signal-to-noise ratio */
  90. #define BLIPLEN (2) /* Max no adj pitched windows needed to confirm a pitch */
  91. #define MAXIMI (8) /* Number of loudest-spectral-peaks-per-window to test */
  92. #define ACCEPTABLE_MATCH (5) /* Number of MAXIMI which must be harmonics */
  93. #define PARTIALS_IN_TEST_TONE (6)
  94. #define PARTIAL_DECIMATION (.25)
  95. #define CHANSCAN (8) /* Number of adjacent chans to search for a frq that */
  96. /* should be in current channel */
  97. #define PEAKSCAN (2)
  98. #define MAXHARM (8) /* Max harmonic than can be lowest (signif) partial */
  99. /* in a pitched sound */
  100. /* constant values for SPEC REPITCH */
  101. #define DEFAULT_FRAMETIME (0.002F) /* default for REPITCH with no binary files in */
  102. /* Constant vals for SPEC SPLIT */
  103. #define ASCTOINT (-48)
  104. #define DO_AMPLITUDE_CHANGE (3) /* 0011 */
  105. #define DO_RAMPED_AMPLITUDE (2) /* 0010 */
  106. #define DO_TRANSPOSITION (4) /* 0100 */
  107. #define DO_ADD_TO_SPECTRUM (8) /* 1000 */
  108. /* constant values for SPEC WARP */
  109. #define WARP_MININT (1.0) /* min interval for pitch to be marked as moving: semitones */
  110. #define CHANSPAN (4) /* frq can lie +- 4 channels outside the expected channel for that frq */
  111. #define BLOKCNT (4)
  112. #define WCHTOP (4)
  113. #define WCHBOT (5)
  114. /* constants usd in get_statechanges() */
  115. #define IS_FRQ (0)
  116. #define IS_PITCH (1)
  117. #define DEFAULT_NYQUIST (10000) /* Fudge to allow brkpnt pitchdata to be tested */
  118. #define DEFAULT_OCTBANDS (10) /* octvu */
  119. /************** CONSTANTS FOR DEFINING RANGES *****************/
  120. #define CHORU_MAXAMP (1028.0)
  121. #define CHORU_MINAMP (1.0)
  122. #define CHORU_MAXFRQ (4.0)
  123. #define CHORU_MINFRQ (1.0)
  124. #define OCT_MAX_HMOVE (4096.0) /* frq ratio for 12 octs OCT */
  125. #define MINFWINDOW (0.2) /* minimum frq window for PEAK (semitones) */
  126. #define MINTSTR (0.0001) /* min timestretch val for TSTRETCH */
  127. #define MAXTSTR (10000.0) /* max timestretch val for TSTRETCH */
  128. #define MAXPRANGE (96.0) /* max pitch-variation in WARP */
  129. #define MAXSMOOTH (100.0) /* max number of smoothings in P_FIX : arbitrary!! */
  130. #define MAXGLISRATE (0.0625) /* approx 1/16th octave per window */
  131. #define DEFAULT_STABILITY (9) /* default value of stabl in FOCU */
  132. #define DEFAULT_TWINDOW (.1)
  133. #define DEFAULT_FWINDOW (6.0)
  134. #define DEFAULT_SRANGE (0.1 * SECS_TO_MS) /* time (secs) to scan pitch-contour. Rise by semitone */
  135. /* over SRANGE indicates rising pitch-contour */
  136. #define DEFAULT_PRANGE (0.38) /* >third_tone: pitch mistuning allowed in approx_pitch */
  137. #define DEFAULT_TRANGE (0.05 * SECS_TO_MS)
  138. #define DEFAULT_NOISEGAIN (2.0)
  139. #define DEFAULT_ARPE_SUSTAIN (3.0)
  140. #define DEFAULT_ARPE_AMPLIF (10.0)
  141. #define DEFAULT_AVRG (13.0)
  142. #define DEFAULT_CHORU_AMPSPREAD (2.0)
  143. #define DEFAULT_CHORU_FRQSPREAD (1.1)
  144. #define DEFAULT_MAX_DRUNK_STEP (32.0)
  145. #define DEFAULT_EXAG (2.0)
  146. #define DEFAULT_FILT_FRQ (CONCERT_A)
  147. #define DEFAULT_Q (20.0)
  148. #define DEFAULT_OCTAVE_BWIDTH (0.333333) /* Third Octave Band */
  149. #define DEFAULT_GLISRATE (1.0)
  150. #define DEFAULT_DURATION (2.0)
  151. #define DEFAULT_GRABTIME (duration/2.0)
  152. #define DEFAULT_WINDOW_STEP (16.0)
  153. #define DEFAULT_TIME_STEP (DEFAULT_WINDOW_STEP * frametime * SECS_TO_MS)
  154. #define DEFAULT_STEP (0.25)
  155. #define DEFAULT_SLEW (1.0001)
  156. #define DEFAULT_VIBRATO_FRQ (8.0)
  157. #define DEFAULT_VIBRATO_RANGE (0.333333)
  158. #define DEFAULT_TRACE (16.0)
  159. #define DEFAULT_BLUR (16.0)
  160. #define DEFAULT_OCT_TRANSPOS (2.0)
  161. #define CONCERT_A (440.0)
  162. #define CONCERT_A_MIDI (69.0)
  163. /******* SPEC TRNSF : TRNSP ******/
  164. #define MIN_TRANSPOS (0.00383) /* 8 octaves dn */
  165. #define MAX_TRANSPOS (256.0) /* 8 octaves up */
  166. #define DEFAULT_TRANSPOS (1.0)
  167. #define ARPE_MAX_AMPL (10000.0)
  168. #define ARPE_MIN_NONLIN (0.02)
  169. #define ARPE_MAX_NONLIN (50.0)
  170. #define CL_MAX_GAIN (40.0)
  171. #define PH_MAX_GAIN (40.0)
  172. #define FILT_MAX_PG (10000.0)
  173. #define GAIN_MAX_GAIN (10000.0)
  174. #define FORM_MAX_GAIN (40.0)
  175. #define MPH_MIN_EXP (0.02)
  176. #define MPH_MAX_EXP (50.0)
  177. #define OCT_MAX_BREI (50.0)
  178. #define PEX_MAX_RANG (128.0)
  179. #define PR_MIN_SLEW (0.02)
  180. #define PR_MAX_SLEW (50.0)
  181. #define PSEE_MAX_SCF (10000.0)
  182. #define PW_MIN_DRED (.00002)
  183. #define PW_MAX_DRED (12.0)
  184. #define PLUK_MAX_GAIN (1000.0)
  185. #define STR_MIN_EXP (0.02)
  186. #define STR_MAX_EXP (50.0)
  187. #define VOCO_MAX_GAIN (10.0)
  188. #define WAVER_MIN_EXP (0.02)
  189. #define WAVER_MAX_EXP (50.0)
  190. #define ACCU_MIN_DECAY (0.001)
  191. #define SPEC_MAXOCTS (8.0)
  192. int is_harmonic(int *iratio,double frq1, double frq2);