shithub: aubio

Download patch

ref: 9499a546be6cd24aeaf698a8d3e13068023f0165
parent: 19b56b07dedfce33814935e3ab7bd343e2e37c2b
author: Paul Brossier <piem@altern.org>
date: Tue Mar 29 11:04:29 EST 2005

aubioonset.c correct onset output when t-4<0
        thanks goes to Hamisch Allan for spotting this

--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -173,7 +173,11 @@
        * delay to ensure the label is _before_ the
        * actual onset */
       if (isonset && output_filename == NULL) {
-        outmsg("%f\n",(frames-4)*overlap_size/(float)samplerate);
+        if(frames >= 4) {
+          outmsg("%f\n",(frames-4)*overlap_size/(float)samplerate);
+        } else if (frames < 4) {
+          outmsg("%f\n",0.);
+        }
       }
       if (output_filename != NULL) {
         file_write(fileout,overlap_size,obuf);