From 612c2eb27f8368cca5ce646d24d2f2a1f30e4eab Mon Sep 17 00:00:00 2001 From: DamonHD Date: Fri, 31 May 2024 13:47:03 +0100 Subject: [PATCH] Lower tom in skipHours. --- RELEASES.txt | 1 + .../statsHouse/feedHits/GenerateSummary.java | 34 +++++++++++++++---- .../midi/MIDIPercusssionInstrument.java | 6 +++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/RELEASES.txt b/RELEASES.txt index 33954be..4c1b627 100644 --- a/RELEASES.txt +++ b/RELEASES.txt @@ -13,6 +13,7 @@ or release/freeze points. SIGNIFICANT CHANGES SINCE LAST RELEASE ====================================== + DHD20240531: -feedHitsSummary type 1 uses lower tom in skipHours. diff --git a/javasrc/org/hd/d/statsHouse/feedHits/GenerateSummary.java b/javasrc/org/hd/d/statsHouse/feedHits/GenerateSummary.java index 7084854..248f565 100644 --- a/javasrc/org/hd/d/statsHouse/feedHits/GenerateSummary.java +++ b/javasrc/org/hd/d/statsHouse/feedHits/GenerateSummary.java @@ -24,6 +24,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.hd.d.statsHouse.feedHits.data.FeedStatus; import org.hd.d.statsHouse.feedHits.data.FeedStatusBlock; import org.hd.d.statsHouse.feedHits.data.FeedStatusBlocks; import org.hd.d.statsHouse.generic.NoteAndVelocity; @@ -75,6 +76,9 @@ public static MIDITune summary1(final List dirnames) throws IOException final float[] normalisedBytesPerHour = new float[nTotalHours]; float normalisedHitsPerHourMax = 0; float normalisedBytesPerHourMax = 0; + // Capture skipHours. + final boolean[] isSkipHour = new boolean[nTotalHours]; + int hourIndex = 0; for(final FeedStatusBlock fsb : fsbs.blocks()) { @@ -83,12 +87,24 @@ public static MIDITune summary1(final List dirnames) throws IOException // For the 24h in each block. for(int h = 0; h < 24; ++h) { - final float nh = fsb.records().get(h).hits() / nDaysF; - final float nb = fsb.records().get(h).bytes() / nDaysF; + final FeedStatus feedStatus = fsb.records().get(h); + final float nh = feedStatus.hits() / nDaysF; + final float nb = feedStatus.bytes() / nDaysF; normalisedHitsPerHour[hourIndex] = nh; normalisedBytesPerHour[hourIndex] = nb; if(nh > normalisedHitsPerHourMax) { normalisedHitsPerHourMax = nh; } if(nb > normalisedBytesPerHourMax) { normalisedBytesPerHourMax = nb; } + + // Is a skipHour if non-zero "SH" hits + // OR "SH" key absent and time >=22:00 and < 08:00. + final Integer hitsHS = feedStatus.getColsMap().get("SH"); + if(null != hitsHS) { if(hitsHS > 0) { isSkipHour[hourIndex] = true; } } + else + { + final int hourOfDay = hourIndex % 24; + if((hourOfDay < 8) || (hourOfDay >= 22)) { isSkipHour[hourIndex] = true; } + } + ++hourIndex; } } @@ -114,22 +130,28 @@ public static MIDITune summary1(final List dirnames) throws IOException final SortedSet notes = new TreeSet<>(); final byte DRUMB = MIDIPercusssionInstrument.HI_MID_TOM.instrument0; - final byte DRUMH = MIDIPercusssionInstrument.LOW_MID_TOM.instrument0; -// final byte DRUMH = MIDIPercusssionInstrument.ACOUSTIC_BASE_DRUM.instrument0; final byte vDRUM = MIDIGen.DEFAULT_MAX_MELODY_VELOCITY; for(int b = 0; b < nHoursPerBar; ++b) { + final int hour = h+b; + + // Push hits tone even lower in skip hours. + final byte DRUMH = (isSkipHour[h+b] ? + MIDIPercusssionInstrument.LOW_TOM : + MIDIPercusssionInstrument.LOW_MID_TOM) + .instrument0; + final int beatStart = b * MIDIGen.DEFAULT_CLKSPQTR; // On beat: bytes - final float intB = normalisedBytesPerHour[h+b] / normalisedBytesPerHourMax; + final float intB = normalisedBytesPerHour[hour] / normalisedBytesPerHourMax; //System.out.println(intB); notes.add(new MIDIPlayableBar.StartNoteVelocityDuration( beatStart, new NoteAndVelocity(DRUMB, (byte) Math.round(vDRUM * intB)), MIDIGen.DEFAULT_CLKSPQTR/2-1)); // Off beat: hits - final float intH = normalisedHitsPerHour[h+b] / normalisedHitsPerHourMax; + final float intH = normalisedHitsPerHour[hour] / normalisedHitsPerHourMax; //System.out.println(intH); notes.add(new MIDIPlayableBar.StartNoteVelocityDuration( beatStart + MIDIGen.DEFAULT_CLKSPQTR/2, diff --git a/javasrc/org/hd/d/statsHouse/midi/MIDIPercusssionInstrument.java b/javasrc/org/hd/d/statsHouse/midi/MIDIPercusssionInstrument.java index ba24fb6..ece1e5c 100644 --- a/javasrc/org/hd/d/statsHouse/midi/MIDIPercusssionInstrument.java +++ b/javasrc/org/hd/d/statsHouse/midi/MIDIPercusssionInstrument.java @@ -37,8 +37,12 @@ public enum MIDIPercusssionInstrument OPEN_HI_HAT(46), + LOW_FLOOR_TOM(41), + HIGH_FLOOR_TOM(43), + LOW_TOM(45), LOW_MID_TOM(47), - HI_MID_TOM(48); + HI_MID_TOM(48), + HI_TOM(50); /**Raw zero-based instrument number. */ public final byte instrument0;