From 34f6ef01e2d51daa211efed0aad201d8be1037a8 Mon Sep 17 00:00:00 2001 From: sshlien Date: Wed, 13 Mar 2024 12:17:06 -0400 Subject: [PATCH] 2024.03.13 --- VERSION | 2 +- doc/midistats.1 | 7 ++++++- doc/readme.txt | 2 +- midistats.c | 13 +++++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 54d0a62..12d0787 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -March 05 2024 +March 13 2024 diff --git a/doc/midistats.1 b/doc/midistats.1 index 6bf19d0..8dceca0 100644 --- a/doc/midistats.1 +++ b/doc/midistats.1 @@ -1,4 +1,4 @@ -.TH MIDISTATS 1 "11 February 2024" +.TH MIDISTATS 1 "18 February 2024" .SH NAME \fBmidistats\fP \- program to summarize the statistical properties of a midi file .SH SYNOPSIS @@ -139,6 +139,11 @@ rpats: the number of rhythmpatterns for each channels. This is a duplication of data printed previously. .br pavg: the average pitch of all the notes for each channel. +.br +spread: the percentage of the track that each channel is active. +.PP +If some of the channels appear in more than one track, then +some of the above values may be incorrect. .PP In addition the midistats may return other codes that describe other characteristics. They include diff --git a/doc/readme.txt b/doc/readme.txt index a27f230..cf45a49 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -6,7 +6,7 @@ abc2abc version 2.21 February 19 2024 yaps version 1.93 February 19 2024 abcmatch version 1.83 February 19 2024 midicopy version 1.39 November 08 2022 -midistats version 0.88 March 05 2024 +midistats version 0.89 March 13 2024 24th January 2002 Copyright James Allwright diff --git a/midistats.c b/midistats.c index e3ab543..243171d 100644 --- a/midistats.c +++ b/midistats.c @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#define VERSION "0.88 March 05 2024 midistats" +#define VERSION "0.89 March 13 2024 midistats" /* midistrats.c is a descendent of midi2abc.c which was becoming to large. The object of the program is to extract statistical characterisitic @@ -204,6 +204,8 @@ struct notememory {int eighthUnit; int jumpCount; int totalNotes; int totalPitches; + int quietTime; + int used; } nm[17]; struct notememory tracknm; @@ -709,6 +711,8 @@ for (i=1;i<17;i++) { printf(" %f",trkdata.pitchEntropy[i]); } else printf("-1 0"); + nm[i].quietTime += trkdata.quietTime[i]; + nm[i].used = channel_used_in_track[i]; trkdata.quietTime[i] = 0; /* in case channel i is used in another track */ trkdata.numberOfGaps[i] = 0; if (lasttrack > 1) printf(" %d %d %d\n",tracknm.zeroCount,tracknm.stepCount,tracknm.jumpCount); @@ -776,6 +780,8 @@ void clearNotememory () { nm[i].jumpCount = 0; nm[i].totalNotes =0; nm[i].totalPitches =0; + nm[i].quietTime = 0; + nm[i].used = 0; } } @@ -1363,7 +1369,10 @@ int i; printf("\npavg: "); /* avoid dividing by 0 */ for(i=0;i<16;i++) printf(" %d",nm[i].totalPitches/(1+nm[i].totalNotes)); - printf("\n"); + printf("\nspread: "); + for(i=1;i<17;i++) if(nm[i].used > 0) printf(" %d",100*(trkdata.npulses[0] - nm[i].quietTime)/trkdata.npulses[0]); + else printf(" %d",0); + printf("\n"); } void dualDrumPattern (int perc1, int perc2) {