2023.11.08

This commit is contained in:
sshlien
2023-11-08 10:57:05 -05:00
parent b24803bf86
commit d93cb473dc
5 changed files with 67 additions and 21 deletions

View File

@@ -1,2 +1,2 @@
November 01 2023
November 08 2023

View File

@@ -15107,3 +15107,32 @@ October 25 2023
Midistats returns track activity (note on/off) for every track.
November 1 2023
Midistats returns the control volume settings for every track,
identifies midi files whose note timings are not quantized.
November 2 2023
abc2midi bug: In the following example, not all notes are
tied correctly.
X:1
T: tied note
M: 2/4
L: 1/4
K: C
D2-|:D2 |[1CD-:|[2CD|
No fix is available.
November 8 2023
midistats: extended the size of arrays (midievents and pulsecounter) to
handle certain midi files. The function stats_interpret_pulseCounter()
can detect midi files containing triplets and nonquantized notes.
midicopy: extended to handle midi files with up to 150 tracks.

View File

@@ -5,8 +5,8 @@ abc2midi version 4.84 January 06 2023
abc2abc version 2.20 February 07 2023
yaps version 1.92 January 06 2023
abcmatch version 1.82 June 14 2022
midicopy version 1.38 May 06 2022
midistats version 0.78 November 01 2023
midicopy version 1.39 November 08 2022
midistats version 0.79 November 08 2023
24th January 2002
Copyright James Allwright

View File

@@ -52,7 +52,7 @@
#define VERSION "1.38 May 05 2022 midicopy"
#define VERSION "1.39 November 07 2023 midicopy"
#include "midicopy.h"
#define NULLFUNC 0
#define NULL 0
@@ -96,8 +96,9 @@ long max_currtime = 0;
long Mf_currcopytime = 0L; /* time of last copied event */
char *trackdata = NULL;
long trackdata_length, trackdata_size;
char *trackstr[64]; /* [SS] 2017-10-20 2019-07-05*/
int trackstr_length[64]; /* [SS] 2017-10-20 2019-07-05*/
/* char *trackstr[64]; [SS] 2017-10-20 2019-07-05*/
char *trackstr[150]; /* [SS] 2023-11-07 */
int trackstr_length[150]; /* [SS] 2017-10-20 2019-07-05* 2023-11-07*/
int trkid = 0;
int activetrack;
int nochanmsg = 1;
@@ -1290,7 +1291,7 @@ build_new_midi_file (format, ntracks, division, fp)
get_tempo_info_from_track_1 ();
if (ntracks > 63) {printf("too many tracks\n"); exit(1); }
if (ntracks > 149) {printf("too many tracks\n"); exit(1); }
/* The rest of the file is a series of tracks */
for (i = 0; i < ntracks; i++)
@@ -1836,7 +1837,7 @@ main (int argc, char *argv[])
printf ("-ver version information\n");
printf ("-trks n1,n2,..(starting from 1)\n");
printf ("-xtrks n1,n2,.. (tracks to exclude)\n"); /* [SS] 2013-10-27 */
printf ("-xchns n1,n2,.. (tracks to exclude)\n"); /* [SS] 2017-12-06 */
printf ("-xchns n1,n2,.. (channels to exclude)\n"); /* [SS] 2022-11-12 */
printf ("-chns n1,n2,..(starting from 1)\n");
printf ("-from n (in midi ticks)\n");
printf ("-to n (in midi ticks)\n");

View File

@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define VERSION "0.78 October 30 2023 midistats"
#define VERSION "0.79 November 08 2023 midistats"
#include <limits.h>
/* Microsoft Visual C++ Version 6.0 or higher */
@@ -94,7 +94,7 @@ struct eventstruc {int onsetTime;
unsigned char channel;
unsigned char pitch;
unsigned char velocity;
;} midievents[40000];
;} midievents[50000];
int lastEvent = 0;
@@ -200,7 +200,7 @@ static int progmapper[] = {
16, 16, 16, 16, 16, 16, 16, 16
};
int pulseCounter[480];
int pulseCounter[1024];
int pulseDistribution[24];
struct barPattern {
@@ -474,9 +474,14 @@ int i;
/* [SS] 2023-10-30 */
void stats_interpret_pulseCounter () {
int i;
int i,j;
int maxcount,ncounts;
int maxloc;
float threshold,peak;
int decimate;
float tripletsCriterion;
int resolution = 12;
threshold = 10.0/(float) division;
maxcount = 0;
ncounts = 0;
for (i=0;i<division;i++) {
@@ -486,9 +491,19 @@ for (i=0;i<division;i++) {
maxcount = pulseCounter[i];
}
}
//printf("maxpulse = %f at %d\n",(float) maxcount/(float) ncounts, maxloc);
if ((float) maxcount/(float) ncounts < 0.05) printf("unquantized\n");
for (i = 0; i < resolution; i++) pulseDistribution[i] = 0;
decimate = division/resolution;
for (i = 0; i < division; i++) {
j = i/decimate;
pulseDistribution[j] += pulseCounter[i];
}
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");
tripletsCriterion = (float) pulseDistribution[8]/ (float) ncounts;
/*printf("tripletsCriterion = %f\n",tripletsCriterion);*/
if (tripletsCriterion > 0.15) printf("triplets\n");
}
void stats_finish()
@@ -704,7 +719,7 @@ int chan, pitch, vol;
}
pulsePosition = Mf_currtime % division;
pulseCounter[pulsePosition]++;
if (pulsePosition >= 480) {printf("pulsePosition = %d too large\n",pulsePosition);
if (pulsePosition >= 1023) {printf("pulsePosition = %d too large\n",pulsePosition);
exit(1);
}
trkdata.notemeanpitch[chan+1] += pitch;
@@ -909,7 +924,7 @@ midievents[lastEvent].channel = chan;
midievents[lastEvent].pitch = pitch;
midievents[lastEvent].velocity = vol;
lastEvent++;
if (lastEvent > 39999) {printf("ran out of space in midievents structure\n");
if (lastEvent > 49999) {printf("ran out of space in midievents structure\n");
exit(1);
}
}
@@ -934,6 +949,7 @@ int int_compare_events(const void *a, const void *b) {
void load_header (int format, int ntrks, int ldivision)
{
division = ldivision;
lasttrack = ntrks;
}
@@ -962,7 +978,7 @@ void initfunc_for_stats()
Mf_seqspecific = no_op3;
Mf_text = stats_metatext;
Mf_arbitrary = no_op2;
for (i = 0; i< 480; i++) pulseCounter[i] = 0;
for (i = 0; i< 1023; i++) pulseCounter[i] = 0;
}
@@ -1014,16 +1030,16 @@ int pulsePosition;
int decimate;
float fraction;
int resolution = 12;
for (i = 0; i< 480; i++) pulseCounter[i] = 0;
for (i = 0; i< 1023; i++) pulseCounter[i] = 0;
for (i = 0; i < lastEvent; i++) {
pulsePosition = midievents[i].onsetTime % division;
pulseCounter[pulsePosition]++;
if (pulsePosition >= 480) {printf("pulsePosition = %d too large\n",pulsePosition);
if (pulsePosition >= 1023) {printf("pulsePosition = %d too large\n",pulsePosition);
exit(1);
}
}
for (i = 0; i < resolution; i++) pulseDistribution[i] = 0;
/*for (i = 0; i < 480; i++) printf(" %d",pulseCounter[i]);
/*for (i = 0; i < 1023; i++) printf(" %d",pulseCounter[i]);
printf("\n");
*/
decimate = division/resolution;
@@ -1205,7 +1221,7 @@ printf("\n");
void corestatsOutput() {
printf("%d\t%d\t%d\n", division,lastEvent,lastBeat);
printf("%d\t%d\t%d\t%d\n",lasttrack, division,lastEvent,lastBeat);
}