Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

868 lines
49KB

  1. #ifndef CLM_H
  2. #define CLM_H
  3. #define MUS_VERSION 6
  4. #define MUS_REVISION 13
  5. #define MUS_DATE "5-Aug-15"
  6. /* isn't mus_env_interp backwards? */
  7. #include "sndlib.h"
  8. #ifndef _MSC_VER
  9. #include <sys/param.h>
  10. #endif
  11. #if HAVE_COMPLEX_TRIG
  12. #include <complex.h>
  13. #endif
  14. #if(!defined(M_PI))
  15. #define M_PI 3.14159265358979323846264338327
  16. #define M_PI_2 (M_PI / 2.0)
  17. #endif
  18. #define MUS_DEFAULT_SAMPLING_RATE 44100.0
  19. #define MUS_DEFAULT_FILE_BUFFER_SIZE 8192
  20. #define MUS_DEFAULT_ARRAY_PRINT_LENGTH 8
  21. typedef enum {MUS_NOT_SPECIAL, MUS_SIMPLE_FILTER, MUS_FULL_FILTER, MUS_OUTPUT, MUS_INPUT, MUS_DELAY_LINE} mus_clm_extended_t;
  22. typedef struct mus_any_class mus_any_class;
  23. typedef struct {
  24. struct mus_any_class *core;
  25. } mus_any;
  26. typedef enum {MUS_INTERP_NONE, MUS_INTERP_LINEAR, MUS_INTERP_SINUSOIDAL, MUS_INTERP_ALL_PASS,
  27. MUS_INTERP_LAGRANGE, MUS_INTERP_BEZIER, MUS_INTERP_HERMITE} mus_interp_t;
  28. typedef enum {MUS_RECTANGULAR_WINDOW, MUS_HANN_WINDOW, MUS_WELCH_WINDOW, MUS_PARZEN_WINDOW, MUS_BARTLETT_WINDOW,
  29. MUS_HAMMING_WINDOW, MUS_BLACKMAN2_WINDOW, MUS_BLACKMAN3_WINDOW, MUS_BLACKMAN4_WINDOW,
  30. MUS_EXPONENTIAL_WINDOW, MUS_RIEMANN_WINDOW, MUS_KAISER_WINDOW, MUS_CAUCHY_WINDOW, MUS_POISSON_WINDOW,
  31. MUS_GAUSSIAN_WINDOW, MUS_TUKEY_WINDOW, MUS_DOLPH_CHEBYSHEV_WINDOW, MUS_HANN_POISSON_WINDOW,
  32. MUS_CONNES_WINDOW, MUS_SAMARAKI_WINDOW, MUS_ULTRASPHERICAL_WINDOW,
  33. MUS_BARTLETT_HANN_WINDOW, MUS_BOHMAN_WINDOW, MUS_FLAT_TOP_WINDOW,
  34. MUS_BLACKMAN5_WINDOW, MUS_BLACKMAN6_WINDOW, MUS_BLACKMAN7_WINDOW, MUS_BLACKMAN8_WINDOW, MUS_BLACKMAN9_WINDOW, MUS_BLACKMAN10_WINDOW,
  35. MUS_RV2_WINDOW, MUS_RV3_WINDOW, MUS_RV4_WINDOW, MUS_MLT_SINE_WINDOW, MUS_PAPOULIS_WINDOW, MUS_DPSS_WINDOW, MUS_SINC_WINDOW,
  36. MUS_NUM_FFT_WINDOWS} mus_fft_window_t;
  37. typedef enum {MUS_SPECTRUM_IN_DB, MUS_SPECTRUM_NORMALIZED, MUS_SPECTRUM_RAW} mus_spectrum_t;
  38. typedef enum {MUS_CHEBYSHEV_EITHER_KIND, MUS_CHEBYSHEV_FIRST_KIND, MUS_CHEBYSHEV_SECOND_KIND, MUS_CHEBYSHEV_BOTH_KINDS} mus_polynomial_t;
  39. #define MUS_MAX_CLM_SINC_WIDTH 65536
  40. #define MUS_MAX_CLM_SRC 65536.0
  41. /* this is internal -- for clm->clm2xen */
  42. typedef struct {
  43. mus_any_class *core;
  44. int chan;
  45. mus_long_t loc;
  46. char *file_name;
  47. int chans;
  48. mus_float_t **obufs;
  49. mus_float_t *obuf0, *obuf1;
  50. mus_long_t data_start, data_end;
  51. mus_long_t out_end;
  52. mus_sample_t output_sample_type;
  53. mus_header_t output_header_type;
  54. } rdout;
  55. /* end internal stuff */
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59. MUS_EXPORT void mus_initialize(void);
  60. MUS_EXPORT int mus_make_generator_type(void);
  61. MUS_EXPORT mus_any_class *mus_generator_class(mus_any *ptr);
  62. MUS_EXPORT mus_any_class *mus_make_generator(int type, char *name,
  63. void (*release)(mus_any *ptr),
  64. char *(*describe)(mus_any *ptr),
  65. bool (*equalp)(mus_any *gen1, mus_any *gen2));
  66. MUS_EXPORT void mus_generator_set_length(mus_any_class *p, mus_long_t (*length)(mus_any *ptr));
  67. MUS_EXPORT void mus_generator_set_scaler(mus_any_class *p, mus_float_t (*scaler)(mus_any *ptr));
  68. MUS_EXPORT void mus_generator_set_channels(mus_any_class *p, int (*channels)(mus_any *ptr));
  69. MUS_EXPORT void mus_generator_set_location(mus_any_class *p, mus_long_t (*location)(mus_any *ptr));
  70. MUS_EXPORT void mus_generator_set_set_location(mus_any_class *p, mus_long_t (*set_location)(mus_any *ptr, mus_long_t loc));
  71. MUS_EXPORT void mus_generator_set_channel(mus_any_class *p, int (*channel)(mus_any *ptr));
  72. MUS_EXPORT void mus_generator_set_file_name(mus_any_class *p, char *(*file_name)(mus_any *ptr));
  73. MUS_EXPORT void mus_generator_set_extended_type(mus_any_class *p, mus_clm_extended_t extended_type);
  74. MUS_EXPORT void mus_generator_set_read_sample(mus_any_class *p, mus_float_t (*read_sample)(mus_any *ptr, mus_long_t samp, int chan));
  75. MUS_EXPORT void mus_generator_set_feeders(mus_any *g,
  76. mus_float_t (*feed)(void *arg, int direction),
  77. mus_float_t (*block_feed)(void *arg, int direction, mus_float_t *block, mus_long_t start, mus_long_t end));
  78. MUS_EXPORT void mus_generator_copy_feeders(mus_any *dest, mus_any *source);
  79. MUS_EXPORT mus_float_t mus_radians_to_hz(mus_float_t radians);
  80. MUS_EXPORT mus_float_t mus_hz_to_radians(mus_float_t hz);
  81. MUS_EXPORT mus_float_t mus_degrees_to_radians(mus_float_t degrees);
  82. MUS_EXPORT mus_float_t mus_radians_to_degrees(mus_float_t radians);
  83. MUS_EXPORT mus_float_t mus_db_to_linear(mus_float_t x);
  84. MUS_EXPORT mus_float_t mus_linear_to_db(mus_float_t x);
  85. MUS_EXPORT mus_float_t mus_odd_multiple(mus_float_t x, mus_float_t y);
  86. MUS_EXPORT mus_float_t mus_even_multiple(mus_float_t x, mus_float_t y);
  87. MUS_EXPORT mus_float_t mus_odd_weight(mus_float_t x);
  88. MUS_EXPORT mus_float_t mus_even_weight(mus_float_t x);
  89. MUS_EXPORT mus_float_t mus_srate(void);
  90. MUS_EXPORT mus_float_t mus_set_srate(mus_float_t val);
  91. MUS_EXPORT mus_long_t mus_seconds_to_samples(mus_float_t secs);
  92. MUS_EXPORT mus_float_t mus_samples_to_seconds(mus_long_t samps);
  93. MUS_EXPORT int mus_array_print_length(void);
  94. MUS_EXPORT int mus_set_array_print_length(int val);
  95. MUS_EXPORT mus_float_t mus_float_equal_fudge_factor(void);
  96. MUS_EXPORT mus_float_t mus_set_float_equal_fudge_factor(mus_float_t val);
  97. MUS_EXPORT mus_float_t mus_ring_modulate(mus_float_t s1, mus_float_t s2);
  98. MUS_EXPORT mus_float_t mus_amplitude_modulate(mus_float_t s1, mus_float_t s2, mus_float_t s3);
  99. MUS_EXPORT mus_float_t mus_contrast_enhancement(mus_float_t sig, mus_float_t index);
  100. MUS_EXPORT mus_float_t mus_dot_product(mus_float_t *data1, mus_float_t *data2, mus_long_t size);
  101. #if HAVE_COMPLEX_TRIG
  102. MUS_EXPORT complex double mus_edot_product(complex double freq, complex double *data, mus_long_t size);
  103. #endif
  104. MUS_EXPORT bool mus_arrays_are_equal(mus_float_t *arr1, mus_float_t *arr2, mus_float_t fudge, mus_long_t len);
  105. MUS_EXPORT mus_float_t mus_polynomial(mus_float_t *coeffs, mus_float_t x, int ncoeffs);
  106. MUS_EXPORT void mus_rectangular_to_polar(mus_float_t *rl, mus_float_t *im, mus_long_t size);
  107. MUS_EXPORT void mus_rectangular_to_magnitudes(mus_float_t *rl, mus_float_t *im, mus_long_t size);
  108. MUS_EXPORT void mus_polar_to_rectangular(mus_float_t *rl, mus_float_t *im, mus_long_t size);
  109. MUS_EXPORT mus_float_t mus_array_interp(mus_float_t *wave, mus_float_t phase, mus_long_t size);
  110. MUS_EXPORT mus_float_t mus_bessi0(mus_float_t x);
  111. MUS_EXPORT mus_float_t mus_interpolate(mus_interp_t type, mus_float_t x, mus_float_t *table, mus_long_t table_size, mus_float_t y);
  112. MUS_EXPORT bool mus_is_interp_type(int val);
  113. MUS_EXPORT bool mus_is_fft_window(int val);
  114. MUS_EXPORT int mus_sample_type_zero(mus_sample_t samp_type);
  115. MUS_EXPORT mus_float_t (*mus_run_function(mus_any *g))(mus_any *gen, mus_float_t arg1, mus_float_t arg2);
  116. /* -------- generic functions -------- */
  117. MUS_EXPORT int mus_type(mus_any *ptr);
  118. MUS_EXPORT void mus_free(mus_any *ptr);
  119. MUS_EXPORT char *mus_describe(mus_any *gen);
  120. MUS_EXPORT bool mus_equalp(mus_any *g1, mus_any *g2);
  121. MUS_EXPORT mus_float_t mus_phase(mus_any *gen);
  122. MUS_EXPORT mus_float_t mus_set_phase(mus_any *gen, mus_float_t val);
  123. MUS_EXPORT mus_float_t mus_set_frequency(mus_any *gen, mus_float_t val);
  124. MUS_EXPORT mus_float_t mus_frequency(mus_any *gen);
  125. MUS_EXPORT mus_float_t mus_run(mus_any *gen, mus_float_t arg1, mus_float_t arg2);
  126. MUS_EXPORT mus_long_t mus_length(mus_any *gen);
  127. MUS_EXPORT mus_long_t mus_set_length(mus_any *gen, mus_long_t len);
  128. MUS_EXPORT mus_long_t mus_order(mus_any *gen);
  129. MUS_EXPORT mus_float_t *mus_data(mus_any *gen);
  130. MUS_EXPORT mus_float_t *mus_set_data(mus_any *gen, mus_float_t *data);
  131. MUS_EXPORT const char *mus_name(mus_any *ptr);
  132. MUS_EXPORT mus_float_t mus_scaler(mus_any *gen);
  133. MUS_EXPORT mus_float_t mus_set_scaler(mus_any *gen, mus_float_t val);
  134. MUS_EXPORT mus_float_t mus_offset(mus_any *gen);
  135. MUS_EXPORT mus_float_t mus_set_offset(mus_any *gen, mus_float_t val);
  136. MUS_EXPORT mus_float_t mus_width(mus_any *gen);
  137. MUS_EXPORT mus_float_t mus_set_width(mus_any *gen, mus_float_t val);
  138. MUS_EXPORT char *mus_file_name(mus_any *ptr);
  139. MUS_EXPORT void mus_reset(mus_any *ptr);
  140. MUS_EXPORT mus_any *mus_copy(mus_any *gen);
  141. MUS_EXPORT mus_float_t *mus_xcoeffs(mus_any *ptr);
  142. MUS_EXPORT mus_float_t *mus_ycoeffs(mus_any *ptr);
  143. MUS_EXPORT mus_float_t mus_xcoeff(mus_any *ptr, int index);
  144. MUS_EXPORT mus_float_t mus_set_xcoeff(mus_any *ptr, int index, mus_float_t val);
  145. MUS_EXPORT mus_float_t mus_ycoeff(mus_any *ptr, int index);
  146. MUS_EXPORT mus_float_t mus_set_ycoeff(mus_any *ptr, int index, mus_float_t val);
  147. MUS_EXPORT mus_float_t mus_increment(mus_any *rd);
  148. MUS_EXPORT mus_float_t mus_set_increment(mus_any *rd, mus_float_t dir);
  149. MUS_EXPORT mus_long_t mus_location(mus_any *rd);
  150. MUS_EXPORT mus_long_t mus_set_location(mus_any *rd, mus_long_t loc);
  151. MUS_EXPORT int mus_channel(mus_any *rd);
  152. MUS_EXPORT int mus_channels(mus_any *ptr);
  153. MUS_EXPORT int mus_position(mus_any *ptr); /* only C, envs (snd-env.c), shares slot with mus_channels */
  154. MUS_EXPORT int mus_interp_type(mus_any *ptr);
  155. MUS_EXPORT mus_long_t mus_ramp(mus_any *ptr);
  156. MUS_EXPORT mus_long_t mus_set_ramp(mus_any *ptr, mus_long_t val);
  157. MUS_EXPORT mus_long_t mus_hop(mus_any *ptr);
  158. MUS_EXPORT mus_long_t mus_set_hop(mus_any *ptr, mus_long_t val);
  159. MUS_EXPORT mus_float_t mus_feedforward(mus_any *gen);
  160. MUS_EXPORT mus_float_t mus_set_feedforward(mus_any *gen, mus_float_t val);
  161. MUS_EXPORT mus_float_t mus_feedback(mus_any *rd);
  162. MUS_EXPORT mus_float_t mus_set_feedback(mus_any *rd, mus_float_t dir);
  163. /* -------- generators -------- */
  164. MUS_EXPORT mus_float_t mus_oscil(mus_any *o, mus_float_t fm, mus_float_t pm);
  165. MUS_EXPORT mus_float_t mus_oscil_unmodulated(mus_any *ptr);
  166. MUS_EXPORT mus_float_t mus_oscil_fm(mus_any *ptr, mus_float_t fm);
  167. MUS_EXPORT mus_float_t mus_oscil_pm(mus_any *ptr, mus_float_t pm);
  168. MUS_EXPORT bool mus_is_oscil(mus_any *ptr);
  169. MUS_EXPORT mus_any *mus_make_oscil(mus_float_t freq, mus_float_t phase);
  170. MUS_EXPORT bool mus_is_oscil_bank(mus_any *ptr);
  171. MUS_EXPORT mus_float_t mus_oscil_bank(mus_any *ptr);
  172. MUS_EXPORT mus_any *mus_make_oscil_bank(int size, mus_float_t *freqs, mus_float_t *phases, mus_float_t *amps, bool stable);
  173. MUS_EXPORT mus_any *mus_make_ncos(mus_float_t freq, int n);
  174. MUS_EXPORT mus_float_t mus_ncos(mus_any *ptr, mus_float_t fm);
  175. MUS_EXPORT bool mus_is_ncos(mus_any *ptr);
  176. MUS_EXPORT mus_any *mus_make_nsin(mus_float_t freq, int n);
  177. MUS_EXPORT mus_float_t mus_nsin(mus_any *ptr, mus_float_t fm);
  178. MUS_EXPORT bool mus_is_nsin(mus_any *ptr);
  179. MUS_EXPORT mus_any *mus_make_nrxysin(mus_float_t frequency, mus_float_t y_over_x, int n, mus_float_t r);
  180. MUS_EXPORT mus_float_t mus_nrxysin(mus_any *ptr, mus_float_t fm);
  181. MUS_EXPORT bool mus_is_nrxysin(mus_any *ptr);
  182. MUS_EXPORT mus_any *mus_make_nrxycos(mus_float_t frequency, mus_float_t y_over_x, int n, mus_float_t r);
  183. MUS_EXPORT mus_float_t mus_nrxycos(mus_any *ptr, mus_float_t fm);
  184. MUS_EXPORT bool mus_is_nrxycos(mus_any *ptr);
  185. MUS_EXPORT mus_any *mus_make_rxykcos(mus_float_t freq, mus_float_t phase, mus_float_t r, mus_float_t ratio);
  186. MUS_EXPORT mus_float_t mus_rxykcos(mus_any *ptr, mus_float_t fm);
  187. MUS_EXPORT bool mus_is_rxykcos(mus_any *ptr);
  188. MUS_EXPORT mus_any *mus_make_rxyksin(mus_float_t freq, mus_float_t phase, mus_float_t r, mus_float_t ratio);
  189. MUS_EXPORT mus_float_t mus_rxyksin(mus_any *ptr, mus_float_t fm);
  190. MUS_EXPORT bool mus_is_rxyksin(mus_any *ptr);
  191. MUS_EXPORT mus_float_t mus_delay(mus_any *gen, mus_float_t input, mus_float_t pm);
  192. MUS_EXPORT mus_float_t mus_delay_unmodulated(mus_any *ptr, mus_float_t input);
  193. MUS_EXPORT mus_float_t mus_tap(mus_any *gen, mus_float_t loc);
  194. MUS_EXPORT mus_float_t mus_tap_unmodulated(mus_any *gen);
  195. MUS_EXPORT mus_any *mus_make_delay(int size, mus_float_t *line, int line_size, mus_interp_t type);
  196. MUS_EXPORT bool mus_is_delay(mus_any *ptr);
  197. MUS_EXPORT bool mus_is_tap(mus_any *ptr);
  198. MUS_EXPORT mus_float_t mus_delay_tick(mus_any *ptr, mus_float_t input);
  199. MUS_EXPORT mus_float_t mus_delay_unmodulated_noz(mus_any *ptr, mus_float_t input);
  200. MUS_EXPORT mus_float_t mus_comb(mus_any *gen, mus_float_t input, mus_float_t pm);
  201. MUS_EXPORT mus_float_t mus_comb_unmodulated(mus_any *gen, mus_float_t input);
  202. MUS_EXPORT mus_any *mus_make_comb(mus_float_t scaler, int size, mus_float_t *line, int line_size, mus_interp_t type);
  203. MUS_EXPORT bool mus_is_comb(mus_any *ptr);
  204. MUS_EXPORT mus_float_t mus_comb_unmodulated_noz(mus_any *ptr, mus_float_t input);
  205. MUS_EXPORT mus_float_t mus_comb_bank(mus_any *bank, mus_float_t inval);
  206. MUS_EXPORT mus_any *mus_make_comb_bank(int size, mus_any **combs);
  207. MUS_EXPORT bool mus_is_comb_bank(mus_any *g);
  208. MUS_EXPORT mus_float_t mus_notch(mus_any *gen, mus_float_t input, mus_float_t pm);
  209. MUS_EXPORT mus_float_t mus_notch_unmodulated(mus_any *gen, mus_float_t input);
  210. MUS_EXPORT mus_any *mus_make_notch(mus_float_t scaler, int size, mus_float_t *line, int line_size, mus_interp_t type);
  211. MUS_EXPORT bool mus_is_notch(mus_any *ptr);
  212. MUS_EXPORT mus_float_t mus_all_pass(mus_any *gen, mus_float_t input, mus_float_t pm);
  213. MUS_EXPORT mus_float_t mus_all_pass_unmodulated(mus_any *gen, mus_float_t input);
  214. MUS_EXPORT mus_any *mus_make_all_pass(mus_float_t backward, mus_float_t forward, int size, mus_float_t *line, int line_size, mus_interp_t type);
  215. MUS_EXPORT bool mus_is_all_pass(mus_any *ptr);
  216. MUS_EXPORT mus_float_t mus_all_pass_unmodulated_noz(mus_any *ptr, mus_float_t input);
  217. MUS_EXPORT mus_float_t mus_all_pass_bank(mus_any *bank, mus_float_t inval);
  218. MUS_EXPORT mus_any *mus_make_all_pass_bank(int size, mus_any **combs);
  219. MUS_EXPORT bool mus_is_all_pass_bank(mus_any *g);
  220. MUS_EXPORT mus_any *mus_make_moving_average(int size, mus_float_t *line);
  221. MUS_EXPORT mus_any *mus_make_moving_average_with_initial_sum(int size, mus_float_t *line, mus_float_t sum);
  222. MUS_EXPORT bool mus_is_moving_average(mus_any *ptr);
  223. MUS_EXPORT mus_float_t mus_moving_average(mus_any *ptr, mus_float_t input);
  224. MUS_EXPORT mus_any *mus_make_moving_max(int size, mus_float_t *line);
  225. MUS_EXPORT bool mus_is_moving_max(mus_any *ptr);
  226. MUS_EXPORT mus_float_t mus_moving_max(mus_any *ptr, mus_float_t input);
  227. MUS_EXPORT mus_any *mus_make_moving_norm(int size, mus_float_t *line, mus_float_t norm);
  228. MUS_EXPORT bool mus_is_moving_norm(mus_any *ptr);
  229. MUS_EXPORT mus_float_t mus_moving_norm(mus_any *ptr, mus_float_t input);
  230. MUS_EXPORT mus_float_t mus_table_lookup(mus_any *gen, mus_float_t fm);
  231. MUS_EXPORT mus_float_t mus_table_lookup_unmodulated(mus_any *gen);
  232. MUS_EXPORT mus_any *mus_make_table_lookup(mus_float_t freq, mus_float_t phase, mus_float_t *wave, mus_long_t wave_size, mus_interp_t type);
  233. MUS_EXPORT bool mus_is_table_lookup(mus_any *ptr);
  234. MUS_EXPORT mus_float_t *mus_partials_to_wave(mus_float_t *partial_data, int partials, mus_float_t *table, mus_long_t table_size, bool normalize);
  235. MUS_EXPORT mus_float_t *mus_phase_partials_to_wave(mus_float_t *partial_data, int partials, mus_float_t *table, mus_long_t table_size, bool normalize);
  236. MUS_EXPORT mus_float_t mus_sawtooth_wave(mus_any *gen, mus_float_t fm);
  237. MUS_EXPORT mus_any *mus_make_sawtooth_wave(mus_float_t freq, mus_float_t amp, mus_float_t phase);
  238. MUS_EXPORT bool mus_is_sawtooth_wave(mus_any *gen);
  239. MUS_EXPORT mus_float_t mus_square_wave(mus_any *gen, mus_float_t fm);
  240. MUS_EXPORT mus_any *mus_make_square_wave(mus_float_t freq, mus_float_t amp, mus_float_t phase);
  241. MUS_EXPORT bool mus_is_square_wave(mus_any *gen);
  242. MUS_EXPORT mus_float_t mus_triangle_wave(mus_any *gen, mus_float_t fm);
  243. MUS_EXPORT mus_any *mus_make_triangle_wave(mus_float_t freq, mus_float_t amp, mus_float_t phase);
  244. MUS_EXPORT bool mus_is_triangle_wave(mus_any *gen);
  245. MUS_EXPORT mus_float_t mus_triangle_wave_unmodulated(mus_any *ptr);
  246. MUS_EXPORT mus_float_t mus_pulse_train(mus_any *gen, mus_float_t fm);
  247. MUS_EXPORT mus_any *mus_make_pulse_train(mus_float_t freq, mus_float_t amp, mus_float_t phase);
  248. MUS_EXPORT bool mus_is_pulse_train(mus_any *gen);
  249. MUS_EXPORT mus_float_t mus_pulse_train_unmodulated(mus_any *ptr);
  250. MUS_EXPORT void mus_set_rand_seed(unsigned long seed);
  251. MUS_EXPORT unsigned long mus_rand_seed(void);
  252. MUS_EXPORT mus_float_t mus_random(mus_float_t amp);
  253. MUS_EXPORT mus_float_t mus_frandom(mus_float_t amp);
  254. MUS_EXPORT int mus_irandom(int amp);
  255. MUS_EXPORT mus_float_t mus_rand(mus_any *gen, mus_float_t fm);
  256. MUS_EXPORT mus_any *mus_make_rand(mus_float_t freq, mus_float_t base);
  257. MUS_EXPORT bool mus_is_rand(mus_any *ptr);
  258. MUS_EXPORT mus_any *mus_make_rand_with_distribution(mus_float_t freq, mus_float_t base, mus_float_t *distribution, int distribution_size);
  259. MUS_EXPORT mus_float_t mus_rand_interp(mus_any *gen, mus_float_t fm);
  260. MUS_EXPORT mus_any *mus_make_rand_interp(mus_float_t freq, mus_float_t base);
  261. MUS_EXPORT bool mus_is_rand_interp(mus_any *ptr);
  262. MUS_EXPORT mus_any *mus_make_rand_interp_with_distribution(mus_float_t freq, mus_float_t base, mus_float_t *distribution, int distribution_size);
  263. MUS_EXPORT mus_float_t mus_rand_interp_unmodulated(mus_any *ptr);
  264. MUS_EXPORT mus_float_t mus_rand_unmodulated(mus_any *ptr);
  265. MUS_EXPORT mus_float_t mus_asymmetric_fm(mus_any *gen, mus_float_t index, mus_float_t fm);
  266. MUS_EXPORT mus_float_t mus_asymmetric_fm_unmodulated(mus_any *gen, mus_float_t index);
  267. MUS_EXPORT mus_any *mus_make_asymmetric_fm(mus_float_t freq, mus_float_t phase, mus_float_t r, mus_float_t ratio);
  268. MUS_EXPORT bool mus_is_asymmetric_fm(mus_any *ptr);
  269. MUS_EXPORT mus_float_t mus_one_zero(mus_any *gen, mus_float_t input);
  270. MUS_EXPORT mus_any *mus_make_one_zero(mus_float_t a0, mus_float_t a1);
  271. MUS_EXPORT bool mus_is_one_zero(mus_any *gen);
  272. MUS_EXPORT mus_float_t mus_one_pole(mus_any *gen, mus_float_t input);
  273. MUS_EXPORT mus_any *mus_make_one_pole(mus_float_t a0, mus_float_t b1);
  274. MUS_EXPORT bool mus_is_one_pole(mus_any *gen);
  275. MUS_EXPORT mus_float_t mus_two_zero(mus_any *gen, mus_float_t input);
  276. MUS_EXPORT mus_any *mus_make_two_zero(mus_float_t a0, mus_float_t a1, mus_float_t a2);
  277. MUS_EXPORT bool mus_is_two_zero(mus_any *gen);
  278. MUS_EXPORT mus_any *mus_make_two_zero_from_frequency_and_radius(mus_float_t frequency, mus_float_t radius);
  279. MUS_EXPORT mus_float_t mus_two_pole(mus_any *gen, mus_float_t input);
  280. MUS_EXPORT mus_any *mus_make_two_pole(mus_float_t a0, mus_float_t b1, mus_float_t b2);
  281. MUS_EXPORT bool mus_is_two_pole(mus_any *gen);
  282. MUS_EXPORT mus_any *mus_make_two_pole_from_frequency_and_radius(mus_float_t frequency, mus_float_t radius);
  283. MUS_EXPORT mus_float_t mus_one_pole_all_pass(mus_any *f, mus_float_t input);
  284. MUS_EXPORT mus_any *mus_make_one_pole_all_pass(int size, mus_float_t coeff);
  285. MUS_EXPORT bool mus_is_one_pole_all_pass(mus_any *ptr);
  286. MUS_EXPORT mus_float_t mus_formant(mus_any *ptr, mus_float_t input);
  287. MUS_EXPORT mus_any *mus_make_formant(mus_float_t frequency, mus_float_t radius);
  288. MUS_EXPORT bool mus_is_formant(mus_any *ptr);
  289. MUS_EXPORT mus_float_t mus_set_formant_frequency(mus_any *ptr, mus_float_t freq_in_hz);
  290. MUS_EXPORT void mus_set_formant_radius_and_frequency(mus_any *ptr, mus_float_t radius, mus_float_t frequency);
  291. MUS_EXPORT mus_float_t mus_formant_with_frequency(mus_any *ptr, mus_float_t input, mus_float_t freq_in_radians);
  292. MUS_EXPORT mus_float_t mus_formant_bank(mus_any *bank, mus_float_t inval);
  293. MUS_EXPORT mus_float_t mus_formant_bank_with_inputs(mus_any *bank, mus_float_t *inval);
  294. MUS_EXPORT mus_any *mus_make_formant_bank(int size, mus_any **formants, mus_float_t *amps);
  295. MUS_EXPORT bool mus_is_formant_bank(mus_any *g);
  296. MUS_EXPORT mus_float_t mus_firmant(mus_any *ptr, mus_float_t input);
  297. MUS_EXPORT mus_any *mus_make_firmant(mus_float_t frequency, mus_float_t radius);
  298. MUS_EXPORT bool mus_is_firmant(mus_any *ptr);
  299. MUS_EXPORT mus_float_t mus_firmant_with_frequency(mus_any *ptr, mus_float_t input, mus_float_t freq_in_radians);
  300. MUS_EXPORT mus_float_t mus_filter(mus_any *ptr, mus_float_t input);
  301. MUS_EXPORT mus_any *mus_make_filter(int order, mus_float_t *xcoeffs, mus_float_t *ycoeffs, mus_float_t *state);
  302. MUS_EXPORT bool mus_is_filter(mus_any *ptr);
  303. MUS_EXPORT mus_float_t mus_fir_filter(mus_any *ptr, mus_float_t input);
  304. MUS_EXPORT mus_any *mus_make_fir_filter(int order, mus_float_t *xcoeffs, mus_float_t *state);
  305. MUS_EXPORT bool mus_is_fir_filter(mus_any *ptr);
  306. MUS_EXPORT mus_float_t mus_iir_filter(mus_any *ptr, mus_float_t input);
  307. MUS_EXPORT mus_any *mus_make_iir_filter(int order, mus_float_t *ycoeffs, mus_float_t *state);
  308. MUS_EXPORT bool mus_is_iir_filter(mus_any *ptr);
  309. MUS_EXPORT mus_float_t *mus_make_fir_coeffs(int order, mus_float_t *env, mus_float_t *aa);
  310. MUS_EXPORT mus_float_t *mus_filter_set_xcoeffs(mus_any *ptr, mus_float_t *new_data);
  311. MUS_EXPORT mus_float_t *mus_filter_set_ycoeffs(mus_any *ptr, mus_float_t *new_data);
  312. MUS_EXPORT int mus_filter_set_order(mus_any *ptr, int order);
  313. MUS_EXPORT mus_float_t mus_filtered_comb(mus_any *ptr, mus_float_t input, mus_float_t pm);
  314. MUS_EXPORT mus_float_t mus_filtered_comb_unmodulated(mus_any *ptr, mus_float_t input);
  315. MUS_EXPORT bool mus_is_filtered_comb(mus_any *ptr);
  316. MUS_EXPORT mus_any *mus_make_filtered_comb(mus_float_t scaler, int size, mus_float_t *line, int line_size, mus_interp_t type, mus_any *filt);
  317. MUS_EXPORT mus_float_t mus_filtered_comb_bank(mus_any *bank, mus_float_t inval);
  318. MUS_EXPORT mus_any *mus_make_filtered_comb_bank(int size, mus_any **combs);
  319. MUS_EXPORT bool mus_is_filtered_comb_bank(mus_any *g);
  320. MUS_EXPORT mus_float_t mus_wave_train(mus_any *gen, mus_float_t fm);
  321. MUS_EXPORT mus_float_t mus_wave_train_unmodulated(mus_any *gen);
  322. MUS_EXPORT mus_any *mus_make_wave_train(mus_float_t freq, mus_float_t phase, mus_float_t *wave, mus_long_t wsize, mus_interp_t type);
  323. MUS_EXPORT bool mus_is_wave_train(mus_any *gen);
  324. MUS_EXPORT mus_float_t *mus_partials_to_polynomial(int npartials, mus_float_t *partials, mus_polynomial_t kind);
  325. MUS_EXPORT mus_float_t *mus_normalize_partials(int num_partials, mus_float_t *partials);
  326. MUS_EXPORT mus_any *mus_make_polyshape(mus_float_t frequency, mus_float_t phase, mus_float_t *coeffs, int size, int cheby_choice);
  327. MUS_EXPORT mus_float_t mus_polyshape(mus_any *ptr, mus_float_t index, mus_float_t fm);
  328. MUS_EXPORT mus_float_t mus_polyshape_unmodulated(mus_any *ptr, mus_float_t index);
  329. #define mus_polyshape_no_input(Obj) mus_polyshape(Obj, 1.0, 0.0)
  330. MUS_EXPORT bool mus_is_polyshape(mus_any *ptr);
  331. MUS_EXPORT mus_any *mus_make_polywave(mus_float_t frequency, mus_float_t *coeffs, int n, int cheby_choice);
  332. MUS_EXPORT mus_any *mus_make_polywave_tu(mus_float_t frequency, mus_float_t *tcoeffs, mus_float_t *ucoeffs, int n);
  333. MUS_EXPORT bool mus_is_polywave(mus_any *ptr);
  334. MUS_EXPORT mus_float_t mus_polywave_unmodulated(mus_any *ptr);
  335. MUS_EXPORT mus_float_t mus_polywave(mus_any *ptr, mus_float_t fm);
  336. MUS_EXPORT mus_float_t mus_chebyshev_t_sum(mus_float_t x, int n, mus_float_t *tn);
  337. MUS_EXPORT mus_float_t mus_chebyshev_u_sum(mus_float_t x, int n, mus_float_t *un);
  338. MUS_EXPORT mus_float_t mus_chebyshev_tu_sum(mus_float_t x, int n, mus_float_t *tn, mus_float_t *un);
  339. MUS_EXPORT mus_float_t (*mus_polywave_function(mus_any *g))(mus_any *gen, mus_float_t fm);
  340. MUS_EXPORT mus_float_t mus_env(mus_any *ptr);
  341. MUS_EXPORT mus_any *mus_make_env(mus_float_t *brkpts, int npts, mus_float_t scaler, mus_float_t offset, mus_float_t base,
  342. mus_float_t duration, mus_long_t end, mus_float_t *odata);
  343. MUS_EXPORT bool mus_is_env(mus_any *ptr);
  344. MUS_EXPORT mus_float_t mus_env_interp(mus_float_t x, mus_any *env);
  345. MUS_EXPORT mus_long_t *mus_env_passes(mus_any *gen); /* for Snd */
  346. MUS_EXPORT mus_float_t *mus_env_rates(mus_any *gen); /* for Snd */
  347. MUS_EXPORT mus_float_t mus_env_offset(mus_any *gen); /* for Snd */
  348. MUS_EXPORT mus_float_t mus_env_scaler(mus_any *gen); /* for Snd */
  349. MUS_EXPORT mus_float_t mus_env_initial_power(mus_any *gen); /* for Snd */
  350. MUS_EXPORT int mus_env_breakpoints(mus_any *gen); /* for Snd */
  351. MUS_EXPORT mus_float_t mus_env_any(mus_any *e, mus_float_t (*connect_points)(mus_float_t val));
  352. MUS_EXPORT mus_float_t (*mus_env_function(mus_any *g))(mus_any *gen);
  353. MUS_EXPORT mus_any *mus_make_pulsed_env(mus_any *e, mus_any *p);
  354. MUS_EXPORT bool mus_is_pulsed_env(mus_any *ptr);
  355. MUS_EXPORT mus_float_t mus_pulsed_env(mus_any *pl, mus_float_t inval);
  356. MUS_EXPORT mus_float_t mus_pulsed_env_unmodulated(mus_any *pl);
  357. MUS_EXPORT bool mus_is_file_to_sample(mus_any *ptr);
  358. MUS_EXPORT mus_any *mus_make_file_to_sample(const char *filename);
  359. MUS_EXPORT mus_any *mus_make_file_to_sample_with_buffer_size(const char *filename, mus_long_t buffer_size);
  360. MUS_EXPORT mus_float_t mus_file_to_sample(mus_any *ptr, mus_long_t samp, int chan);
  361. MUS_EXPORT mus_float_t mus_readin(mus_any *rd);
  362. MUS_EXPORT mus_any *mus_make_readin_with_buffer_size(const char *filename, int chan, mus_long_t start, int direction, mus_long_t buffer_size);
  363. #define mus_make_readin(Filename, Chan, Start, Direction) mus_make_readin_with_buffer_size(Filename, Chan, Start, Direction, mus_file_buffer_size())
  364. MUS_EXPORT bool mus_is_readin(mus_any *ptr);
  365. MUS_EXPORT bool mus_is_output(mus_any *ptr);
  366. MUS_EXPORT bool mus_is_input(mus_any *ptr);
  367. MUS_EXPORT mus_float_t mus_in_any(mus_long_t frample, int chan, mus_any *IO);
  368. MUS_EXPORT bool mus_in_any_is_safe(mus_any *IO);
  369. /* new 6.0 */
  370. MUS_EXPORT mus_float_t *mus_file_to_frample(mus_any *ptr, mus_long_t samp, mus_float_t *f);
  371. MUS_EXPORT mus_any *mus_make_file_to_frample(const char *filename);
  372. MUS_EXPORT bool mus_is_file_to_frample(mus_any *ptr);
  373. MUS_EXPORT mus_any *mus_make_file_to_frample_with_buffer_size(const char *filename, mus_long_t buffer_size);
  374. MUS_EXPORT mus_float_t *mus_frample_to_frample(mus_float_t *matrix, int mx_chans, mus_float_t *in_samps, int in_chans, mus_float_t *out_samps, int out_chans);
  375. MUS_EXPORT bool mus_is_frample_to_file(mus_any *ptr);
  376. MUS_EXPORT mus_float_t *mus_frample_to_file(mus_any *ptr, mus_long_t samp, mus_float_t *data);
  377. MUS_EXPORT mus_any *mus_make_frample_to_file_with_comment(const char *filename, int chans, mus_sample_t samp_type, mus_header_t head_type, const char *comment);
  378. #define mus_make_frample_to_file(Filename, Chans, SampType, HeadType) mus_make_frample_to_file_with_comment(Filename, Chans, SampType, HeadType, NULL)
  379. MUS_EXPORT mus_any *mus_continue_frample_to_file(const char *filename);
  380. MUS_EXPORT void mus_file_mix_with_reader_and_writer(mus_any *outf, mus_any *inf,
  381. mus_long_t out_start, mus_long_t out_framples, mus_long_t in_start,
  382. mus_float_t *mx, int mx_chans, mus_any ***envs);
  383. MUS_EXPORT void mus_file_mix(const char *outfile, const char *infile,
  384. mus_long_t out_start, mus_long_t out_framples, mus_long_t in_start,
  385. mus_float_t *mx, int mx_chans, mus_any ***envs);
  386. MUS_EXPORT bool mus_is_sample_to_file(mus_any *ptr);
  387. MUS_EXPORT mus_any *mus_make_sample_to_file_with_comment(const char *filename, int out_chans, mus_sample_t samp_type, mus_header_t head_type, const char *comment);
  388. #define mus_make_sample_to_file(Filename, Chans, SampType, HeadType) mus_make_sample_to_file_with_comment(Filename, Chans, SampType, HeadType, NULL)
  389. MUS_EXPORT mus_float_t mus_sample_to_file(mus_any *ptr, mus_long_t samp, int chan, mus_float_t val);
  390. MUS_EXPORT mus_any *mus_continue_sample_to_file(const char *filename);
  391. MUS_EXPORT int mus_close_file(mus_any *ptr);
  392. MUS_EXPORT mus_any *mus_sample_to_file_add(mus_any *out1, mus_any *out2);
  393. MUS_EXPORT mus_float_t mus_out_any(mus_long_t frample, mus_float_t val, int chan, mus_any *IO);
  394. MUS_EXPORT mus_float_t mus_safe_out_any_to_file(mus_long_t samp, mus_float_t val, int chan, mus_any *IO);
  395. MUS_EXPORT bool mus_out_any_is_safe(mus_any *IO);
  396. MUS_EXPORT mus_float_t mus_out_any_to_file(mus_any *ptr, mus_long_t samp, int chan, mus_float_t val);
  397. MUS_EXPORT void mus_locsig(mus_any *ptr, mus_long_t loc, mus_float_t val);
  398. MUS_EXPORT mus_any *mus_make_locsig(mus_float_t degree, mus_float_t distance, mus_float_t reverb, int chans,
  399. mus_any *output, int rev_chans, mus_any *revput, mus_interp_t type);
  400. MUS_EXPORT bool mus_is_locsig(mus_any *ptr);
  401. MUS_EXPORT mus_float_t mus_locsig_ref(mus_any *ptr, int chan);
  402. MUS_EXPORT mus_float_t mus_locsig_set(mus_any *ptr, int chan, mus_float_t val);
  403. MUS_EXPORT mus_float_t mus_locsig_reverb_ref(mus_any *ptr, int chan);
  404. MUS_EXPORT mus_float_t mus_locsig_reverb_set(mus_any *ptr, int chan, mus_float_t val);
  405. MUS_EXPORT void mus_move_locsig(mus_any *ptr, mus_float_t degree, mus_float_t distance);
  406. MUS_EXPORT mus_float_t *mus_locsig_outf(mus_any *ptr);
  407. MUS_EXPORT mus_float_t *mus_locsig_revf(mus_any *ptr);
  408. MUS_EXPORT void *mus_locsig_closure(mus_any *ptr);
  409. MUS_EXPORT void mus_locsig_set_detour(mus_any *ptr, void (*detour)(mus_any *ptr, mus_long_t val));
  410. MUS_EXPORT int mus_locsig_channels(mus_any *ptr);
  411. MUS_EXPORT int mus_locsig_reverb_channels(mus_any *ptr);
  412. MUS_EXPORT bool mus_is_move_sound(mus_any *ptr);
  413. MUS_EXPORT mus_float_t mus_move_sound(mus_any *ptr, mus_long_t loc, mus_float_t val);
  414. MUS_EXPORT mus_any *mus_make_move_sound(mus_long_t start, mus_long_t end, int out_channels, int rev_channels,
  415. mus_any *doppler_delay, mus_any *doppler_env, mus_any *rev_env,
  416. mus_any **out_delays, mus_any **out_envs, mus_any **rev_envs,
  417. int *out_map, mus_any *output, mus_any *revput, bool free_arrays, bool free_gens);
  418. MUS_EXPORT mus_float_t *mus_move_sound_outf(mus_any *ptr);
  419. MUS_EXPORT mus_float_t *mus_move_sound_revf(mus_any *ptr);
  420. MUS_EXPORT void *mus_move_sound_closure(mus_any *ptr);
  421. MUS_EXPORT void mus_move_sound_set_detour(mus_any *ptr, void (*detour)(mus_any *ptr, mus_long_t val));
  422. MUS_EXPORT int mus_move_sound_channels(mus_any *ptr);
  423. MUS_EXPORT int mus_move_sound_reverb_channels(mus_any *ptr);
  424. MUS_EXPORT mus_any *mus_make_src(mus_float_t (*input)(void *arg, int direction), mus_float_t srate, int width, void *closure);
  425. MUS_EXPORT mus_any *mus_make_src_with_init(mus_float_t (*input)(void *arg, int direction), mus_float_t srate, int width, void *closure, void (*init)(void *p, mus_any *g));
  426. MUS_EXPORT mus_float_t mus_src(mus_any *srptr, mus_float_t sr_change, mus_float_t (*input)(void *arg, int direction));
  427. MUS_EXPORT bool mus_is_src(mus_any *ptr);
  428. MUS_EXPORT mus_float_t *mus_src_20(mus_any *srptr, mus_float_t *in_data, mus_long_t dur);
  429. MUS_EXPORT mus_float_t *mus_src_05(mus_any *srptr, mus_float_t *in_data, mus_long_t dur);
  430. MUS_EXPORT void mus_src_to_buffer(mus_any *srptr, mus_float_t (*input)(void *arg, int direction), mus_float_t *out_data, mus_long_t dur);
  431. MUS_EXPORT void mus_src_init(mus_any *ptr);
  432. MUS_EXPORT bool mus_is_convolve(mus_any *ptr);
  433. MUS_EXPORT mus_float_t mus_convolve(mus_any *ptr, mus_float_t (*input)(void *arg, int direction));
  434. MUS_EXPORT mus_any *mus_make_convolve(mus_float_t (*input)(void *arg, int direction), mus_float_t *filter, mus_long_t fftsize, mus_long_t filtersize, void *closure);
  435. MUS_EXPORT mus_float_t *mus_spectrum(mus_float_t *rdat, mus_float_t *idat, mus_float_t *window, mus_long_t n, mus_spectrum_t type);
  436. MUS_EXPORT void mus_fft(mus_float_t *rl, mus_float_t *im, mus_long_t n, int is);
  437. MUS_EXPORT mus_float_t *mus_make_fft_window(mus_fft_window_t type, mus_long_t size, mus_float_t beta);
  438. MUS_EXPORT mus_float_t *mus_make_fft_window_with_window(mus_fft_window_t type, mus_long_t size, mus_float_t beta, mus_float_t mu, mus_float_t *window);
  439. MUS_EXPORT const char *mus_fft_window_name(mus_fft_window_t win);
  440. MUS_EXPORT const char **mus_fft_window_names(void);
  441. MUS_EXPORT mus_float_t *mus_autocorrelate(mus_float_t *data, mus_long_t n);
  442. MUS_EXPORT mus_float_t *mus_correlate(mus_float_t *data1, mus_float_t *data2, mus_long_t n);
  443. MUS_EXPORT mus_float_t *mus_convolution(mus_float_t *rl1, mus_float_t *rl2, mus_long_t n);
  444. MUS_EXPORT void mus_convolve_files(const char *file1, const char *file2, mus_float_t maxamp, const char *output_file);
  445. MUS_EXPORT mus_float_t *mus_cepstrum(mus_float_t *data, mus_long_t n);
  446. MUS_EXPORT bool mus_is_granulate(mus_any *ptr);
  447. MUS_EXPORT mus_float_t mus_granulate(mus_any *ptr, mus_float_t (*input)(void *arg, int direction));
  448. MUS_EXPORT mus_float_t mus_granulate_with_editor(mus_any *ptr, mus_float_t (*input)(void *arg, int direction), int (*edit)(void *closure));
  449. MUS_EXPORT mus_any *mus_make_granulate(mus_float_t (*input)(void *arg, int direction),
  450. mus_float_t expansion, mus_float_t length, mus_float_t scaler,
  451. mus_float_t hop, mus_float_t ramp, mus_float_t jitter, int max_size,
  452. int (*edit)(void *closure),
  453. void *closure);
  454. MUS_EXPORT int mus_granulate_grain_max_length(mus_any *ptr);
  455. MUS_EXPORT void mus_granulate_set_edit_function(mus_any *ptr, int (*edit)(void *closure));
  456. MUS_EXPORT mus_long_t mus_set_file_buffer_size(mus_long_t size);
  457. MUS_EXPORT mus_long_t mus_file_buffer_size(void);
  458. MUS_EXPORT mus_float_t mus_apply(mus_any *gen, mus_float_t f1, mus_float_t f2);
  459. MUS_EXPORT bool mus_is_phase_vocoder(mus_any *ptr);
  460. MUS_EXPORT mus_any *mus_make_phase_vocoder(mus_float_t (*input)(void *arg, int direction),
  461. int fftsize, int overlap, int interp,
  462. mus_float_t pitch,
  463. bool (*analyze)(void *arg, mus_float_t (*input)(void *arg1, int direction)),
  464. int (*edit)(void *arg), /* return value is ignored (int return type is intended to be consistent with granulate) */
  465. mus_float_t (*synthesize)(void *arg),
  466. void *closure);
  467. MUS_EXPORT mus_float_t mus_phase_vocoder(mus_any *ptr, mus_float_t (*input)(void *arg, int direction));
  468. MUS_EXPORT mus_float_t mus_phase_vocoder_with_editors(mus_any *ptr,
  469. mus_float_t (*input)(void *arg, int direction),
  470. bool (*analyze)(void *arg, mus_float_t (*input)(void *arg1, int direction)),
  471. int (*edit)(void *arg),
  472. mus_float_t (*synthesize)(void *arg));
  473. MUS_EXPORT mus_float_t *mus_phase_vocoder_amp_increments(mus_any *ptr);
  474. MUS_EXPORT mus_float_t *mus_phase_vocoder_amps(mus_any *ptr);
  475. MUS_EXPORT mus_float_t *mus_phase_vocoder_freqs(mus_any *ptr);
  476. MUS_EXPORT mus_float_t *mus_phase_vocoder_phases(mus_any *ptr);
  477. MUS_EXPORT mus_float_t *mus_phase_vocoder_phase_increments(mus_any *ptr);
  478. MUS_EXPORT mus_any *mus_make_ssb_am(mus_float_t freq, int order);
  479. MUS_EXPORT bool mus_is_ssb_am(mus_any *ptr);
  480. MUS_EXPORT mus_float_t mus_ssb_am_unmodulated(mus_any *ptr, mus_float_t insig);
  481. MUS_EXPORT mus_float_t mus_ssb_am(mus_any *ptr, mus_float_t insig, mus_float_t fm);
  482. MUS_EXPORT void mus_clear_sinc_tables(void);
  483. MUS_EXPORT void *mus_environ(mus_any *gen);
  484. MUS_EXPORT void *mus_set_environ(mus_any *gen, void *e);
  485. MUS_EXPORT mus_any *mus_bank_generator(mus_any *g, int i);
  486. #ifdef __cplusplus
  487. }
  488. #endif
  489. #endif
  490. /* Change log.
  491. *
  492. * 5-Aug: removed some now-obsolete mus_locsig functions.
  493. * 5-Jul: added stable arg to mus_make_oscil_bank.
  494. * 15-Feb: removed mus_set_name, changed mus_free to void.
  495. * 31-Jan-15: removed mus_multiply_arrays.
  496. * --------
  497. * 8-Nov: mus_copy, mus_bank_generator.
  498. * 24-Oct: mus_generator_set_feeders.
  499. * 10-Aug: data-format -> sample-type.
  500. * 17-Apr: moving_norm generator.
  501. * 14-Apr: mus_frame and mus_mixer removed, "frame" replaced by "frample" in IO functions.
  502. * 11-Apr: mus_even|odd_weight|multiple.
  503. * 9-Apr: deprecate mus_is_delay_line.
  504. * 2-Apr: mus_make_moving_average_with_sum.
  505. * 19-Mar: deprecate mus_make_env_with_length.
  506. * 17-Feb-14: mus_*_p -> mus_is_*.
  507. * --------
  508. * 7-Dec: mus_set_formant_frequency, mus_src_20 and mus_src_05 changed. Removed mus_in_any_from_file.
  509. * 29-Nov: mus_make_polywave_tu.
  510. * 11-Oct: mus_vector_to_file, mus_vector_mix.
  511. * 19-Apr: rxyk!cos and rxyk!sin from generators.scm.
  512. * 11-Apr: mus_tap_p as a better name for mus_delay_line_p.
  513. * 27-Mar: comb-bank, all-pass-bank, filtered-comb-bank, pulsed-env, oscil-bank.
  514. * 21-Mar: one-pole-all-pass generator.
  515. * 14-Mar: formant-bank generator.
  516. * removed mus_delay_tick_noz.
  517. * 4-Mar: moving_max generator.
  518. * removed the unstable filter check in make_two_pole.
  519. * 21-Jan-13: changed mus_formant_bank parameters.
  520. * --------
  521. * 22-Dec: removed all the safety settings.
  522. * 15-Nov: removed mus_env_t, mus_env_type, and other recently deprecated stuff.
  523. * 15-Jul: more changes for clm2xen.
  524. * 4-July-12: moved various struct definitions to clm.c
  525. * added accessors for mus_any_class etc.
  526. * --------
  527. * 1-Sep: mus_type.
  528. * 20-Aug: changed type of mus_locsig to void, added mus_locsig_function_reset.
  529. * removed function-as-output-location from locsig et al.
  530. * 14-Jul-11: removed pthread stuff.
  531. * --------
  532. * 7-Mar-10: protect in-any and out-any from sample numbers less than 0.
  533. * --------
  534. * 14-Oct: sine-summation, sum-of-sines, sum-of-cosines removed.
  535. * 28-Aug: changed some fft-related sizes from int to mus_long_t.
  536. * 17-Aug: mus_frame|mixer_copy|fill.
  537. * 27-Jul: mus_float_t for Float, and mus_long_t for off_t.
  538. * 15-Jun: mus_rectangular_to_magnitudes (polar, but ignore phases).
  539. * 11-Jun: mus_cepstrum.
  540. * 11-May: MUS_ENV_LINEAR and friends, also mus_env_linear|exponential.
  541. * mus_frame_to_frame_mono|stereo.
  542. * 12-Mar: sinc, papoulis and dpss (slepian windows).
  543. * 1-Jan-09: added MUS_EXPORT.
  544. * --------
  545. * 11-Dec: deprecated the sine-summation, sum-of-cosines, and sum-of-sines generators.
  546. * 30-Oct: mus_sample_to_file_add.
  547. * mus_describe once again allocates a fresh output string.
  548. * finally removed sine-bank.
  549. * 9-Oct: various thread-related internal changes.
  550. * 14-Jul: mus_data_format_zero.
  551. * 12-Jul: mus_interp_type_p and mus_fft_window_p for C++'s benefit.
  552. * 1-July: mus-safety and various ints changed to mus_long_t.
  553. * 20-Jun: support for pthreads.
  554. * 16-Jun: changed init_mus_module to mus_initialize.
  555. * 30-May: changed polyshape to use cos and added cheby_choice arg to mus_make_polyshape.
  556. * 27-May: mus_waveshape retired -- generators.scm has a wrapper for it.
  557. * clm_free, clm_realloc etc for rt work.
  558. * mus_chebyshev_tu_sum.
  559. * 25-May: mus_polywave algorithm changed.
  560. * 17-May: mus_normalize_partials.
  561. * 12-Apr: added choice arg to mus_make_polywave.
  562. * 8-Apr: polywave uses sine-bank if highest harmonic out of Chebyshev range.
  563. * 1-Mar: mus_set_name.
  564. * 26-Feb: removed mus_cosines (use mus_length)
  565. * 24-Feb: removed mus_make_env_with_start, added mus_make_env_with_length
  566. * 20-Feb: clm 4:
  567. * polywave for polyshape and waveshape.
  568. * mus_formant_with_frequency.
  569. * firmant generator.
  570. * removed mus_formant_radius and mus_set_formant_radius.
  571. * removed "gain" arg from mus_make_formant.
  572. * reversed the order of the arguments to mus_make_formant.
  573. * fixed long-standing bug in gain calculation in mus_formant.
  574. * mus_env_any for arbitrary connecting functions.
  575. * 15-Feb: nrxysin and nrxycos for sine-summation.
  576. * 12-Feb: nsin for sum_of_sines, ncos for sum_of_cosines.
  577. * 4-Feb: clm_default_frequency (clm2xen) and *clm-default-frequency* (ws.scm).
  578. * 7-Jan-08: :dur replaced by :length in make-env.
  579. * --------
  580. * 19-Oct: all *_0 *_1 *_2 names now use _fm|_pm|_unmodulated|_no_input.
  581. * 17-Oct: replace some method macros with functions (def-clm-struct local methods need true names).
  582. * 15-Oct: mus_oscil_1 -> _fm, _2->_pm.
  583. * mus_phase_vocoder_outctr accessors changed to use mus_location.
  584. * 11-Oct: changed default srate to 44100.
  585. * 5-Oct: mus_oscil_2.
  586. * 6-Sep: changed asymmetric-fm to use cos(sin) and added amplitude normalization.
  587. * 6-Aug: mus_autocorrelate, mus_correlate.
  588. * 3-Aug: blackman5..10 and Rife-Vincent (RV2..4 fft), mlt-sine windows.
  589. * 16-July: removed start arg from mus_make_env (see mus_make_env_with_start).
  590. * 5-July: changed some mus_float_ts to doubles in env funcs.
  591. * exp envs now use repeated multiplies rather than direct exp call.
  592. * 19-June: mus-increment on gens with a notion of frequency (phase increment);
  593. * to make room for this, asymmetric-fm ratio and sine-summation b moved to mus-offset.
  594. * 22-Feb: mus_big_fft and mus_spectrum_t.
  595. * 21-Feb: mus_fft_window_name.
  596. * 14-Feb-07: three more fft window choices.
  597. * --------
  598. * 27-Nov: move-sound array access parallel to locsig.
  599. * 22-Nov: had to add non-backwards-compatible reverb chans arg to mus_make_locsig.
  600. * 21-Nov: mus_float_equal_fudge_factor, mus_arrays_are_equal.
  601. * 30-July: renamed average to moving_average.
  602. * 28-July: renamed make_ppolar and make_zpolar to make_two_pole|zero_from_radius_and_frequency.
  603. * added mus_scaler and mus_frequency methods for two_pole and two_zero.
  604. * 21-July: removed mus_wrapper field -- old way can't work since we need the original Xen object.
  605. * 3-July: mus_move_sound (dlocsig) generator.
  606. * changed return type of mus_locsig to float.
  607. * 28-June: mus_filtered_comb generator.
  608. * 8-May: mus_apply now takes 3 args: gen, two doubles (rather than bug-prone varargs).
  609. * 1-Mar-06: granulate now has a local random number seed (settable via the mus-location method).
  610. * --------
  611. * 20-Dec: samaraki and ultraspherical windows.
  612. * this required a non-backwards-compatible additional argument in mus_make_fft_window_with_window.
  613. * 1-Nov: mus_filter_set_x|ycoeffs, mus_filter_set_order (needed by Snd).
  614. * 1-May: mus-scaler|feedback ok with delay and average.
  615. * 18-Apr: mus_set_environ.
  616. * 11-Apr: mus_mixer|frame_offset, mus_frame_scale (for higher level generic functions).
  617. * 23-Mar: frame_to_frame arg interpretation changed.
  618. * 21-Mar: mus_make_readin|file_to_sample|file_to_frame_with_buffer_size.
  619. * 16-Mar: polyshape generator (waveshaper as polynomial + oscil)
  620. * mus_chebyshev_first|second_kind.
  621. * mus_partials_to_waveshape no longer normalizes the partials.
  622. * 18-Feb: mus_interpolate.
  623. * 14-Feb: deprecated mus_restart_env and mus_clear_filter_state.
  624. * 7-Feb-05: mus_reset method, replaces mus_restart_env and mus_clear_filter_state.
  625. * --------
  626. * 20-Dec: changed "jitter" handling if hop < .05 in granulate.
  627. * 15-Dec: mus_generator? for type checks (clm2xen).
  628. * 11-Sep: removed buffer generator.
  629. * 6-Sep: removed mus_oscil_bank, mus_bank.
  630. * 24-Aug: removed mus_inspect method -- overlaps mus_describe and is useless given gdb capabilities.
  631. * 27-July: mus_granulate_with_editor and mus_phase_vocoder_with_editors.
  632. * 21-July: edit-func as run-time arg to granulate (for CL/clm compatibility)
  633. * 19-July: clm 3:
  634. * deprecated mus_ina|b, mus-outa|b|c|d.
  635. * mus_make_frame_to_file_with_comment, mus_mixer_scale, mus_make_frame|mixer_with_data.
  636. * mus_make_scalar_mixer, mus_mixer_add, mus_continue_frame_to_file.
  637. * changed pv_* to phase_vocoder_*
  638. * 28-June: ssb_am + added fm arg (ssb_am_1 is the previous form).
  639. * 21-June: wrapper method.
  640. * 14-June: ssb_am generator.
  641. * deprecated mus-a*|b*, replaced by mus-x|ycoeff.
  642. * 9-June: mus_edot_product.
  643. * 7-June: removed mus-x*|y* generic functions.
  644. * 24-May: distribution arg to make-rand, make-rand-interp.
  645. * 11-May: type arg to mus_make_table_lookup|wave_train, MUS_INTERP_NONE, MUS_INTERP_HERMITE.
  646. * mus-interp-type.
  647. * 10-May: changed MUS_LINEAR and MUS_SINUSOIDAL to MUS_INTERP_LINEAR and MUS_INTERP_SINUSOIDAL.
  648. * mus-linear renamed mus-interp-linear, mus-sinusoidal renamed mus-interp-sinusoidal.
  649. * added type arg to mus_make_delay|all_pass|comb|notch.
  650. * added mus_delay_tick, all-pass delay line interpolation.
  651. * 3-May: envelope arg to make-rand and make-rand-interp to give any arbitrary random number distribution.
  652. * added mus_make_rand_with_distribution and mus_make_rand_interp_with_distribution.
  653. * rand/rand-interp mus-data returns distribution (weight) function, mus-length its length.
  654. * locsig mus-data returns output scalers, mus-xcoeffs returns reverb scalers
  655. * 26-Apr: mus_sum_of_sines changed to mus_sine_bank.
  656. * new mus_sum_of_sines parallels mus_sum_of_cosines.
  657. * deprecated mus_sin.
  658. * 14-Apr: changed "2" to "_to_" in several function names.
  659. * 12-Apr: mus_average, mus_average_p, mus_make_average.
  660. * 17-Mar: edit function added to mus_granulate.
  661. * replaced MUS_DATA_POSITION with MUS_DATA_WRAPPER.
  662. * 22-Jan: various "environ" variables renamed for Windows' benefit.
  663. * 5-Jan-04: env_interp bugfix.
  664. * --------
  665. * 29-Sep: removed length arg from spectrum in clm2xen.
  666. * 24-Aug: changed mus_length|ramp|hop type to mus_long_t.
  667. * 21-Aug: export MUS_INPUT and friends (needed for specialized INA handlers).
  668. * 11-Aug: int -> bool.
  669. * 7-Aug: removed mus_type.
  670. * 20-July: more run methods.
  671. * 15-July: linear->dB check for 0.0 arg.
  672. * 27-June: mus_samples_to_seconds and mus_seconds_to_samples.
  673. * 9-June: mus_mix_with_reader_and_writer.
  674. * 27-May: bugfix: interpolating all-pass ("zall-pass") had an extra delay.
  675. * 25-Apr: mus_spectrum and mus_convolution now return mus_float_t*.
  676. * 9-Apr: removed MUS_HANNING_WINDOW (use MUS_HANN_WINDOW).
  677. * 3-Mar: mus_delay_line_p for tap error checking.
  678. * 27-Feb: mus_length for env -> original duration in samples.
  679. * 21-Feb: mus_set_cosines added, mus_cosines moved to hop slot.
  680. * mus_[set_]x1/x2/y1/y2.
  681. * 10-Feb: mus_file_name moved into the mus_input|output structs.
  682. * folded mus_input|output into mus_any.
  683. * moved mus_frame|mixer declarations into clm.c.
  684. * all mus_input|output|frame|mixer pointers->mus_any.
  685. * all method void pointers->mus_any.
  686. * 7-Feb: split strings out of clm2xen.c into clm-strings.h.
  687. * 3-Feb: mus_offset for envs, mus_width for square_wave et al.
  688. * new core class fields(10) for various methods.
  689. * 7-Jan-03: mus_src with very large sr_change segfault bugfix.
  690. * --------
  691. * 17-Dec: mus_env_offset|initial_power for Snd exp env optimizations.
  692. * 13-Sep: mus_frandom and mus_irandom(for Snd optimizer).
  693. * 19-Aug: changed internal phase-vocoder array accessor names
  694. * 13-Aug: set!(*-ref) for frame, locsig, mixer, locsig-reverb.
  695. * 29-Jul: various *_1 cases for the optimizer.
  696. * 15-Jul: mus_continue_sample2file.
  697. * 10-Jul: mus_file_name.
  698. * 7-Jun: fftw support added.
  699. * 31-May: changed mus_any_class.
  700. * 3-May: many int->mus_long_t changes for large files.
  701. * 8-Apr: off-by-1 env bug(Lisp/C are now identical), env_interp of exp env beyond end bugfix.
  702. * 1-Apr: sine-summation n=0 bugfix.
  703. * 27-Mar: negative degree locsig bugfix.
  704. * 18-Mar: mus_move_locsig.
  705. * 15-Mar: n-chan locsig(and reverb scalers), 'type' arg to mus_make_locsig.
  706. * 6-Mar: mus_scaler in asymmetric-fm now refers to the "r" parameter, "a" in sine-summation.
  707. * 5-Mar: dumb typo in asymmetric-fm generator fixed.
  708. * 19-Feb: buffer reallocation redundant free bugfix.
  709. * 25-Jan-02: mus_increment of env returns base.
  710. * --------
  711. * 10-Dec: add outctr calls, phase-vocoder bugfixes, thanks to Scott Wilson.
  712. * 21-Oct: fill in some set-data methods.
  713. * 1-Sep: mus_polar2rectangular.
  714. * 6-July: scm -> xen.
  715. * 26-May: mus_rand_seed.
  716. * 22-May: locsig reverb distance calc was upside down.
  717. * 18-May: mus_describe and mus_inspect returned string should not be freed any more.
  718. * 7-May: filled in some leftover equal_p methods.
  719. * 1-Apr: mus_make_file2sample_with_comment and mus_length for file->sample/sample->file.
  720. * mus_file_buffer_size.
  721. * 26-Mar: extended_type field added to mus_any_class for more robust type checking.
  722. * 16-Mar: mus_phase of env -> current_value.
  723. * 28-Feb: added mus_position(currently only for envs).
  724. * 8-Feb: clm2scm.h.
  725. * 24-Jan: mus-bank in clm2scm.
  726. * 5-Jan: clm2scm gens are applicable.
  727. * 4-Jan: mus_bank.
  728. * 2-Jan-01: mus_run method.
  729. * --------
  730. * 28-Dec: mus_clear_filter_state and other minor tweaks for Snd.
  731. * 28-Nov: Dolph-Chebyshev window(under HAVE_GSL flag -- needs complex trig support).
  732. * 8-Nov: mus_clear_sinc_tables.
  733. * 12-Oct: mus_formant_bank takes one input(can't remember why I had an array here)
  734. * 27-Sep: mus_array_interp bugfix(imitates mus.lisp now).
  735. * 18-Sep: clm now assumes it's used as a part of sndlib.
  736. * 11-Sep: generalized set! to generic functions in clm2scm.c.
  737. * 31-Aug: changed formant field setters(thanks to Anders Vinjar).
  738. * 10-Aug: removed built-in setf support(clm2scm.c).
  739. * 31-Jul: mus_granulate tries to protect against illegal length and ramp values.
  740. * 24-Jul: mus_make_fir_coeffs.
  741. * 20-Jul: sum_of_sines, atan2 to rectangular->polar, phase_vocoder gen.
  742. * 22-June: made mus_bessi0 local again.
  743. * 1-June: bugfixes for linuxppc 2000.
  744. * 19-May: mus_apply.
  745. * 8-May: added "const" and XEN_PROCEDURE_CAST(for c++), made mus_bessi0 global.
  746. * 24-Apr: changed formant radius to match lisp version(it's now 1-old_radius)
  747. * 20-Apr: mus_convolve_files
  748. * 7-Apr: src width bug fixed
  749. * 31-Mar: finally implemented set-location for envs.
  750. * 14-Feb: buffer-full?.
  751. * 1-Feb: removed mus_phasepartials2waveshape.
  752. * 3-Jan-00: format and type args added to make_sample2file,
  753. * mus_file_close.
  754. * removed make_file_input and make_file_output.
  755. * --------
  756. * 29-Dec: various bugfixes especially in envelope handlers.
  757. * 19-Nov: mus_oscil_bank and mus_formant_bank.
  758. * 5-Nov: mus_sin exported.
  759. * 4-Oct:(scm) make-env arg order changed to reflect mus.lisp.
  760. * 29-Sep: implemented mus-increment and mus-frequency for granulate(as in mus.lisp).
  761. * clm's fft renamed mus-fft to avoid collision with snd's version.
  762. * added max_size arg to make_granulate(to reflect mus.lisp).
  763. * 25-Sep-99: added width arg to make_src -- forgot this somehow in first pass.
  764. * decided to make mus_inspect return char* like mus_describe.
  765. */