mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-06 06:55:06 +00:00
2023.11.14
This commit is contained in:
@@ -15,9 +15,10 @@ track which distinguishes the MIDI files. This is attempted
|
||||
in the program midistats. Here is a short description.
|
||||
|
||||
-corestats
|
||||
Produces a line with 3 numbers separated by tabs. eg
|
||||
384 8349 448
|
||||
It returns the number of divisions per quarter note beat (ppqn),
|
||||
Produces a line with 5 numbers separated by tabs. eg
|
||||
1 8 384 4057 375
|
||||
It returns the number of tracks, the number of channels, the
|
||||
number of divisions per quarter note beat (ppqn),
|
||||
the number of note onsets in the midi file, and the maximum
|
||||
number of quarter note beats in midi file.
|
||||
|
||||
|
||||
@@ -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.79 November 08 2023
|
||||
midistats version 0.80 November 13 2023
|
||||
|
||||
24th January 2002
|
||||
Copyright James Allwright
|
||||
|
||||
20
midistats.c
20
midistats.c
@@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define VERSION "0.79 November 08 2023 midistats"
|
||||
#define VERSION "0.80 November 13 2023 midistats"
|
||||
|
||||
#include <limits.h>
|
||||
/* Microsoft Visual C++ Version 6.0 or higher */
|
||||
@@ -479,7 +479,7 @@ int maxcount,ncounts;
|
||||
int maxloc;
|
||||
float threshold,peak;
|
||||
int decimate;
|
||||
float tripletsCriterion;
|
||||
float tripletsCriterion8,tripletsCriterion4;
|
||||
int resolution = 12;
|
||||
threshold = 10.0/(float) division;
|
||||
maxcount = 0;
|
||||
@@ -501,9 +501,11 @@ for (i = 0; i < division; 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;
|
||||
tripletsCriterion8 = (float) pulseDistribution[8]/ (float) ncounts;
|
||||
tripletsCriterion4 = (float) pulseDistribution[4]/ (float) ncounts;
|
||||
/*printf("tripletsCriterion = %f\n",tripletsCriterion);*/
|
||||
if (tripletsCriterion > 0.15) printf("triplets\n");
|
||||
if (tripletsCriterion8 > 0.10 || tripletsCriterion4 > 0.10) printf("triplets\n");
|
||||
if (pulseDistribution[0]/(float) ncounts > 0.95) printf("qnotes");
|
||||
}
|
||||
|
||||
void stats_finish()
|
||||
@@ -927,6 +929,7 @@ lastEvent++;
|
||||
if (lastEvent > 49999) {printf("ran out of space in midievents structure\n");
|
||||
exit(1);
|
||||
}
|
||||
channel_active[chan+1]++;
|
||||
}
|
||||
|
||||
void record_noteoff(int chan,int pitch,int vol)
|
||||
@@ -948,8 +951,10 @@ int int_compare_events(const void *a, const void *b) {
|
||||
|
||||
void load_header (int format, int ntrks, int ldivision)
|
||||
{
|
||||
int i;
|
||||
division = ldivision;
|
||||
lasttrack = ntrks;
|
||||
for (i=0;i<17;i++) channel_active[i] = 0; /* for counting number of channels*/
|
||||
}
|
||||
|
||||
|
||||
@@ -1221,7 +1226,12 @@ printf("\n");
|
||||
|
||||
|
||||
void corestatsOutput() {
|
||||
printf("%d\t%d\t%d\t%d\n",lasttrack, division,lastEvent,lastBeat);
|
||||
int i;
|
||||
int nchannels;
|
||||
nchannels = 0;
|
||||
for (i=1;i<17;i++)
|
||||
if (channel_active[i] > 0) nchannels++;
|
||||
printf("%d\t%d\t%d\t%d\t%d\n",lasttrack,nchannels, division,lastEvent,lastBeat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user