2 Copyright (C) 2003 Paul Brossier
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #ifdef HAVE_C99_VARARGS_MACROS
30 #define debug(...) if (verbose) fprintf (stderr, __VA_ARGS__)
31 #define errmsg(...) fprintf (stderr, __VA_ARGS__)
32 #define outmsg(...) fprintf (stdout, __VA_ARGS__)
34 #define debug(format, args...) if (verbose) fprintf(stderr, format , ##args)
35 #define errmsg(format, args...) fprintf(stderr, format , ##args)
36 #define outmsg(format, args...) fprintf(stdout, format , ##args)
43 extern int usedoubled;
44 extern int frames_delay;
45 extern unsigned int median;
46 extern const char * output_filename;
47 extern const char * input_filename;
48 /* defined in utils.c */
49 void usage (FILE * stream, int exit_code);
50 int parse_args (int argc, char **argv);
51 void examples_common_init(int argc, char **argv);
52 void examples_common_del(void);
53 typedef void (aubio_print_func_t)(void);
55 typedef int (*aubio_process_func_t)
56 (smpl_t **input, smpl_t **output, int nframes);
58 void examples_common_process(aubio_process_func_t process_func, aubio_print_func_t print);
61 void send_noteon(int pitch, int velo);
62 /** append new note candidate to the note_buffer and return filtered value. we
63 * need to copy the input array as vec_median destroy its input data.*/
64 void note_append(fvec_t * note_buffer, smpl_t curnote);
65 uint_t get_note(fvec_t *note_buffer, fvec_t *note_buffer2);
67 extern const char * output_filename;
68 extern const char * input_filename;
69 extern const char * onset_filename;
72 extern int usedoubled;
75 /* energy,specdiff,hfc,complexdomain,phase */
76 extern aubio_onsetdetection_type type_onset;
77 extern aubio_onsetdetection_type type_onset2;
78 extern smpl_t threshold;
79 extern smpl_t silence;
80 extern uint_t buffer_size;
81 extern uint_t overlap_size;
82 extern uint_t channels;
83 extern uint_t samplerate;
86 extern aubio_sndfile_t * file;
87 extern aubio_sndfile_t * fileout;
89 extern aubio_pvoc_t * pv;
92 extern cvec_t * fftgrain;
93 extern fvec_t * woodblock;
94 extern aubio_onsetdetection_t *o;
95 extern aubio_onsetdetection_t *o2;
97 extern fvec_t *onset2;
99 extern aubio_pickpeak_t * parms;
104 extern aubio_pitchdetection_t * pitchdet;
105 extern aubio_pitchdetection_type mode;
106 extern uint_t median;
108 extern fvec_t * note_buffer;
109 extern fvec_t * note_buffer2;
110 extern smpl_t curlevel;
111 extern smpl_t maxonset;
114 extern aubio_midi_player_t * mplay;
115 extern aubio_midi_driver_t * mdriver;
116 extern aubio_midi_event_t * event;
118 extern smpl_t curnote;
119 extern smpl_t newnote;
120 extern uint_t isready;
122 /* per example param */
123 extern uint_t usepitch;