aubioonset.c correct onset output when t-4<0
authorPaul Brossier <piem@altern.org>
Tue, 29 Mar 2005 16:04:29 +0000 (16:04 +0000)
committerPaul Brossier <piem@altern.org>
Tue, 29 Mar 2005 16:04:29 +0000 (16:04 +0000)
        thanks goes to Hamisch Allan for spotting this

examples/aubioonset.c

index 40be246353841750b540e64d01ab5dfa155d18ff..4960298b2676bfaae8932f5ffff35d19782f841c 100644 (file)
@@ -173,7 +173,11 @@ int main(int argc, char **argv) {
        * 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);