Skip to content

Commit

Permalink
Generating a data melody over the percussion.
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonHD committed Jun 28, 2024
1 parent 96ce053 commit af2e39f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
14 changes: 9 additions & 5 deletions javasrc/org/hd/d/statsHouse/feedHits/GenerateSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ public static MIDITune summary1(final List<String> dirnames) throws IOException
return(new MIDITune(dataMelody, List.of(percussion), tsp, dv));
}

/**Map from bytes/hits status code to tone offset in scale, sorted, non-null. */
/**Map from bytes/hits status code to tone offset in scale, sorted, non-null.
* Bad statuses are negative.
*/
private static Map<String, Byte> type2CodeMap = Collections.unmodifiableSortedMap(new TreeMap<>(Map.of(
"503", (byte)-7,
"429", (byte)-5,
Expand Down Expand Up @@ -303,12 +305,16 @@ public static MIDITune summary2(final List<String> dirnames) throws IOException
int channel = 0;
for(final String k : type2CodeMap.keySet())
{
final byte offset = type2CodeMap.get(k);
final boolean isBad = (offset < 0);
// Setup for the melody tracks.
final MIDITrackSetup trSetupStatus304Melody = new MIDITrackSetup(
(byte) channel++,
MIDIInstrument.LEAD_2_SAWTOOTH_WAVE.instrument0,
isBad ?
MIDIInstrument.LEAD_2_SAWTOOTH_WAVE.instrument0 :
MIDIInstrument.SYNTH_BRASS_1.instrument0,
MIDIConstant.DEFAULT_VOLUME,
(byte)(32 + type2CodeMap.get(k)), // Off to the left.
(byte)((isBad ? 32 : 96) + offset), // Off to the left for bad, right is good.
"status: " + k);
final List<MIDIPlayableMonophonicDataBar> dbS = new ArrayList<>(nDataBars);
db.put(k, dbS);
Expand All @@ -320,8 +326,6 @@ public static MIDITune summary2(final List<String> dirnames) throws IOException
// Capture maximum normalised value of each also.
final float[] normalisedHitsPerHour = new float[nTotalHours];
float normalisedHitsPerHourMax = 0;
// // Also capture the normalisation value (days in block) for each hour.
// final int daysInThisBlock[] = new int[nTotalHours];

int hourIndex = 0;
for(final FeedStatusBlock fsb : fsbs.blocks())
Expand Down
22 changes: 22 additions & 0 deletions test/Main-feedHits-save-summary-2.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/statsHouse/javasrc/org/hd/d/statsHouse/Main.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.hd.d.statsHouse.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="statsHouse"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-feedHitsSummary fh2 2 ../RSS-data/20240519 ../RSS-data/20240527"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="statsHouse"/>
</launchConfiguration>

0 comments on commit af2e39f

Please sign in to comment.