diff --git a/VERSION b/VERSION index 883ecfd..03425d1 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -November 13 2023 +November 17 2023 diff --git a/doc/midistats.1 b/doc/midistats.1 index 8ff8edc..0cee81e 100644 --- a/doc/midistats.1 +++ b/doc/midistats.1 @@ -1,4 +1,4 @@ -.TH MIDISTATS 1 "1 November 2023" +.TH MIDISTATS 1 "17 November 2023" .SH NAME \fBmidistats\fP \- program to summarize the statistical properties of a midi file .SH SYNOPSIS diff --git a/doc/readme.txt b/doc/readme.txt index d606c69..5978f1f 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 13 2023 +midistats version 0.80 November 17 2023 24th January 2002 Copyright James Allwright diff --git a/midistats.c b/midistats.c index 3521021..9777fc9 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 13 2023 midistats" +#define VERSION "0.80 November 17 2023 midistats" #include /* Microsoft Visual C++ Version 6.0 or higher */ @@ -49,7 +49,7 @@ extern char* strchr(); #include "midifile.h" void initfuncs(); void stats_finish(); -float histogram_entropy (int *histogram, int size); +float histogram_perplexity (int *histogram, int size); void stats_noteoff(int chan,int pitch,int vol); void stats_eot (); #define max(a,b) (( a > b ? a : b)) @@ -481,6 +481,7 @@ float threshold,peak; int decimate; float tripletsCriterion8,tripletsCriterion4; int resolution = 12; +int nzeros; threshold = 10.0/(float) division; maxcount = 0; ncounts = 0; @@ -498,8 +499,13 @@ for (i = 0; i < division; i++) { pulseDistribution[j] += pulseCounter[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"); + peak = (float) maxcount/ (float) ncounts; -/*printf("maxcount = %d ncounts = %d peak = %f threshold = %f\n",maxcount,ncounts,peak,threshold); */ if (peak < threshold) printf("unquantized\n"); tripletsCriterion8 = (float) pulseDistribution[8]/ (float) ncounts; tripletsCriterion4 = (float) pulseDistribution[4]/ (float) ncounts; @@ -574,7 +580,7 @@ else printf("\ntrkact "); lasttrack++; for (i=0;i 0) trkdata.quietTime[chan] += (trkdata.npulses[0] - trkdata.lastNoteOff[chan]); for (chan=0;chan<16;chan++) { /* 2023-09-13 */ if (chan == 9 || channel_used_in_track[chan+1] == 0) continue; - trkdata.pitchEntropy[chan+1] = histogram_entropy(chanpitchhistogram +chan*12,11); + trkdata.pitchEntropy[chan+1] = histogram_perplexity(chanpitchhistogram +chan*12,11); } output_track_summary(); }