source: examples/utils.h @ ec2fa2a

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since ec2fa2a was e24378a, checked in by Paul Brossier <piem@piem.org>, 17 years ago

examples/utils.{c,h}, examples/aubioonset.c: added process_flush function to get last onset at the end of file, added frames_delay parameter

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2         Copyright (C) 2003 Paul Brossier
3
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.
8
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.
13
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.
17         
18*/
19
20#include <stdio.h>
21#include <stdlib.h>
22#include <stdarg.h>
23#include <getopt.h>
24#include <unistd.h>
25#include <math.h>
26#include <aubio.h>
27#include <aubioext.h>
28
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__)
33#else
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)
37#endif
38
39
40extern int frames;
41extern int verbose;
42extern int usejack;
43extern int usedoubled;
44extern int frames_delay;
45extern unsigned int median;
46extern const char * output_filename;
47extern const char * input_filename;
48/* defined in utils.c */
49void usage (FILE * stream, int exit_code);
50int parse_args (int argc, char **argv);
51void examples_common_init(int argc, char **argv);
52void examples_common_del(void);
53typedef void (aubio_print_func_t)(void);
54#ifndef JACK_SUPPORT
55typedef int (*aubio_process_func_t)
56        (smpl_t **input, smpl_t **output, int nframes);
57#endif
58void examples_common_process(aubio_process_func_t process_func, aubio_print_func_t print);
59
60
61void 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.*/
64void note_append(fvec_t * note_buffer, smpl_t curnote); 
65uint_t get_note(fvec_t *note_buffer, fvec_t *note_buffer2);
66
67extern const char * output_filename;
68extern const char * input_filename;
69extern const char * onset_filename;
70extern int verbose;
71extern int usejack;
72extern int usedoubled;
73
74
75/* energy,specdiff,hfc,complexdomain,phase */
76extern aubio_onsetdetection_type type_onset;
77extern aubio_onsetdetection_type type_onset2;
78extern smpl_t threshold;
79extern smpl_t silence;
80extern uint_t buffer_size;
81extern uint_t overlap_size;
82extern uint_t channels;
83extern uint_t samplerate;
84
85
86extern aubio_sndfile_t * file;
87extern aubio_sndfile_t * fileout;
88
89extern aubio_pvoc_t * pv;
90extern fvec_t * ibuf;
91extern fvec_t * obuf;
92extern cvec_t * fftgrain;
93extern fvec_t * woodblock;
94extern aubio_onsetdetection_t *o;
95extern aubio_onsetdetection_t *o2;
96extern fvec_t *onset;
97extern fvec_t *onset2;
98extern int isonset;
99extern aubio_pickpeak_t * parms;
100
101
102/* pitch objects */
103extern smpl_t pitch;
104extern aubio_pitchdetection_t * pitchdet;
105extern aubio_pitchdetection_type mode;
106extern uint_t median;
107
108extern fvec_t * note_buffer;
109extern fvec_t * note_buffer2;
110extern smpl_t curlevel;
111extern smpl_t maxonset;
112
113/* midi objects */
114extern aubio_midi_player_t * mplay; 
115extern aubio_midi_driver_t * mdriver; 
116extern aubio_midi_event_t  * event;
117
118extern smpl_t curnote;
119extern smpl_t newnote;
120extern uint_t isready;
121
122/* per example param */
123extern uint_t usepitch;
124
Note: See TracBrowser for help on using the repository browser.