From 69c1f850cb7416c8a1a9784d3fbc6b916015baf0 Mon Sep 17 00:00:00 2001 From: sshlien Date: Sun, 26 Nov 2023 12:51:23 -0500 Subject: [PATCH] 2023.11.26 --- VERSION | 2 +- doc/readme.txt | 2 +- midistats.c | 42 ++++++++++++++++++++++++++++++++---------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/VERSION b/VERSION index 03425d1..08dbd61 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -November 17 2023 +November 26 2023 diff --git a/doc/readme.txt b/doc/readme.txt index 5978f1f..d4c0e41 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -6,7 +6,7 @@ abc2abc version 2.20 February 07 2023 yaps version 1.92 January 06 2023 abcmatch version 1.82 June 14 2022 midicopy version 1.39 November 08 2022 -midistats version 0.80 November 17 2023 +midistats version 0.81 November 26 2023 24th January 2002 Copyright James Allwright diff --git a/midistats.c b/midistats.c index 9777fc9..2a34a0f 100644 --- a/midistats.c +++ b/midistats.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#define VERSION "0.80 November 17 2023 midistats" +#define VERSION "0.81 November 26 2023 midistats" #include /* Microsoft Visual C++ Version 6.0 or higher */ @@ -67,6 +67,7 @@ int lasttrack = 0; /* lasttrack */ int division; /* pulses per quarter note defined in MIDI header */ int quietLimit; /* minimum number of pulses with no activity */ long tempo = 500000; /* the default tempo is 120 quarter notes/minute */ +int bpm = 120; /*default tempo */ long laston = 0; /* length of MIDI track in pulses or ticks */ int key[12]; int sharps; @@ -475,7 +476,7 @@ int i; /* [SS] 2023-10-30 */ void stats_interpret_pulseCounter () { int i,j; -int maxcount,ncounts; +int maxcount,ncounts,npeaks,npositives,peaklimit; int maxloc; float threshold,peak; int decimate; @@ -485,6 +486,7 @@ int nzeros; threshold = 10.0/(float) division; maxcount = 0; ncounts = 0; +npeaks = 0; for (i=0;i maxcount) { @@ -492,6 +494,10 @@ for (i=0;i peaklimit) npeaks++; + } for (i = 0; i < resolution; i++) pulseDistribution[i] = 0; decimate = division/resolution; for (i = 0; i < division; i++) { @@ -501,17 +507,26 @@ for (i = 0; i < division; i++) { /* count zeros */ nzeros = 0; -for (i=0;i 7 && pulseDistribution[resolution-1] == 0) printf("clean_quantization"); -if (pulseDistribution[resolution-1] > 0.05) printf("dithered_quantization\n"); - +for (i=0;i 3 && (float) pulseDistribution[resolution-1]/(float) ncounts < 0.1) {printf("clean_quantization\n"); + } else if ((float) pulseDistribution[resolution-1]/(float) ncounts > 0.09 || + npeaks > npositives) {printf("dithered_quantization\n"); + } else { peak = (float) maxcount/ (float) ncounts; if (peak < threshold) printf("unquantized\n"); +} + tripletsCriterion8 = (float) pulseDistribution[8]/ (float) ncounts; tripletsCriterion4 = (float) pulseDistribution[4]/ (float) ncounts; -/*printf("tripletsCriterion = %f\n",tripletsCriterion);*/ if (tripletsCriterion8 > 0.10 || tripletsCriterion4 > 0.10) printf("triplets\n"); if (pulseDistribution[0]/(float) ncounts > 0.95) printf("qnotes"); +/* +printf("pulseDistribution:"); +for (i=0;i 0) nchannels++; -printf("%d\t%d\t%d\t%d\t%d\n",lasttrack,nchannels, division,lastEvent,lastBeat); +printf("%d\t%d\t%d\t%d\t%d\t%d\n",lasttrack,nchannels, division,bpm,lastEvent,lastBeat); +/*printf("%d\n",tempocount);*/ }