2024.06.09

This commit is contained in:
sshlien
2024-06-09 08:52:14 -04:00
parent 45bd1a7102
commit 13c93c3d74
4 changed files with 23 additions and 10 deletions

View File

@@ -1 +1 @@
June 03 2024 June 06 2024

View File

@@ -6,7 +6,7 @@ abc2abc version 2.22 April 30 2024
yaps version 1.94 April 30 2024 yaps version 1.94 April 30 2024
abcmatch version 1.83 February 19 2024 abcmatch version 1.83 February 19 2024
midicopy version 1.39 November 08 2022 midicopy version 1.39 November 08 2022
midistats version 0.92 June 03 2024 midistats version 0.93 June 06 2024
24th January 2002 24th January 2002
Copyright James Allwright Copyright James Allwright

View File

@@ -415,8 +415,12 @@ int type;
m = msg(); m = msg();
switch ( type ) { switch ( type ) {
case 0x00: case 0x00:
if ( Mf_seqnum ) if ( Mf_seqnum ) {
if (leng < 1) {printf("Error: zero length meta seqnumber\n");
exit(1);
}
(*Mf_seqnum)(to16bit(m[0],m[1])); (*Mf_seqnum)(to16bit(m[0],m[1]));
}
break; break;
case 0x01: /* Text event */ case 0x01: /* Text event */
case 0x02: /* Copyright notice */ case 0x02: /* Copyright notice */

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define VERSION "0.92 June 03 2024 midistats" #define VERSION "0.93 June 07 2024 midistats"
/* midistrats.c is a descendent of midi2abc.c which was becoming to /* midistrats.c is a descendent of midi2abc.c which was becoming to
large. The object of the program is to extract statistical characterisitic large. The object of the program is to extract statistical characterisitic
@@ -245,7 +245,7 @@ static int progmapper[] = {
16, 16, 16, 16, 16, 16, 16, 16 16, 16, 16, 16, 16, 16, 16, 16
}; };
int pulseCounter[1024]; int pulseCounter[2048];
int pulseDistribution[24]; int pulseDistribution[24];
struct barPattern { struct barPattern {
@@ -463,6 +463,14 @@ void stats_header (int format, int ntrks, int ldivision)
{ {
int i; int i;
division = ldivision; division = ldivision;
if(division < 12) {
printf("Error: division (PPQN) is too small\n");
exit(1);
}
if(ntrks > 40) {
printf("Error: too many tracks = %d\n",ntrks);
exit(1);
}
halfdivision = ldivision/2; halfdivision = ldivision/2;
quietLimit = ldivision*8; quietLimit = ldivision*8;
divisionsPerBar = division*beatsPerBar; divisionsPerBar = division*beatsPerBar;
@@ -532,6 +540,7 @@ threshold = 10.0/(float) division;
maxcount = 0; maxcount = 0;
ncounts = 0; ncounts = 0;
npeaks = 0; npeaks = 0;
if (division > 2047) return; /* PPQN is too large for pulseCounter */
for (i=0;i<division;i++) { for (i=0;i<division;i++) {
ncounts = ncounts + pulseCounter[i]; ncounts = ncounts + pulseCounter[i];
if (pulseCounter[i] > maxcount) { if (pulseCounter[i] > maxcount) {
@@ -903,10 +912,10 @@ int chan, pitch, vol;
return; return;
} }
pulsePosition = Mf_currtime % division; pulsePosition = Mf_currtime % division;
pulseCounter[pulsePosition]++; if (pulsePosition >= 2047) {printf("Error: pulsePosition = %d too large\n",pulsePosition);
if (pulsePosition >= 1023) {printf("pulsePosition = %d too large\n",pulsePosition);
exit(1); exit(1);
} }
pulseCounter[pulsePosition]++;
trkdata.notemeanpitch[chan+1] += pitch; trkdata.notemeanpitch[chan+1] += pitch;
trkdata.notepitchmax[chan+1] = max(trkdata.notepitchmax[chan+1],pitch); trkdata.notepitchmax[chan+1] = max(trkdata.notepitchmax[chan+1],pitch);
trkdata.notepitchmin[chan+1] = min(trkdata.notepitchmin[chan+1],pitch); trkdata.notepitchmin[chan+1] = min(trkdata.notepitchmin[chan+1],pitch);
@@ -1183,7 +1192,7 @@ void initfunc_for_stats()
Mf_seqspecific = no_op3; Mf_seqspecific = no_op3;
Mf_text = stats_metatext; Mf_text = stats_metatext;
Mf_arbitrary = no_op2; Mf_arbitrary = no_op2;
for (i = 0; i< 1023; i++) pulseCounter[i] = 0; for (i = 0; i< 2047; i++) pulseCounter[i] = 0;
} }
@@ -1235,11 +1244,11 @@ int pulsePosition;
int decimate; int decimate;
float fraction; float fraction;
int resolution = 12; int resolution = 12;
for (i = 0; i< 1023; i++) pulseCounter[i] = 0; for (i = 0; i< 2047; i++) pulseCounter[i] = 0;
for (i = 0; i < lastEvent; i++) { for (i = 0; i < lastEvent; i++) {
pulsePosition = midievents[i].onsetTime % division; pulsePosition = midievents[i].onsetTime % division;
pulseCounter[pulsePosition]++; pulseCounter[pulsePosition]++;
if (pulsePosition >= 1023) {printf("pulsePosition = %d too large\n",pulsePosition); if (pulsePosition > 2047) {printf("pulsePosition = %d too large\n",pulsePosition);
exit(1); exit(1);
} }
} }