source: examples/utils.h @ 5e9c68a

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

rename file_ to aubio_sndfile, protect aubio_pitdetection_{mode,type} enumerators

  • Property mode set to 100644
File size: 3.2 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#define debug(...) if (verbose) fprintf (stderr, __VA_ARGS__)
30#define errmsg(...) fprintf (stderr, __VA_ARGS__)
31#define outmsg(...) fprintf (stdout, __VA_ARGS__)
32
33extern int frames;
34extern int verbose;
35extern int usejack;
36extern int usedoubled;
37extern unsigned int median;
38extern const char * output_filename;
39extern const char * input_filename;
40/* defined in utils.c */
41void usage (FILE * stream, int exit_code);
42int parse_args (int argc, char **argv);
43void examples_common_init(int argc, char **argv);
44void examples_common_del(void);
45typedef void (aubio_print_func_t)(void);
46#ifndef JACK_SUPPORT
47typedef int (*aubio_process_func_t)
48        (smpl_t **input, smpl_t **output, int nframes);
49#endif
50void examples_common_process(aubio_process_func_t process_func, aubio_print_func_t print);
51
52
53void send_noteon(int pitch, int velo);
54/** append new note candidate to the note_buffer and return filtered value. we
55 * need to copy the input array as vec_median destroy its input data.*/
56void note_append(fvec_t * note_buffer, smpl_t curnote); 
57uint_t get_note(fvec_t *note_buffer, fvec_t *note_buffer2);
58
59extern const char * output_filename;
60extern const char * input_filename;
61extern const char * onset_filename;
62extern int verbose;
63extern int usejack;
64extern int usedoubled;
65
66
67/* energy,specdiff,hfc,complexdomain,phase */
68extern aubio_onsetdetection_type type_onset;
69extern aubio_onsetdetection_type type_onset2;
70extern smpl_t threshold;
71extern smpl_t threshold2;
72extern uint_t buffer_size;
73extern uint_t overlap_size;
74extern uint_t channels;
75extern uint_t samplerate;
76
77
78extern aubio_sndfile_t * file;
79extern aubio_sndfile_t * fileout;
80
81extern aubio_pvoc_t * pv;
82extern fvec_t * ibuf;
83extern fvec_t * obuf;
84extern cvec_t * fftgrain;
85extern fvec_t * woodblock;
86extern aubio_onsetdetection_t *o;
87extern aubio_onsetdetection_t *o2;
88extern fvec_t *onset;
89extern fvec_t *onset2;
90extern int isonset;
91extern aubio_pickpeak_t * parms;
92
93
94/* pitch objects */
95extern smpl_t pitch;
96extern aubio_pitchdetection_t * pitchdet;
97extern aubio_pitchdetection_type mode;
98extern uint_t median;
99
100extern fvec_t * note_buffer;
101extern fvec_t * note_buffer2;
102extern smpl_t curlevel;
103extern smpl_t maxonset;
104
105/* midi objects */
106extern aubio_midi_player_t * mplay; 
107extern aubio_midi_driver_t * mdriver; 
108extern aubio_midi_event_t  * event;
109
110extern smpl_t curnote;
111extern smpl_t newnote;
112extern uint_t isready;
113
114/* per example param */
115extern uint_t usepitch;
116
Note: See TracBrowser for help on using the repository browser.