mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-06 06:55:06 +00:00
2023.10.25
This commit is contained in:
@@ -15103,4 +15103,7 @@ stats_noteon(). In function, output_track_summary(), suppressed
|
|||||||
notemeanpitch for percussion channel.
|
notemeanpitch for percussion channel.
|
||||||
|
|
||||||
|
|
||||||
|
October 25 2023
|
||||||
|
|
||||||
|
Midistats returns track activity (note on/off) for every track.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.TH MIDISTATS 1 "9 December 2022"
|
.TH MIDISTATS 1 "25 October 2023"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
\fBmidistats\fP \- program to summarize the statistical properties of a midi file
|
\fBmidistats\fP \- program to summarize the statistical properties of a midi file
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -77,6 +77,10 @@ that occur in the midi file.
|
|||||||
pitchact is a similar histogram but is weighted by the length of
|
pitchact is a similar histogram but is weighted by the length of
|
||||||
the notes.
|
the notes.
|
||||||
.PP
|
.PP
|
||||||
|
chnact returns the amount of note activity in each channel.
|
||||||
|
.PP
|
||||||
|
trkact returns the number of notes in each track.
|
||||||
|
.PP
|
||||||
totalrhythmpatterns is the total number of bar rhythm patterns for
|
totalrhythmpatterns is the total number of bar rhythm patterns for
|
||||||
all channels except the percussion channel.
|
all channels except the percussion channel.
|
||||||
.PP
|
.PP
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ abc2abc version 2.20 February 07 2023
|
|||||||
yaps version 1.92 January 06 2023
|
yaps version 1.92 January 06 2023
|
||||||
abcmatch version 1.82 June 14 2022
|
abcmatch version 1.82 June 14 2022
|
||||||
midicopy version 1.38 May 06 2022
|
midicopy version 1.38 May 06 2022
|
||||||
midistats version 0.75 September 13 2023
|
midistats version 0.77 October 25 2023
|
||||||
|
|
||||||
24th January 2002
|
24th January 2002
|
||||||
Copyright James Allwright
|
Copyright James Allwright
|
||||||
|
|||||||
15
midistats.c
15
midistats.c
@@ -18,7 +18,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.75 September 13 2023 midistats"
|
#define VERSION "0.77 October 25 2023 midistats"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
/* Microsoft Visual C++ Version 6.0 or higher */
|
/* Microsoft Visual C++ Version 6.0 or higher */
|
||||||
@@ -63,6 +63,7 @@ static FILE *F;
|
|||||||
static FILE *outhandle; /* for producing the abc file */
|
static FILE *outhandle; /* for producing the abc file */
|
||||||
|
|
||||||
int tracknum=0; /* track number */
|
int tracknum=0; /* track number */
|
||||||
|
int lasttrack = 0; /* lasttrack */
|
||||||
int division; /* pulses per quarter note defined in MIDI header */
|
int division; /* pulses per quarter note defined in MIDI header */
|
||||||
int quietLimit; /* minimum number of pulses with no activity */
|
int quietLimit; /* minimum number of pulses with no activity */
|
||||||
long tempo = 500000; /* the default tempo is 120 quarter notes/minute */
|
long tempo = 500000; /* the default tempo is 120 quarter notes/minute */
|
||||||
@@ -171,6 +172,7 @@ int pitchhistogram[12]; /* pitch distribution for non drum notes */
|
|||||||
int channel2prog[17]; /* maps channel to program */
|
int channel2prog[17]; /* maps channel to program */
|
||||||
int channel2nnotes[17]; /*maps channel to note count */
|
int channel2nnotes[17]; /*maps channel to note count */
|
||||||
int chnactivity[17]; /* [SS] 2018-02-02 */
|
int chnactivity[17]; /* [SS] 2018-02-02 */
|
||||||
|
int trkactivity[40]; /* [SS] 2023-10-25 */
|
||||||
int progactivity[128]; /* [SS] 2018-02-02 */
|
int progactivity[128]; /* [SS] 2018-02-02 */
|
||||||
int pitchclass_activity[12]; /* [SS] 2018-02-02 */
|
int pitchclass_activity[12]; /* [SS] 2018-02-02 */
|
||||||
int chanpitchhistogram[204]; /* [SS] 2023-09-13 */
|
int chanpitchhistogram[204]; /* [SS] 2023-09-13 */
|
||||||
@@ -417,6 +419,7 @@ void stats_header (int format, int ntrks, int ldivision)
|
|||||||
quietLimit = ldivision*8;
|
quietLimit = ldivision*8;
|
||||||
divisionsPerBar = division*beatsPerBar;
|
divisionsPerBar = division*beatsPerBar;
|
||||||
unitDivision = divisionsPerBar/24;
|
unitDivision = divisionsPerBar/24;
|
||||||
|
lasttrack = ntrks; /* [SS] 2023-10-25 */
|
||||||
printf("ntrks %d\n",ntrks);
|
printf("ntrks %d\n",ntrks);
|
||||||
printf("ppqn %d\n",ldivision);
|
printf("ppqn %d\n",ldivision);
|
||||||
chordthreshold = ldivision/16; /* [SS] 2018-01-21 */
|
chordthreshold = ldivision/16; /* [SS] 2018-01-21 */
|
||||||
@@ -439,6 +442,7 @@ void stats_header (int format, int ntrks, int ldivision)
|
|||||||
for (i=0;i<12;i++) pitchhistogram[i] = 0; /* [SS] 2017-11-01 */
|
for (i=0;i<12;i++) pitchhistogram[i] = 0; /* [SS] 2017-11-01 */
|
||||||
for (i=0;i<12;i++) pitchclass_activity[i] = 0; /* [SS] 2018-02-02 */
|
for (i=0;i<12;i++) pitchclass_activity[i] = 0; /* [SS] 2018-02-02 */
|
||||||
for (i=0;i<128;i++) progactivity[i] = 0; /* [SS] 2018-02-02 */
|
for (i=0;i<128;i++) progactivity[i] = 0; /* [SS] 2018-02-02 */
|
||||||
|
for (i=0;i<40;i++) trkactivity[i]=0; /* [SS] 2023-10-25 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void determine_progcolor ()
|
void determine_progcolor ()
|
||||||
@@ -524,9 +528,13 @@ else
|
|||||||
for (i=0;i<12;i++) printf("%5.2f ",(double) pitchclass_activity[i]);
|
for (i=0;i<12;i++) printf("%5.2f ",(double) pitchclass_activity[i]);
|
||||||
printf("\nchnact "); /* [SS] 2018-02-08 */
|
printf("\nchnact "); /* [SS] 2018-02-08 */
|
||||||
if (npulses > 0)
|
if (npulses > 0)
|
||||||
for (i=1;i<17;i++) printf("%5.2f ",chnactivity[i]/(double) trkdata.npulses[0]);
|
for (i=1;i<17;i++) printf("%5.3f ",chnactivity[i]/(double) trkdata.npulses[0]);
|
||||||
else
|
else
|
||||||
for (i=0;i<17;i++) printf("%5.2f ",(double) chnactivity[i]);
|
for (i=0;i<17;i++) printf("%5.3f ",(double) chnactivity[i]);
|
||||||
|
printf("\ntrkact ");
|
||||||
|
lasttrack++;
|
||||||
|
for (i=0;i<lasttrack;i++) printf("% 5d",trkactivity[i]);
|
||||||
|
|
||||||
printf("\npitchentropy %f\n",histogram_entropy(pitchclass_activity,12));
|
printf("\npitchentropy %f\n",histogram_entropy(pitchclass_activity,12));
|
||||||
printf("totalrhythmpatterns =%d\n",nrpatterns);
|
printf("totalrhythmpatterns =%d\n",nrpatterns);
|
||||||
printf("collisions = %d\n",ncollisions);
|
printf("collisions = %d\n",ncollisions);
|
||||||
@@ -734,6 +742,7 @@ void stats_noteoff(int chan,int pitch,int vol)
|
|||||||
//if (length < 3) printf("chan = %d lasttick = %d currtime = %ld\n",chan,lastTick[chan*128+pitch],Mf_currtime);
|
//if (length < 3) printf("chan = %d lasttick = %d currtime = %ld\n",chan,lastTick[chan*128+pitch],Mf_currtime);
|
||||||
trkdata.lastNoteOff[chan+1] = Mf_currtime; /* [SS] 2022.08.22 */
|
trkdata.lastNoteOff[chan+1] = Mf_currtime; /* [SS] 2022.08.22 */
|
||||||
chnactivity[chan+1] += length;
|
chnactivity[chan+1] += length;
|
||||||
|
trkactivity[tracknum]++;
|
||||||
if (chan == 9) return; /* drum channel */
|
if (chan == 9) return; /* drum channel */
|
||||||
pitchclass_activity[pitch % 12] += length;
|
pitchclass_activity[pitch % 12] += length;
|
||||||
program = trkdata.program[chan+1];
|
program = trkdata.program[chan+1];
|
||||||
|
|||||||
Reference in New Issue
Block a user