Changeset fb615eb
- Timestamp:
- Aug 14, 2005, 12:14:41 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 45345ee
- Parents:
- 13d57e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/utils.c
r13d57e8 rfb615eb 59 59 smpl_t pitch = 0.; 60 60 aubio_pitchdetection_t * pitchdet; 61 aubio_pitchdetection_type mode = aubio_pitch_yin; // aubio_pitch_mcomb 61 aubio_pitchdetection_type type_pitch = aubio_pitch_schmitt; // aubio_pitch_mcomb 62 aubio_pitchdetection_mode mode_pitch = aubio_pitchm_freq; 62 63 uint_t median = 6; 63 64 … … 88 89 fprintf(stream, "usage: %s [ options ] \n", prog_name); 89 90 fprintf(stream, 90 " -j --jack Use Jack.\n" 91 " -o --output Output type.\n" 92 " -i --input Input type.\n" 93 " -h --help Display this message.\n" 94 " -v --verbose Print verbose message.\n" 91 " -h --help Display this message.\n" 92 " -j --jack Use Jack.\n" 93 " -o --output Output type.\n" 94 " -i --input Input type.\n" 95 " -O --onset Select onset detection algorithm.\n" 96 " -t --threshold Set onset detection threshold.\n" 97 " -s --silence Select silence threshold.\n" 98 " -p --pitch Select pitch detection algorithm.\n" 99 " -H --hopsize Set hopsize.\n" 100 " -a --averaging Use averaging.\n" 95 101 ); 96 102 exit(exit_code); … … 98 104 99 105 int parse_args (int argc, char **argv) { 100 const char *options = "hvjo:i:O:t:s: H:a";106 const char *options = "hvjo:i:O:t:s:p:H:a"; 101 107 int next_option; 102 108 struct option long_options[] = … … 110 116 {"threshold", 1, NULL, 't'}, 111 117 {"silence" , 1, NULL, 's'}, 118 {"pitch" , 1, NULL, 'p'}, 112 119 {"averaging", 0, NULL, 'a'}, 113 120 {"hopsize", 1, NULL, 'H'}, 114 121 {NULL , 0, NULL, 0} 115 122 }; 116 prog_name = argv[0]; 123 prog_name = argv[0]; 117 124 if( argc < 1 ) { 118 125 usage (stderr, 1); … … 129 136 input_filename = optarg; 130 137 break; 131 case 'h': 138 case 'h': /* help */ 132 139 usage (stdout, 0); 133 140 return -1; 134 case 'v': 141 case 'v': /* verbose */ 135 142 verbose = 1; 136 143 break; 137 case 'j': /* verbose */144 case 'j': 138 145 usejack = 1; 139 146 break; … … 173 180 */ 174 181 break; 182 case 'p': 183 if (strcmp(optarg,"mcomb") == 0) 184 type_pitch = aubio_pitch_mcomb; 185 else if (strcmp(optarg,"yin") == 0) 186 type_pitch = aubio_pitch_yin; 187 else if (strcmp(optarg,"schmitt") == 0) 188 type_pitch = aubio_pitch_schmitt; 189 else if (strcmp(optarg,"fcomb") == 0) 190 type_pitch = aubio_pitch_fcomb; 191 else { 192 debug("could not get pitch type.\n"); 193 abort(); 194 } 195 break; 175 196 case 'a': 176 197 averaging = 1; … … 179 200 overlap_size = atoi(optarg); 180 201 break; 181 case '?': 202 case '?': /* unknown options */ 182 203 usage(stderr, 1); 183 204 break; 184 case -1: 185 break; 186 default: 205 case -1: /* done with options */ 206 break; 207 default: /*something else unexpected */ 187 208 abort (); 188 209 } … … 204 225 exit(1); 205 226 } 206 } 227 } 207 228 return 0; 208 229 } … … 243 264 if (usepitch) { 244 265 pitchdet = new_aubio_pitchdetection(buffer_size*4, 245 overlap_size, channels, samplerate, mode, aubio_pitchm_freq);266 overlap_size, channels, samplerate, type_pitch, mode_pitch); 246 267 247 268 if (median) {
Note: See TracChangeset
for help on using the changeset viewer.