From 8a2ec3a8989b1c33f0636ac02ffac02540b5d644 Mon Sep 17 00:00:00 2001 From: sshlien Date: Wed, 6 Sep 2023 17:37:58 -0400 Subject: [PATCH] 2023.09.06 --- VERSION | 2 +- doc/midistats.1 | 7 ++----- doc/readme.txt | 2 +- midistats.c | 21 ++++++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/VERSION b/VERSION index 5f6b478..83d1b7c 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -August 31 2023 +September 06 2023 diff --git a/doc/midistats.1 b/doc/midistats.1 index acc1faf..b3e1fd3 100644 --- a/doc/midistats.1 +++ b/doc/midistats.1 @@ -36,7 +36,8 @@ the sum of the MIDI pitches for all the notes, the sum of the note durations in MIDI pulse units, the number of control parameter messages, the number of pressure messages. -and the number of distinct rhythm patterns for each channel +the number of distinct rhythm patterns for each channel +the number of pulses the channel was inactive the minimum pitch value the maximum pitch value the minimum note length in pulses @@ -74,10 +75,6 @@ that occur in the midi file. pitchact is a similar histogram but is weighted by the length of the notes. .PP -quietTime is used to compute the track/channel spread in midiexplorer. -It is computed by summing up all the midi pulses which occur -in gaps greater than 8 beats. -.PP totalrhythmpatterns is the total number of bar rhythm patterns for all channels except the percussion channel. .PP diff --git a/doc/readme.txt b/doc/readme.txt index a75bd88..c2b0d0a 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -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.38 May 06 2022 -midistats version 0.72 August 31 2023 +midistats version 0.73 September 06 2023 24th January 2002 Copyright James Allwright diff --git a/midistats.c b/midistats.c index 2462758..c14e5dc 100644 --- a/midistats.c +++ b/midistats.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#define VERSION "0.72 August 31 2023 midistats" +#define VERSION "0.73 September 09 2023 midistats" #include /* Microsoft Visual C++ Version 6.0 or higher */ @@ -118,6 +118,7 @@ int notechan[2048],notechanvol[2048]; /*for linking on and off midi int lastTick[2048]; /* for getting last pulse number for chan (0-15) and pitch (0-127) in MIDI file */ int last_on_tick[17]; /* for detecting chords [SS] 2019-08-02 */ int channel_active[17]; /* for dealing with chords [SS] 2023-08-30 */ +int channel_used_in_track[17]; /* for dealing with quietTime [SS] 2023-09-06 */ int histogram[256]; unsigned char drumpat[8000]; @@ -522,14 +523,12 @@ if (npulses > 0) for (i=1;i<17;i++) printf("%5.2f ",chnactivity[i]/(double) trkdata.npulses[0]); else for (i=0;i<17;i++) printf("%5.2f ",(double) chnactivity[i]); -printf("\nquietTime "); +/*printf("\nquietTime "); for (i=1;i<17;i++) { - delta = trkdata.npulses[0] - trkdata.quietTime[i]; - if (trkdata.quietTime[i] < quietLimit) delta = 0; - delta = delta / (double) trkdata.npulses[0]; - /* printf (" %5.3f ", delta); */ printf (" %d ", trkdata.quietTime[i]); } + It is all zeros [SS] 2023-09-06 +*/ printf("\npitchentropy %f\n",histogram_entropy(pitchclass_activity,12)); printf("totalrhythmpatterns =%d\n",nrpatterns); @@ -599,7 +598,7 @@ for (i=1;i<17;i++) { if (i != 10) printf("%d %d %d %d",trkdata.notepitchmin[i], trkdata.notepitchmax[i] ,trkdata.notelengthmin[i], trkdata.notelengthmax[i]); else printf("-1 0"); - trkdata.quietTime[i] = 0; + trkdata.quietTime[i] = 0; /* in case channel i is used in another track */ printf("\n"); channel2nnotes[i] += trkdata.notecount[i] + trkdata.chordcount[i]; @@ -629,12 +628,15 @@ void stats_trackstart() printf("trk %d \n",tracknum); for (i=0;i<2048;i++) lastTick[i] = -1; + for (i=0;i<17;i++) channel_used_in_track[i] = 0; /* [SS] 2023-09-06 */ } void stats_trackend() { - trkdata.npulses[tracknum] = Mf_currtime; + int chan; if (trkdata.npulses[0] < Mf_currtime) trkdata.npulses[0] = Mf_currtime; + for (chan = 1; chan < 17; chan++) /* [SS] 2023-09-06 */ + if (channel_used_in_track[chan] > 0) trkdata.quietTime[chan] += (trkdata.npulses[0] - trkdata.lastNoteOff[chan]); output_track_summary(); } @@ -648,6 +650,7 @@ int chan, pitch, vol; int unit; int dithermargin; /* [SS] 2023-08-22 */ + channel_used_in_track[chan+1]++; /* [SS] 2023-09-06 */ dithermargin = unitDivision/2 - 1; if (vol == 0) { /* treat as noteoff */ @@ -715,7 +718,7 @@ void stats_noteoff(int chan,int pitch,int vol) trkdata.notelength[chan+1] += length; trkdata.notelengthmax[chan+1] = max(trkdata.notelengthmax[chan+1],length); trkdata.notelengthmin[chan+1] = min(trkdata.notelengthmin[chan+1],length); - 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 */ chnactivity[chan+1] += length; if (chan == 9) return; /* drum channel */