| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891 |
- /*
- * 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
- *
- */
- /* 03/2020: TW/RWD: corrected usage message argument lists */
- /* floatsam version: no changes */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- #include <structures.h>
- #include <cdpmain.h>
- #include <tkglobals.h>
- #include <pnames.h>
- #include <texture.h>
- #include <processno.h>
- #include <modeno.h>
- #include <globcon.h>
- #include <logic.h>
- #include <filetype.h>
- #include <mixxcon.h>
- #include <flags.h>
- #include <speccon.h>
- #include <arrays.h>
- #include <special.h>
- #include <formants.h>
- #include <sfsys.h>
- #include <osbind.h>
- #include <srates.h>
- /********************************************************************************************/
- /********************************** FORMERLY IN pconsistency.c ******************************/
- /********************************************************************************************/
- static int texture_pconsistency(dataptr dz);
- /********************************************************************************************/
- /********************************** FORMERLY IN specialin.c *********************************/
- /********************************************************************************************/
- static int get_the_notedatafile(char *filename,dataptr dz);
- /***************************************************************************************/
- /****************************** FORMERLY IN aplinit.c **********************************/
- /***************************************************************************************/
- /***************************** ESTABLISH_BUFPTRS_AND_EXTRA_BUFFERS **************************/
- int establish_bufptrs_and_extra_buffers(dataptr dz)
- {
- /*int is_spec = FALSE;*/
- dz->bptrcnt = 0;
- dz->bufcnt = 0;
- switch(dz->process) {
- case(SIMPLE_TEX):
- case(TIMED):
- case(GROUPS):
- case(TGROUPS):
- case(DECORATED):
- case(PREDECOR):
- case(POSTDECOR):
- case(ORNATE):
- case(PREORNATE):
- case(POSTORNATE):
- case(MOTIFS):
- case(TMOTIFS):
- case(MOTIFSIN):
- case(TMOTIFSIN):
- dz->extra_bufcnt = 0; dz->bufcnt = 1;
- break;
- default:
- sprintf(errstr,"Unknown program type [%d] in establish_bufptrs_and_extra_buffers()\n",dz->process);
- return(PROGRAM_ERROR);
- }
- return establish_groucho_bufptrs_and_extra_buffers(dz);
- }
- /***************************** SETUP_INTERNAL_ARRAYS_AND_ARRAY_POINTERS **************************/
- int setup_internal_arrays_and_array_pointers(dataptr dz)
- {
- int n;
- dz->ptr_cnt = -1; /* base constructor...process */
- dz->array_cnt = -1;
- dz->iarray_cnt = -1;
- dz->larray_cnt = -1;
- switch(dz->process) {
- case(SIMPLE_TEX):
- case(TIMED):
- case(GROUPS):
- case(TGROUPS):
- case(DECORATED):
- case(PREDECOR):
- case(POSTDECOR):
- case(ORNATE):
- case(PREORNATE):
- case(POSTORNATE):
- case(MOTIFS):
- case(TMOTIFS):
- case(MOTIFSIN):
- case(TMOTIFSIN):
- dz->array_cnt = 1; dz->iarray_cnt = 6; dz->larray_cnt = 0; dz->ptr_cnt = 0; dz->fptr_cnt = 0;
- break;
- }
- /*** WARNING ***
- ANY APPLICATION DEALING WITH A NUMLIST INPUT: MUST establish AT LEAST 1 double array: i.e. dz->array_cnt = at least 1
- **** WARNING ***/
- if(dz->array_cnt < 0 || dz->iarray_cnt < 0 || dz->larray_cnt < 0 || dz->ptr_cnt < 0 || dz->fptr_cnt < 0) {
- sprintf(errstr,"array_cnt not set in setup_internal_arrays_and_array_pointers()\n");
- return(PROGRAM_ERROR);
- }
- if(dz->array_cnt > 0) {
- if((dz->parray = (double **)malloc(dz->array_cnt * sizeof(double *)))==NULL) {
- sprintf(errstr,"INSUFFICIENT MEMORY for internal double arrays.\n");
- return(MEMORY_ERROR);
- }
- for(n=0;n<dz->array_cnt;n++)
- dz->parray[n] = NULL;
- }
- if(dz->iarray_cnt > 0) {
- if((dz->iparray = (int **)malloc(dz->iarray_cnt * sizeof(int *)))==NULL) {
- sprintf(errstr,"INSUFFICIENT MEMORY for internal int arrays.\n");
- return(MEMORY_ERROR);
- }
- for(n=0;n<dz->iarray_cnt;n++)
- dz->iparray[n] = NULL;
- }
- if(dz->larray_cnt > 0) {
- if((dz->lparray = (int **)malloc(dz->larray_cnt * sizeof(int *)))==NULL) {
- sprintf(errstr,"INSUFFICIENT MEMORY for internal long arrays.\n");
- return(MEMORY_ERROR);
- }
- for(n=0;n<dz->larray_cnt;n++)
- dz->lparray[n] = NULL;
- }
- if(dz->ptr_cnt > 0) {
- if((dz->ptr = (double **)malloc(dz->ptr_cnt * sizeof(double *)))==NULL) {
- sprintf(errstr,"INSUFFICIENT MEMORY for internal pointer arrays.\n");
- return(MEMORY_ERROR);
- }
- for(n=0;n<dz->ptr_cnt;n++)
- dz->ptr[n] = NULL;
- }
- if(dz->fptr_cnt > 0) {
- if((dz->fptr = (float **)malloc(dz->fptr_cnt * sizeof(float *)))==NULL) {
- sprintf(errstr,"INSUFFICIENT MEMORY for internal float-pointer arrays.\n");
- return(MEMORY_ERROR);
- }
- for(n=0;n<dz->fptr_cnt;n++)
- dz->fptr[n] = NULL;
- }
- return(FINISHED);
- }
- /****************************** ASSIGN_PROCESS_LOGIC *********************************/
- int assign_process_logic(dataptr dz)
- {
- switch(dz->process) {
- case(SIMPLE_TEX):
- case(TIMED):
- case(GROUPS):
- case(TGROUPS):
- case(DECORATED):
- case(PREDECOR):
- case(POSTDECOR):
- case(ORNATE):
- case(PREORNATE):
- case(POSTORNATE):
- case(MOTIFS):
- case(TMOTIFS):
- case(MOTIFSIN):
- case(TMOTIFSIN):
- setup_process_logic(ONE_OR_MANY_SNDFILES, UNEQUAL_SNDFILE, SNDFILE_OUT, dz);
- break;
- default:
- sprintf(errstr,"Unknown process: assign_process_logic()\n");
- return(PROGRAM_ERROR);
- break;
- }
- if(dz->has_otherfile) {
- switch(dz->input_data_type) {
- case(ALL_FILES):
- case(TWO_SNDFILES):
- case(SNDFILE_AND_ENVFILE):
- case(SNDFILE_AND_BRKFILE):
- case(SNDFILE_AND_UNRANGED_BRKFILE):
- case(SNDFILE_AND_DB_BRKFILE):
- break;
- case(MANY_SNDFILES):
- if(dz->process==INFO_TIMELIST)
- break;
- /* fall thro */
- default:
- sprintf(errstr,"Most processes accepting files with different properties\n"
- "can only take 2 sound infiles.\n");
- return(PROGRAM_ERROR);
- }
- }
- return(FINISHED);
- }
- /***************************** SET_LEGAL_INFILE_STRUCTURE **************************
- *
- * Allows 2nd infile to have different props to first infile.
- */
- void set_legal_infile_structure(dataptr dz)
- {
- switch(dz->process) {
- default:
- dz->has_otherfile = FALSE;
- break;
- }
- }
- /***************************************************************************************/
- /****************************** FORMERLY IN internal.c *********************************/
- /***************************************************************************************/
- /****************************** SET_LEGAL_INTERNALPARAM_STRUCTURE *********************************/
- int set_legal_internalparam_structure(int process,int mode,aplptr ap)
- {
- int exit_status = FINISHED;
- switch(process) {
- case(SIMPLE_TEX): case(TIMED): case(GROUPS): case(TGROUPS):
- case(DECORATED): case(PREDECOR): case(POSTDECOR):
- case(ORNATE): case(PREORNATE):case(POSTORNATE):
- case(MOTIFS): case(TMOTIFS): case(MOTIFSIN): case(TMOTIFSIN):
- exit_status = set_internalparam_data("iiidddi",ap); break;
- default:
- sprintf(errstr,"Unknown process in set_legal_internalparam_structure()\n");
- return(PROGRAM_ERROR);
- }
- return(exit_status);
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN specialin.c *********************************/
- /********************************************************************************************/
- /********************** READ_SPECIAL_DATA ************************/
- int read_special_data(char *str,dataptr dz)
- {
- /* int exit_status = FINISHED;*/
- aplptr ap = dz->application;
- switch(ap->special_data) {
- case(TEX_NOTEDATA): return get_the_notedatafile(str,dz);
- default:
- sprintf(errstr,"Unknown special_data type: read_special_data()\n");
- return(PROGRAM_ERROR);
- }
- return(FINISHED); /* NOTREACHED */
- }
- /***************************** GET_THE_NOTEDATAFILE ****************************/
- int get_the_notedatafile(char *filename,dataptr dz)
- {
- if((dz->fp = fopen(filename,"r"))==NULL) {
- sprintf(errstr,"Failed to open notedata file %s\n",filename);
- return(DATA_ERROR);
- }
- return(FINISHED);
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN preprocess.c ********************************/
- /********************************************************************************************/
- /****************************** PARAM_PREPROCESS *********************************/
- int param_preprocess(dataptr dz)
- {
- /* int exit_status = FINISHED;*/
- switch(dz->process) {
- case(SIMPLE_TEX): case(TIMED): case(GROUPS): case(TGROUPS):
- case(DECORATED): case(PREDECOR): case(POSTDECOR):
- case(ORNATE): case(PREORNATE):case(POSTORNATE):
- case(MOTIFS): case(TMOTIFS): case(MOTIFSIN): case(TMOTIFSIN):
- return texture_preprocess(dz);
- default:
- sprintf(errstr,"PROGRAMMING PROBLEM: Unknown process in param_preprocess()\n");
- return(PROGRAM_ERROR);
- }
- return(FINISHED); /* NOTREACHED */
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN procgrou.c **********************************/
- /********************************************************************************************/
- /**************************** GROUCHO_PROCESS_FILE ****************************/
- int groucho_process_file(dataptr dz) /* FUNCTIONS FOUND IN PROCESS.C */
- {
- int exit_status = FINISHED;
- switch(dz->process) {
- case(SIMPLE_TEX): case(TIMED): case(GROUPS): case(TGROUPS):
- case(DECORATED): case(PREDECOR): case(POSTDECOR):
- case(ORNATE): case(PREORNATE):case(POSTORNATE):
- case(MOTIFS): case(MOTIFSIN): case(TMOTIFS): case(TMOTIFSIN):
- if((exit_status = make_texture(dz))<0)
- return(exit_status);
- if((exit_status = produce_texture_sound(dz))<0)
- return(exit_status);
- break;
- default:
- sprintf(errstr,"Unknown case in process_file()\n");
- return(PROGRAM_ERROR);
- }
- return(FINISHED);
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN pconsistency.c ******************************/
- /********************************************************************************************/
- /****************************** CHECK_PARAM_VALIDITY_AND_CONSISTENCY *********************************/
- int check_param_validity_and_consistency(dataptr dz)
- {
- /* int exit_status = FINISHED;*/
- handle_pitch_zeros(dz);
- switch(dz->process) {
- case(SIMPLE_TEX): case(TIMED): case(GROUPS): case(TGROUPS):
- case(DECORATED): case(PREDECOR): case(POSTDECOR):
- case(ORNATE): case(PREORNATE): case(POSTORNATE):
- case(MOTIFS): case(TMOTIFS): case(MOTIFSIN): case(TMOTIFSIN):
- return texture_pconsistency(dz);
- }
- return(FINISHED);
- }
- /***************************** PREPARE_TEXTURE_PARAMETERS ****************************/
- int texture_pconsistency(dataptr dz)
- {
- double *p, *end;
- int OK = TRUE;
- if(dz->brksize[TEXTURE_INSLO]) {
- p = dz->brk[TEXTURE_INSLO] + 1;
- end = dz->brk[TEXTURE_INSLO] + (dz->brksize[TEXTURE_INSLO] * 2);
- while(p < end) {
- if(*p > (double)dz->infilecnt) {
- OK = FALSE;
- break;
- }
- p += 2;
- }
- } else if(dz->iparam[TEXTURE_INSLO] > dz->infilecnt)
- OK = FALSE;
- if(!OK) {
- sprintf(errstr,"FIRST SND-IN-LIST TO USE > count of files entered: cannot proceed.\n");
- return(DATA_ERROR);
- }
- OK = TRUE;
- if(dz->brksize[TEXTURE_INSHI]) {
- p = dz->brk[TEXTURE_INSHI] + 1;
- end = dz->brk[TEXTURE_INSHI] + (dz->brksize[TEXTURE_INSHI] * 2);
- while(p < end) {
- if(*p > (double)dz->infilecnt) {
- OK = FALSE;
- break;
- }
- p += 2;
- }
- } else if(dz->iparam[TEXTURE_INSHI] > dz->infilecnt)
- OK = FALSE;
- if(!OK) {
- sprintf(errstr,"LAST SND-IN-LIST TO USE > count of files entered: cannot proceed.\n");
- return(DATA_ERROR);
- }
- return(FINISHED);
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN buffers.c ***********************************/
- /********************************************************************************************/
- /**************************** ALLOCATE_LARGE_BUFFERS ******************************/
- int allocate_large_buffers(dataptr dz)
- {
- switch(dz->process) {
- case(SIMPLE_TEX):
- case(TIMED): case(GROUPS): case(TGROUPS):
- case(DECORATED): case(PREDECOR): case(POSTDECOR):
- case(ORNATE): case(PREORNATE): case(POSTORNATE):
- case(MOTIFS): case(TMOTIFS): case(MOTIFSIN):
- case(TMOTIFSIN):
- return create_sndbufs(dz);
- default:
- sprintf(errstr,"Unknown program no. in allocate_large_buffers()\n");
- return(PROGRAM_ERROR);
- }
- return(FINISHED); /* NOTREACHED */
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN cmdline.c ***********************************/
- /********************************************************************************************/
- int get_process_no(char *prog_identifier_from_cmdline,dataptr dz)
- {
- if (!strcmp(prog_identifier_from_cmdline,"simple")) dz->process = SIMPLE_TEX;
- else if(!strcmp(prog_identifier_from_cmdline,"grouped")) dz->process = GROUPS;
- else if(!strcmp(prog_identifier_from_cmdline,"motifs")) dz->process = MOTIFS;
- else if(!strcmp(prog_identifier_from_cmdline,"motifsin")) dz->process = MOTIFSIN;
- else if(!strcmp(prog_identifier_from_cmdline,"decorated")) dz->process = DECORATED;
- else if(!strcmp(prog_identifier_from_cmdline,"predecor")) dz->process = PREDECOR;
- else if(!strcmp(prog_identifier_from_cmdline,"postdecor")) dz->process = POSTDECOR;
- else if(!strcmp(prog_identifier_from_cmdline,"ornate")) dz->process = ORNATE;
- else if(!strcmp(prog_identifier_from_cmdline,"preornate")) dz->process = PREORNATE;
- else if(!strcmp(prog_identifier_from_cmdline,"postornate")) dz->process = POSTORNATE;
- else if(!strcmp(prog_identifier_from_cmdline,"timed")) dz->process = TIMED;
- else if(!strcmp(prog_identifier_from_cmdline,"tgrouped")) dz->process = TGROUPS;
- else if(!strcmp(prog_identifier_from_cmdline,"tmotifs")) dz->process = TMOTIFS;
- else if(!strcmp(prog_identifier_from_cmdline,"tmotifsin")) dz->process = TMOTIFSIN;
- else {
- sprintf(errstr,"Unknown program identification string '%s'\n",prog_identifier_from_cmdline);
- return(USAGE_ONLY);
- }
- return FINISHED;
- }
- /********************************************************************************************/
- /********************************** FORMERLY IN usage.c *************************************/
- /********************************************************************************************/
- /******************************** USAGE1 ********************************/
- int usage1(void)
- {
- fprintf(stdout, /* HAs to use fprintf because of kbhit */
- "\n"
- "USAGE:\ntexture NAME (mode) infile (infile2..etc) outfile notedata params:\n"
- "\n"
- "\nwhere NAME can be any one of\n"
- "\n"
- "\tTEXTURE MADE FROM ONE OR SEVERAL SOUND FILES\n"
- "\n"
- "simple grouped decorated ornate motifs\n"
- " predecor preornate motifsin\n"
- " postdecor postornate\n"
- "\n"
- "\tTIMED TEXTURES MADE FROM ONE OR SEVERAL SOUND FILES\n"
- "\n"
- "timed tmotifs tmotifsin tgrouped\n"
- "\n"
- "ORNAMENTS & MOTIFS have user-specified pitch-shapes.\n"
- "DECORATIONS & GROUPS have random pitch-shapes.\n"
- "\n"
- "Type 'texture simple' for more info on simple texture option.... etc.\n"
- "\n"
- #ifdef IS_PC
- "MORE??? ----- (hit keyboard)\n"
- "\n");
- while(!kbhit())
- ;
- if(kbhit()) {
- #else
- "\n");
- #endif
- fprintf(stdout,
- "\n"
- "*********************************************************************\n"
- "SOME SPECIAL PARAMETER VALUES\n"
- "*********************************************************************\n"
- "GPSPACE: spatialisation of event-groups\n"
- "\n"
- " 0:still 1:scattered(default) 2:towards-texture-centre\n"
- " 3:away-from-centre 4:follow-texmotion 5:contrary-to-motion\n"
- " 4 & 5 only function if spatial position varies in time..\n"
- "*********************************************************************\n"
- "CONTOUR: amplitude contour of groups\n"
- "\n"
- " 0:mixed(default) 1:cresc 2:flat 3:decresc 4:c_or_fl\n"
- " 5:c_or_d 6:d_or_fl [7:directed_to_event 8:dir_or_flat]\n"
- "*********************************************************************\n"
- "CENTRING: how decoration pitches centre on decorated line pitches\n"
- "\n"
- " 0: centred(default) 1: above 2: below\n"
- " 3: c_and_a 4: c_and_b 5: a_and_b 6: c_and_a_and_b\n"
- " In all cases except 0, pitchrange shifted to tally with line pitch\n\n"
- "\n"
- "*********************************************************************\n"
- " ALL OTHER PARAMS, except outdur, MAY VARY IN TIME.\n"
- "*********************************************************************\n"
- "\n"
- #ifdef IS_PC
- "MORE??? ----- (hit keyboard)\n");
- }
- _getch();
- while(!kbhit())
- ;
- if(kbhit()) {
- #else
- "\n");
- #endif
- fprintf(stdout,
- "\n"
- "*********************************************************************\n"
- "HARMONIC SETS use only the pitches specified.\n"
- "\n"
- "HARMONIC FIELDS duplicate the specified pitches in all 8vas.\n"
- "*********************************************************************\n"
- "NOTEDATA is in a textfile containing.....\n"
- "*********************************************************************\n"
- " assumed MIDI 'pitch' of each input snd, specified on 1st line.\n"
- "\n"
- " FOLLOWED BY, where ness, NOTELIST(S), SPECIFIED THUS:-\n"
- "\n"
- " #N (where N = no. of notes in notelist: follows by N lines of...)\n"
- " time(SECS) infile_no pitch(MIDI) amp(MIDI) dur(SECS)\n"
- "\n"
- "where times within motif must increase (or remain same, during chords)\n"
- "*********************************************************************\n"
- "NOTELISTS REPRESENT: IN THIS ORDER..\n"
- "*********************************************************************\n"
- "Notelist of notes in any timed, ornamented or decorated line in texture.\n"
- "Notelist of notes in any harmonic field(s) or set(s) specified.\n"
- " (For more than one hfield(hset),\n"
- " data should specify chords, placed at appropriae times.)\n"
- "Notelist(s) of notes in any ornament(s) or motif(s) specified.\n"
- "*********************************************************************\n");
- #ifdef IS_PC
- }
- #endif
- return(USAGE_ONLY);
- }
- /******************************** USAGE2 ********************************/
- int usage2(char *str)
- {
- if(!strcmp(str,"simple")) {
- fprintf(stdout,
- "USAGE:\n"
- "texture simple mode infile [infile2...] outfile notedata outdur packing scatter\n"
- " tgrid sndfirst sndlast mingain maxgain mindur maxdur minpich maxpich omit\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w -c -p]\n"
- "MODES:-\n"
- "1) ON A GIVEN HARMONIC-FIELD 3) ON A GIVEN HARMONIC-SET\n"
- "2) ON CHANGING HARMONIC-FIELDS 4) ON CHANGING HARMONIC-SETS\n"
- "5) NONE\n"
- "notedata: infofile, insnd 'pitches',harmonic fields pitches etc.\n"
- "outdur: (min) duration of outfile\n"
- "packing: (average) time between event onsets.\n"
- "scatter: randomisation of event-onsets (0 - %.0lf)\n"
- "tgrid: minstep(MS) quantised timegrid(for grp starttimes)(default 0)\n"
- "sndfirst,sndlast: 1st,last snd to use,from list of insnds(range:1 - no.of snds)\n"
- "mingain,maxgain: minimum & maximum level of input events (1-127:default 64,64)\n"
- "mindur,maxdur: minimum & maximum duration of events in texture\n"
- "minpich,maxpich: minimum & maximum pitch (MIDI VALUE):\n"
- "omit: 1 in \"omit\" events are silent.\n"
- " less and less silent events as param increases.\n"
- " at 64 (as at zero) NO events are silent.\n"
- "atten: overall attenuation of the output\n"
- "position: centre of output sound-image (0(Left) 1(Right): default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-c: Choose files cyclically in listed order (ignore 'sndfirst','last').\n"
- "-p: Random permute each cycle (only when -c flag set).\n",MAX_SCAT_TEXTURE);
- } else if(!strcmp(str,"timed")) {
- fprintf(stdout,
- "TIMED TEXTURE: USAGE:\n"
- "texture timed mode infile [infile2...] outfile notedata outdur skiptime\n"
- " sndfirst sndlast mingain maxgain mindur maxdur minpitch maxpitch\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w]\n"
- "MODES:-\n"
- "1) ON A GIVEN HARMONIC-FIELD 3) ON A GIVEN HARMONIC-SET\n"
- "2) ON CHANGING HARMONIC-FIELDS 4) ON CHANGING HARMONIC-SETS\n"
- "5) NONE\n"
- "notedata: infofile, insnd 'pitches',texture timing,harmonic fields pitches etc.\n"
- "outdur: (min) duration of outfile\n"
- "skiptime: time between repetitions of timing motif in notedata\n"
- "sndfirst,sndlast: 1st,last snd to use,from list of insnds(range:1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "mindur,maxdur: min & max duration of events in texture\n"
- "minpitch,maxpitch: min & max pitch (MIDI VALUE)\n"
- "atten: overall attenuation of the output\n"
- "position: centre of output sound-image (0(Left) 1(Right):default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n");
- } else if(!strcmp(str,"grouped")) {
- fprintf(stdout,
- "TEXTURE OF EVENT-GROUPS: USAGE: texture grouped mode infile [infile2..] outfile\n"
- "notedata outdur packing scatter tgrid\n"
- "sndfirst sndlast mingain maxgain mindur maxdur minpitch maxpitch phgrid gpspace\n"
- "gpsprange amprise contour gpsizelo gpsizehi gppaklo gppakhi gpranglo gpranghi\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w] [-d] [-i]\n"
- "MODES:-\n"
- "1)ON HARMONIC-FIELD 2)CHANGING HFLDS 3)HARMONIC-SET 4)CHANGING HSETS 5)NONE\n"
- "notedata: infofile, 'pitch' of insnds, harmonic fields etc.\n"
- "outdur: (min) duration of outfile\n"
- "packing: (average) time between group onsets.\n"
- "scatter: randomisation of event-onsets (0 - %.0lf)\n"
- "tgrid: minstep(MS) quantised timegrid(for grp starttimes)(default 0)\n"
- "sndfirst,sndlast: 1st,last snd to use, from list of insnds(range:1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "mindur,maxdur: min & max duration of events in texture\n"
- "minpitch,maxpitch:min & max pitch (MIDI VALUE)\n"
- "phgrid: a timegrid (MS) applying WITHIN the groups\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within groups: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-6: default 0)\n"
- /* NOTE : CARE all_types is 7 AND NOT 8 here */
- "gpsizelo,gpsizehi:smallest,largest no. of events in groups\n"
- "gppaklo,gppakhi: shortest,longest time between event-onsets in groups (MS)\n"
- "gpranglo,gpranghi:min,max pitchrange grps OR (hfields) no.of hf-notes range\n"
- "atten: overall attenuation of output\n"
- "position: centre of output sound-image (0(Left) 1(Right): default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignore maxdur,mindur vals).\n"
- "-d: fixed timestep between groupnotes.\n"
- "-i: each group not confined to a fixed instr (default:fixed)\n",MAX_SCAT_TEXTURE);
- } else if(!strcmp(str,"tgrouped")) {
- fprintf(stdout,
- "TIMED TEXTURE OF EVENT-GROUPS: USAGE: texture tgrouped mode infile [infile2..]\n"
- "outfile notedata outdur skip sndfirst sndlast mingain maxgain mindur maxdur\n"
- "minpitch maxpitch phgrid gpspace gpsprange amprise contour gpsizelo gpsizehi\n"
- "gppacklo gppackhi gpranglo gpranghi\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w] [-d] [-i]\n"
- "MODES:-\n"
- "1) ON A GIVEN HARMONIC-FIELD 3) ON A GIVEN HARMONIC-SET\n"
- "2) ON CHANGING HARMONIC-FIELDS 4) ON CHANGING HARMONIC-SETS\n"
- "5) NONE\n"
- "notedata: infofile, 'pitch' of insnds, timings for timed textures, hfields etc\n"
- "outdur: (min) duration of outfile\n"
- "skip: time between repetitions of timing motif in notedata\n"
- "sndfirst,sndlast: 1st,last snd to use from list of insnds(range:1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "mindur,maxdur: min & max duration of events in texture\n"
- "minpitch,maxpitch:min & max pitch (MIDI VALUE)\n"
- "phgrid: timegrid (MS) applying WITHIN the groups\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within groups: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-6: default 0)\n"
- /* NOTE : CARE all_types is 7 AND NOT 8 here */
- "gpsizelo,gpsizehi:smallest & largest numbers of events in groups\n"
- "gppacklo,gppackhi:shortest & longest time between event-onsets in groups (MS)\n"
- "gpranglo,gpranghi:min,max pitchrange grps OR (hfields) no.of hf-notes range\n"
- "atten: overall attenuation of output\n"
- "position: centre of output sound-image (0(Left) 1(Right): default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-d: fixed timestep between groupnotes.\n"
- "-i: each group not confined to a fixed instr (default:fixed)\n");
- } else if(!strcmp(str,"decorated") || !strcmp(str,"predecor") || !strcmp(str,"postdecor")) {
- fprintf(stdout,
- "TEXTURE WITH DECORATIONS:USAGE:texture decorated|predecor|postdecor mode infile\n"
- "[infile2..] outfile notedata outdur skiptime sndfirst sndlast mingain maxgain\n"
- "mindur maxdur phgrid gpspace gpsprange amprise contour gpsizlo gpsizhi\n"
- "gppaklo gppakhi gpranglo gpranghi centring\n"
- " [-aatten] [-ppos] [-ssprd] [-rseed] [-w] [-d] [-i] [-h] [-e] [-k]\n"
- "MODES:-\n"
- "1)ON HARMONIC-FIELD 2)CHANGING HFLDS 3)HARMONIC-SET 4)CHANGING HSETS 5)NONE\n"
- "notedata: infofile, 'pitch' of insnds, decoration shape etc.\n"
- "outdur: (min) duration outfile\n"
- "skiptime: time between repets of motif-to-decorate in notedata\n"
- "sndfirst,sndlast: 1st,last snd to use, from input snds (range 1 - all)\n"
- "mingain,maxgain: min & max gain on input events (MIDI)\n"
- "mindur,maxdur: min & max duration of events in texture\n"
- "phgrid: timegrid (MS) applying WITHIN decors\n"
- "gpspace: spatialisation decor-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range decor-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within decors: (0-127: default 0)\n"
- "contour: amplitude contour of decors (Range 0-8: default 0)\n"
- "gpsizlo,gpsizhi: smallest,largest no. events in decors\n"
- "gppaklo,gppakhi: shortest,longest time between event-onsets in decors(MS)\n"
- "gpranglo,gpranghi:min,max pitchrange decors OR (hfields) no.of hf-notes range\n"
- "centring: how decor pitches centre on line pitches(Range 0-7:default 0)\n"
- "atten: overall attenuation of output\n"
- "pos: centre of output sound-image (-1(Left) 1(Right): default 0)\n"
- "sprd: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: play all insnd(ignore min,maxdur) -h: dec TOPnote chord:(dflt:1st listed)\n"
- "-d: fixed timestep btwn decornotes -e: dec all notes of chords\n"
- "-i: instrs vary in decor(dflt:fixed) -k: discard orig line, after decor\n");
- } else if(!strcmp(str,"ornate") || !strcmp(str,"preornate") || !strcmp(str,"postornate")) {
- fprintf(stdout,
- "TEXTURE WITH ORNAMENTS: USAGE:\n"
- "texture ornate|preornate|postornate mode infile [infile2...] outfile notedata\n"
- "outdur skiptime sndfirst sndlast mingain maxgain mindur maxdur\n"
- "phgrid gpspace gpsprange amprise contour multlo multhi\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w] [-d] [-i] [-h] [-e]\n"
- "MODES:-\n"
- "1)ON HARMONIC-FIELD 2)CHANGING HFLDS 3)HARMONIC-SET 4)CHANGING HSETS 5)NONE\n"
- "notedata: infofile, 'pitch' of insnds, notes in ornaments, hfields etc.\n"
- "outdur: (min) duration of outfile\n"
- "skiptime: time between repetitions of motif-to-ornament in notedata\n"
- "sndfirst,sndlast: 1st,last snd to use, from input snds (range 1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "mindur,maxdur: min & max duration of events in texture\n"
- "phgrid: a timegrid (MS) applying WITHIN the ornaments\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within ornaments: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-8: default 0)\n"
- "multlo, multhi: min & max multiplier of total input duration of motif\n"
- "atten: overall attenuation of the output\n"
- "position: centre of output sound-image (0(Left) 1(Right):default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-d: ornament notes all have same duration as ornamented note\n"
- "-i: orns not confined to instr of ornd-note (default:same note)\n"
- "-h: orns on highest note of any chord:(default:1st note listed)\n"
- "-e: ornaments on all notes of any chord.\n");
- } else if(!strcmp(str,"motifsin")) {
- fprintf(stdout,
- "TEXTURE OF MOTIFS, FORCED ONTO A HARMONIC FIELD: USAGE:\n"
- "texture motifsin mode infile [infile2..] outfile notedata outdur packing\n"
- "scatter tgrid sndfirst sndlast mingain maxgain \n"
- "minpitch maxpitch phgrid gpspace gpsprange amprise contour multlo multhi\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w] [-d] [-i]\n"
- "MODES:-\n"
- "1) ON HARMONIC-FIELD 2) CHANGING HFLDS 3) HARMONIC-SET 4) CHANGING HSETS\n"
- "notedata: infofile,'pitch' of insnds, timings for timed textures, hfields etc\n"
- "outdur: (min) duration of outfile\n"
- "packing: (average) time between motif onsets.\n"
- "scatter: randomisation of event-onsets (0 - %.0lf)\n"
- "tgrid: minstep(MS) quantised timegrid (for mtf starttimes)(dflt 0)\n"
- "sndfirst,sndlast: 1st,last snd to use, from input snds (range 1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "minpitch,maxpitch: min & max pitch (MIDI VALUE)\n"
- "phgrid: a timegrid (MS) applying WITHIN the motifs\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within motifs: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-6: default 0)\n"
- /* NOTE : CARE all_types is 7 AND NOT 8 here */
- "multlo, multhi: min & max multiplier of total input duration of motif\n"
- "atten: overall attenuation of the output\n"
- "position: centre of output sound-image (0(Left) 1(Right):default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-d notes within any one motif all have same duration.\n"
- "-i: motif not each confined to fixed instr (default:fixed)\n",MAX_SCAT_TEXTURE);
- } else if(!strcmp(str,"tmotifsin")) {
- fprintf(stdout,
- "TIMED TEXTURE OF MOTIFS, FORCED ONTO A HARMONIC FIELD: USAGE:\n"
- "texture tmotifsin mode infile [infile2...] outfile notedata sndfirst sndlast\n"
- "mingain maxgain minpich maxpich phgrid gpspace gpsprange\n"
- "amprise contour multlo multhi [-aatten] [-ppos] [-sspread] [-rseed] [-w] [-d]\n"
- "MODES:-\n"
- "1) ON HARMONIC-FIELD 2) CHANGING HFLDS 3) HARMONIC-SET 4) CHANGING HSETS\n"
- "notedata: infofile, 'pitch' of insnds,motifs,texture timings,hfields etc..\n"
- "outdur: (min) duration of outfile\n"
- "skiptime: time between repetitions of timing motif in notedata\n"
- "sndfirst,sndlast: 1st,last snd to use, from input snds (range 1 - all)\n"
- "mingain,maxgain: minimum & maximum level of input events (1-127:default 64,64)\n"
- "minpich,maxpich: min & max pitch (MIDI VALUE)\n"
- "phgrid: a timegrid (MS) applying WITHIN the motifs\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within motifs: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-6: default 0)\n"
- /* NOTE : CARE all_types is 7 AND NOT 8 here */
- "multlo, multhi: min & max multiplier of total input duration of motif\n"
- "atten: overall attenuation of the output\n"
- "pos: centre of output sound-image (0(Left) 1(Right):default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-d: notes in any one motif all have same duration as timing note.\n"
- "-i: motifs not each confined to a fixed instrument (default: fixed)\n");
- } else if(!strcmp(str,"motifs")) {
- fprintf(stdout,
- "TEXTURE OF MOTIFS, (1ST NOTES ONLY, FORCED ONTO HARMONIC FIELD/SET, IF USED)\n"
- "USAGE: texture motifs mode infile [infile2...] outfile notedata outdur packing\n"
- "scatter tgrid sndfirst sndlast mingain maxgain minpich maxpich\n"
- "phgrid gpspace gpsprange amprise contour multlo multhi\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w] [-d]\n"
- "MODES:-\n"
- "1)ON HARMONIC-FIELD 2)CHANGING HFLDS 3)HARMONIC-SET 4)CHANGING HSETS 5)NONE\n"
- "notedata: infofile, 'pitch' of insnds, timings for timed textures,hfields etc.\n"
- "outdur: (min) duration of outfile\n"
- "packing: (average) time between motif onsets.\n"
- "scatter: randomisation of event-onsets (0 - %.0lf)\n"
- "tgrid: minstep(MS) quantised timegrid (for mtf starttimes)(dflt 0)\n"
- "sndfirst,sndlast: 1st,last snd to use, from input snds (range 1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "minpich,maxpich: min & max pitch (MIDI VALUE)\n"
- "phgrid: a timegrid (MS) applying WITHIN the motifs\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within motifs: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-6: default 0)\n"
- /* NOTE : CARE all_types is 7 AND NOT 8 here */
- "multlo, multhi: min & max multiplier of total input duration of motif\n"
- "atten: overall attenuation of the output\n"
- "position: centre of output sound-image (0(Left) 1(Right):default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-d notes of any one motif all have same duration.\n"
- "-i: motif not each confined to fixed instr (default:fixed)\n",MAX_SCAT_TEXTURE);
- } else if(!strcmp(str,"tmotifs")) {
- fprintf(stdout,
- "TIMED TEXTURE OF MOTIFS, THEMSELVES NOT FORCED ONTO HARMONIC FIELD: USAGE:\n"
- "texture tmotifs mode infile [infile2...] outfile notedata outdur skip\n"
- "sndfirst sndlast mingain maxgain minpitch maxpitch phgrid\n"
- "gpspace gpsprange amprise contour multlo multhi\n"
- " [-aatten] [-pposition] [-sspread] [-rseed] [-w] [-d]\n"
- "MODES:-\n"
- "1)ON HARMONIC-FIELD 2)CHANGING HFLDS 3)HARMONIC-SET 4)CHANGING HSETS 5)NONE\n"
- "notedata: infofile, 'pitch' of insnds,texture timings,motifs,hfields etc....\n"
- "outdur: (min) duration of outfile\n"
- "skip: time between repetitions of timing motif in notedata\n"
- "sndfirst,sndlast: 1st,last snd to use, from input snds (range 1 - all)\n"
- "mingain,maxgain: min & max level of input events (1-127:default 64,64)\n"
- "minpitch,maxpitch: min & max pitch (MIDI VALUE)\n"
- "phgrid: a timegrid (MS) applying WITHIN the motifs\n"
- "gpspace: spatialisation of event-groups (Range 0-5: default 1)\n"
- "gpsprange: spatial range of event-groups (Range 0-1: default 1)\n"
- "amprise: amplitude change within motifs: (0-127: default 0)\n"
- "contour: amplitude contour of groups (Range 0-6: default 0)\n"
- /* NOTE : CARE all_types is 7 AND NOT 8 here */
- "multlo, multhi: min & max multiplier of total input duration of motif\n"
- "atten: overall attenuation of the output\n"
- "position: centre of output sound-image (0(Left) 1(Right):default 0.5)\n"
- "spread: spatial-spread of texture events (0 - 1(full-spread))\n"
- "seed: same seed-no: same output on rerun(dflt 0: differs each time)\n"
- "-w: always play whole input-sound (ignoring duration values).\n"
- "-d: motif notes all have same duration as ornamented note\n"
- "-i: motif not each confined to fixed instr (default:fixed)\n");
- } else
- fprintf(stdout,"Unknown option '%s'\n",str);
- return(USAGE_ONLY);
- }
- /******************************** USAGE3 ********************************/
- int usage3(char *str1,char *str2)
- {
- sprintf(errstr,"Insufficient parameters on command line.\n");
- return(USAGE_ONLY);
- }
- /******************************** INNER_LOOP (redundant) ********************************/
- int inner_loop
- (int *peakscore,int *descnt,int *in_start_portion,int *least,int *pitchcnt,int windows_in_buf,dataptr dz)
- {
- return(FINISHED);
- }
|