From: Paul Brossier Date: Mon, 6 Dec 2004 18:15:33 +0000 (+0000) Subject: removed some boring examples X-Git-Tag: bzr2git~943 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b16b90048ff3e3f9578514de3dace12f631822b5;p=aubio.git removed some boring examples --- diff --git a/ChangeLog b/ChangeLog index 40f661c6..8f85a138 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-12-06 Paul Brossier + * examples/{midi*,testforclam}.c: removed + 2004-12-03 Paul Brossier * src/{mathutils,pitchyin}.h: got rid of some shadowed declarations * plugins/puredata: first puredata plugin attempt added diff --git a/examples/Makefile.am b/examples/Makefile.am index 7a3b82d9..1c32606d 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -12,17 +12,9 @@ bin_PROGRAMS = \ aubionotesmedian \ aubionotes -noinst_PROGRAMS = \ - midiparse \ - midiplay \ - midialsa \ - testforclam - EXTRA_DIST = utils.h - # optionally add sources file for these programs aubioonset_SOURCES = aubioonset.c utils.c aubionotes_SOURCES = aubionotes.c utils.c aubionotesmedian_SOURCES = aubionotesmedian.c utils.c -testforclam_SOURCES = testforclam.c utils.c diff --git a/examples/Makefile.in b/examples/Makefile.in index 7d4af58c..06f720d7 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -166,20 +166,12 @@ bin_PROGRAMS = \ aubionotes -noinst_PROGRAMS = \ - midiparse \ - midiplay \ - midialsa \ - testforclam - - EXTRA_DIST = utils.h # optionally add sources file for these programs aubioonset_SOURCES = aubioonset.c utils.c aubionotes_SOURCES = aubionotes.c utils.c aubionotesmedian_SOURCES = aubionotesmedian.c utils.c -testforclam_SOURCES = testforclam.c utils.c subdir = examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -187,9 +179,7 @@ CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = bin_PROGRAMS = aubioonset$(EXEEXT) aubionotesmedian$(EXEEXT) \ aubionotes$(EXEEXT) -noinst_PROGRAMS = midiparse$(EXEEXT) midiplay$(EXEEXT) midialsa$(EXEEXT) \ - testforclam$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +PROGRAMS = $(bin_PROGRAMS) am_aubionotes_OBJECTS = aubionotes.$(OBJEXT) utils.$(OBJEXT) aubionotes_OBJECTS = $(am_aubionotes_OBJECTS) @@ -206,35 +196,13 @@ aubioonset_OBJECTS = $(am_aubioonset_OBJECTS) aubioonset_LDADD = $(LDADD) aubioonset_DEPENDENCIES = aubioonset_LDFLAGS = -midialsa_SOURCES = midialsa.c -midialsa_OBJECTS = midialsa.$(OBJEXT) -midialsa_LDADD = $(LDADD) -midialsa_DEPENDENCIES = -midialsa_LDFLAGS = -midiparse_SOURCES = midiparse.c -midiparse_OBJECTS = midiparse.$(OBJEXT) -midiparse_LDADD = $(LDADD) -midiparse_DEPENDENCIES = -midiparse_LDFLAGS = -midiplay_SOURCES = midiplay.c -midiplay_OBJECTS = midiplay.$(OBJEXT) -midiplay_LDADD = $(LDADD) -midiplay_DEPENDENCIES = -midiplay_LDFLAGS = -am_testforclam_OBJECTS = testforclam.$(OBJEXT) utils.$(OBJEXT) -testforclam_OBJECTS = $(am_testforclam_OBJECTS) -testforclam_LDADD = $(LDADD) -testforclam_DEPENDENCIES = -testforclam_LDFLAGS = DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/aubionotes.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/aubionotesmedian.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/aubioonset.Po ./$(DEPDIR)/midialsa.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/midiparse.Po ./$(DEPDIR)/midiplay.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/testforclam.Po ./$(DEPDIR)/utils.Po +@AMDEP_TRUE@ ./$(DEPDIR)/aubioonset.Po ./$(DEPDIR)/utils.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ @@ -243,10 +211,9 @@ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(aubionotes_SOURCES) $(aubionotesmedian_SOURCES) \ - $(aubioonset_SOURCES) midialsa.c midiparse.c midiplay.c \ - $(testforclam_SOURCES) + $(aubioonset_SOURCES) DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(aubionotes_SOURCES) $(aubionotesmedian_SOURCES) $(aubioonset_SOURCES) midialsa.c midiparse.c midiplay.c $(testforclam_SOURCES) +SOURCES = $(aubionotes_SOURCES) $(aubionotesmedian_SOURCES) $(aubioonset_SOURCES) all: all-am @@ -286,13 +253,6 @@ clean-binPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done aubionotes$(EXEEXT): $(aubionotes_OBJECTS) $(aubionotes_DEPENDENCIES) @rm -f aubionotes$(EXEEXT) $(LINK) $(aubionotes_LDFLAGS) $(aubionotes_OBJECTS) $(aubionotes_LDADD) $(LIBS) @@ -302,18 +262,6 @@ aubionotesmedian$(EXEEXT): $(aubionotesmedian_OBJECTS) $(aubionotesmedian_DEPEND aubioonset$(EXEEXT): $(aubioonset_OBJECTS) $(aubioonset_DEPENDENCIES) @rm -f aubioonset$(EXEEXT) $(LINK) $(aubioonset_LDFLAGS) $(aubioonset_OBJECTS) $(aubioonset_LDADD) $(LIBS) -midialsa$(EXEEXT): $(midialsa_OBJECTS) $(midialsa_DEPENDENCIES) - @rm -f midialsa$(EXEEXT) - $(LINK) $(midialsa_LDFLAGS) $(midialsa_OBJECTS) $(midialsa_LDADD) $(LIBS) -midiparse$(EXEEXT): $(midiparse_OBJECTS) $(midiparse_DEPENDENCIES) - @rm -f midiparse$(EXEEXT) - $(LINK) $(midiparse_LDFLAGS) $(midiparse_OBJECTS) $(midiparse_LDADD) $(LIBS) -midiplay$(EXEEXT): $(midiplay_OBJECTS) $(midiplay_DEPENDENCIES) - @rm -f midiplay$(EXEEXT) - $(LINK) $(midiplay_LDFLAGS) $(midiplay_OBJECTS) $(midiplay_LDADD) $(LIBS) -testforclam$(EXEEXT): $(testforclam_OBJECTS) $(testforclam_DEPENDENCIES) - @rm -f testforclam$(EXEEXT) - $(LINK) $(testforclam_LDFLAGS) $(testforclam_OBJECTS) $(testforclam_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core @@ -324,10 +272,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aubionotes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aubionotesmedian.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aubioonset.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midialsa.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiparse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiplay.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testforclam.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ .c.o: @@ -490,8 +434,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-binPROGRAMS clean-generic clean-libtool \ - clean-noinstPROGRAMS mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -538,16 +481,16 @@ ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool clean-noinstPROGRAMS ctags \ - distclean distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-binPROGRAMS install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/examples/midialsa.c b/examples/midialsa.c deleted file mode 100644 index d4974d70..00000000 --- a/examples/midialsa.c +++ /dev/null @@ -1,21 +0,0 @@ -/* __copyright__ */ - -#include "aubio.h" -#include - -/* not supported yet */ -#ifdef LADCCA_SUPPORT -#include -cca_client_t * aubio_cca_client; -#endif /* LADCCA_SUPPORT */ - -int main(int argc, char **argv) { -#if ALSA_SUPPORT - aubio_midi_player_t * mplay = new_aubio_midi_player(); - aubio_midi_driver_t * mdriver = new_aubio_midi_driver("alsa_seq", - (handle_midi_event_func_t)aubio_midi_send_event, mplay); - pause(); - del_aubio_midi_driver(mdriver); -#endif - return 0; -} diff --git a/examples/midiparse.c b/examples/midiparse.c deleted file mode 100644 index abe93f0b..00000000 --- a/examples/midiparse.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - copyright (c) 2003 paul brossier - - this program is free software; you can redistribute it and/or modify - it under the terms of the gnu general public license as published by - the free software foundation; either version 2 of the license, or - (at your option) any later version. - - this program 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 general public license for more details. - - you should have received a copy of the gnu general public license - along with this program; if not, write to the free software - foundation, inc., 675 mass ave, cambridge, ma 02139, usa. - -*/ - -#include "aubio.h" -#include - -/* not supported yet */ -#ifdef LADCCA_SUPPORT -#include -cca_client_t * aubio_cca_client; -#endif /* LADCCA_SUPPORT */ - -int main(int argc, char ** argv) { -#if ALSA_SUPPORT - aubio_midi_player_t * mplay = new_aubio_midi_player(); - argc--; - aubio_midi_player_add(mplay,argv[argc]); - while(aubio_midi_player_play_offline(mplay) == 0) - pause(); - aubio_midi_player_stop(mplay); - del_aubio_midi_player(mplay); -#endif - return 0; -} - diff --git a/examples/midiplay.c b/examples/midiplay.c deleted file mode 100644 index 421964f6..00000000 --- a/examples/midiplay.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2003 Paul Brossier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/** \bug have it stop at the end of the playlist (but keep using thread, see - * new_aubio_timer call in midi_player) - * - */ - -#include "aubio.h" -#include - -/* not supported yet */ -#ifdef LADCCA_SUPPORT -#include -cca_client_t * aubio_cca_client; -#endif /* LADCCA_SUPPORT */ - -int main(int argc, char ** argv) { -#if ALSA_SUPPORT - aubio_midi_player_t * mplay = new_aubio_midi_player(); - argc--; - aubio_midi_player_add(mplay,argv[argc]); - aubio_midi_player_play(mplay); - pause(); - aubio_midi_player_stop(mplay); - del_aubio_midi_player(mplay); -#endif - return 0; -} diff --git a/examples/testforclam.c b/examples/testforclam.c deleted file mode 100644 index c03298a2..00000000 --- a/examples/testforclam.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - Copyright (C) 2003 Paul Brossier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include -#include - -#include "aubio.h" - -#include "utils.h" - - -const char * output_filename = NULL; -const char * input_filename = NULL; - -const char * onset_filename = "/usr/share/sounds/aubio/woodblock.aiff"; - -int verbose = 0; -int usejack = 0; - -int aubio_process(float **input, float **output, int nframes); - -/* settings */ - -/* energy,specdiff,hfc,complexdomain,phase */ -aubio_onsetdetection_type type_onset; -smpl_t threshold = 0.1; - -smpl_t threshold2 = -80.; - -int buffer_size = 1024; -int overlap_size = 512; -int channels = 1; -int samplerate = 44100; - -/* global objects */ -aubio_pvoc_t * pv; - -fvec_t * ibuf; -fvec_t * obuf; -cvec_t * fftgrain; - -fvec_t * woodblock; - -aubio_onsetdetection_t *o; -fvec_t *onset; -//fvec_t *onset_keep; -//fvec_t *onset_proc; -int post = 5; -int pre = 1; - -int isonset = 0; - -aubio_pickpeak_t * parms; - -int aubio_process(float **input, float **output, int nframes) { - unsigned int i; /*channels*/ - unsigned int j; /*frames*/ - unsigned int pos = 0; /*frames%dspblocksize*/ - //unsigned int ons = 0; /*onset counter*/ - for (j=0;jdata[0][0]); - isonset = aubio_peakpick_pimrt(onset,parms); - if (isonset) { - /* test for silence */ - if (aubio_silence_detection(ibuf, threshold2)==1) - isonset=0; - else - for (pos = 0; pos < overlap_size; pos++) - obuf->data[0][pos] = - woodblock->data[0][pos]; - } else { - for (pos = 0; pos < overlap_size; pos++) - obuf->data[0][pos] = 0.; - } - //aubio_pvoc_rdo(pv,fftgrain, obuf); - pos = -1; /* so it will be zero next j loop */ - } - pos++; - } - return 1; -} - -int main (int argc, char **argv) { - int frames; - //int pos; - - aubio_file_t * file = NULL; - aubio_file_t * fileout = NULL; - - aubio_file_t * onsetfile = new_file_ro(onset_filename); - parse_args(argc, argv); - - if(!usejack) - { - debug("Opening files ...\n"); - file = new_file_ro (input_filename); - file_info(file); - channels = aubio_file_channels(file); - if (output_filename != NULL) - fileout = new_file_wo(file, output_filename); - } - - ibuf = new_fvec(overlap_size, channels); - obuf = new_fvec(overlap_size, channels); - woodblock = new_fvec(buffer_size,1); - fftgrain = new_cvec(buffer_size, channels); - - file_read(onsetfile, overlap_size, woodblock); - - /* phase vocoder */ - debug("Phase voc init ... \n"); - pv = new_aubio_pvoc(buffer_size, overlap_size, channels); - - /* onset init */ - debug("type_onset: %d\n", (int)type_onset); - debug("threshold : %f\n", threshold); - parms = new_aubio_peakpicker(threshold); - - o = new_aubio_onsetdetection(type_onset,buffer_size,channels); - /*onset = new_fvec(overlap_size, channels); - for (frames=0;framesdata[0][frames] = 0.; - }*/ - onset = new_fvec(0, channels); - - //onset_keep = new_fvec(post+pre+1, channels); - //onset_proc = new_fvec(post+pre+1, channels); - - // command line argument parsing - if(usejack) { -#ifdef JACK_SUPPORT - aubio_jack_t * jack_setup; - debug("Jack init ...\n"); - jack_setup = new_aubio_jack(channels, channels, - (aubio_process_func_t)aubio_process); - - /* initialise fftgrain */ - aubio_pvoc_do (pv,ibuf, fftgrain); - - debug("Jack activation ...\n"); - aubio_jack_activate(jack_setup); - - debug("Processing (Ctrl+C to quit) ...\n"); - pause(); - - aubio_jack_close(jack_setup); -#endif - - } else { - fvec_t * inputbuf ; - fvec_t * outputbuf; - /* file objects */ - - inputbuf = new_fvec(overlap_size, channels); - outputbuf = new_fvec(overlap_size, channels); - /* phasevoc init */ - debug("Processing ...\n"); - - /** \bug phasevoc not initialized yet */ - /* initialise fftgrain and input bug */ - for (frames=0;frames<2;frames++) { - aubio_pvoc_do (pv,inputbuf, fftgrain); - } - - /** start filling the phasevoc */ - //for (frames=0;frames<1;frames++) { - //file_read(file, overlap_size, inputbuf); - //aubio_pvoc_do (pv,inputbuf, fftgrain); - /** \bug onset is still badly initialized */ - //aubio_onsetdetection(o,fftgrain, onset); - //} - - //debug("coucou\n"); - frames = 0; - while ((overlap_size == file_read(file, overlap_size, inputbuf)) ) - { - isonset=0; - aubio_process(inputbuf->data, outputbuf->data, overlap_size); - if (isonset) { - /*output times in seconds*/ - //errmsg("%f\n",(frames-1)*overlap_size/(float)samplerate); - errmsg("%f\n",(frames-3)*overlap_size/(float)samplerate); - } - if (output_filename != NULL) - file_write(fileout,overlap_size,outputbuf); - frames++; - } - debug("Processed %d frames of %d samples.\n", frames, buffer_size); - del_file(file); - if (output_filename != NULL) - del_file(fileout); - } - - del_aubio_pvoc(pv); - - del_fvec(obuf); - del_fvec(ibuf); - del_cvec(fftgrain); - //del_fvec(onset_keep); - //del_fvec(onset_proc); - del_fvec(onset); - - debug("End of program.\n"); - fflush(stderr); - return 0; -} - -