}
#endif /* HAVE_LASH */
- uint_t i;
- woodblock = new_fvec (overlap_size, channels);
++ woodblock = new_fvec (overlap_size);
+ if (output_filename || usejack) {
+ /* dummy assignement to keep egcs happy */
+ found_wood = (onsetfile = new_aubio_sndfile_ro (onset_filename)) ||
+ (onsetfile = new_aubio_sndfile_ro ("sounds/woodblock.aiff")) ||
+ (onsetfile = new_aubio_sndfile_ro ("../sounds/woodblock.aiff"));
+ if (onsetfile == NULL) {
+ outmsg ("Could not find woodblock.aiff\n");
+ exit (1);
+ }
+ }
+ if (onsetfile) {
+ /* read the output sound once */
- aubio_sndfile_read (onsetfile, overlap_size, woodblock);
++ aubio_sndfile_read_mono (onsetfile, overlap_size, woodblock);
+ }
+
- ibuf = new_fvec (overlap_size, channels);
- obuf = new_fvec (overlap_size, channels);
+ ibuf = new_fvec (overlap_size);
+ obuf = new_fvec (overlap_size);
}
--- /dev/null
- print beats
+#! /usr/bin/python
+
+import sys
+from os.path import splitext, basename
+from aubio import tempo
+from aubioinput import aubioinput
+
+win_s = 512 # fft size
+hop_s = win_s / 2 # hop size
+beat = tempo("default", win_s, hop_s)
+
+beats = []
+
+def process(samples, pos):
+ isbeat = beat(samples)
+ if isbeat:
+ thisbeat = (float(isbeat[0]) + pos * hop_s) / 44100.
+ print thisbeat
+ beats.append (thisbeat)
+
+if len(sys.argv) < 2:
+ print "Usage: %s <filename>" % sys.argv[0]
+else:
+ filename = sys.argv[1]
+ a = aubioinput(filename, process = process, hopsize = hop_s,
+ caps = 'audio/x-raw-float, rate=44100, channels=1')
+ a.run()
--- /dev/null
- uint_t win_s = 1024; /* window size */
- uint_t channels = 1; /* number of channel */
- fvec_t * in = new_fvec (win_s, channels); /* input buffer */
- fvec_t * out = new_fvec (1, channels); /* input buffer */
- aubio_pitch_t *p = new_aubio_pitch ("default", win_s, win_s / 2, channels, 44100);
+ #include <aubio.h>
+
+ int main(){
+ /* allocate some memory */
++ uint_t win_s = 1024; /* window size */
++ fvec_t * in = new_fvec (win_s); /* input buffer */
++ fvec_t * out = new_fvec (1); /* input buffer */
++ aubio_pitch_t *p = new_aubio_pitch ("default", win_s, win_s / 2, 44100);
+ uint_t i = 0;
+
+ while (i < 10) {
+ aubio_pitch_do (p, in, out);
+ i++;
+ };
+
+ del_fvec(in);
+ del_fvec(out);
+ aubio_cleanup();
+
+ return 0;
+ }
+