Java note mapper (v0.1)

Here’s a little bit of Java code to brighten your day.

Two weeks ago, I described the additional hi-hat notes in the Yamaha Genos™ Revo drum kits. The hi-hat sounds replace noises like sequence click, etc. in the lowest numbered notes of the MIDI scale. Thus, a Genos factory style wheezes, zings and clicks when it is played on a legacy PSR or Tyros arranger workstation.

Quite a few people would like to try the new Genos styles, but the hi-hat notes pose a major barrier to conversion (i.e., porting a Genos style to legacy PSR/Tyros). Jørgen Sørensen’s Revo Drum Cleaner suppresses these sounds, but does not remap the Genos hi-hat notes to General MIDI (GM) standard notes.

That’s where note remapper comes in. Note remapper is an experimenter’s kit, not a finished tool. Jørgen (and Michael Bedesem) have written many rather nice tools for the PSR/Tyros arranger workstations. Note remapper gets the job done from the command line, so don’t expect a graphical user interface (GUI) or even a nice installer! It’s an experimenter’s kit.

However, what you do get is source code. Here is the ZIP file containing source, precompiled Java classses (executables), map files and examples.

What else can you do with note mapper? Well, note mapper operates on any Standard MIDI File (SMF). Thus, it’s not just a PSR/Tyros utility. Maybe you want to write a Java program of your own. The source code will give you a good starting point. Copy and modify to your heart’s content.

If you are into converting PSR/Tyros styles, take notice (pun) that note mapper changes both the MIDI note number and velocity according to maps in the files keymap.txt and velmap.txt, respectively. Therefore, you can also map to and from Mega Voices.

Interested? Then please read on. The following text is taken from the README files.

Description

This Java program maps the notes in a standard MIDI file according to a key (note number) map and a velocity map. Use it to map the Yamaha Revo hi-hat/drum sounds. Or, use it to map to and from Mega Voice. It’s all up to you and how you design your key and velocity maps.

The note mapper is launched from the command line (no GUI). There are two command line options:

   -v  Verbose flag
   -w  Write default keymap.txt, velmap.txt and hhmap.txt files

The -w option gives the user a quick start by writing a few default map files. Both -v and -w are optional.

The rest of the command line consists of an (optional) MIDI channel number and the name of the MIDI file to be mapped. The channel number must be an integer in the range [1:16]. Only notes in the specified channel are mapped. The default channel is 10 (the GM/XG drum channel).

The note mapper writes a new file named mapped.mid. It’s up to the user to rename or save this file. If the file in not renamed or saved, it will be overwritten when note mapper is run again.

The note mapper assumes there are two files, keymap.txt and velmap.txt, in the working directory where the note mapper is launched. The note mapper reports an error if it cannot read these two files. The default key and velocity maps preserve the input; the input notes are sent to the output without change.

A map file consists of 128 positive integers in the range [0:127]. Each integer defines how its corresponding note or velocity value is mapped to a new value. Essentially, each integer in the file is loaded into a 128 byte map array indexed by either the incoming MIDI note number or the incoming MIDI velocity value.

The hhmap.txt maps the Revo hi-hat note numbers to General MIDI hi-hat note numbers.

    Revo notes        GM notes
    -------------     ----------------
    13 14 15 16   --> 42 Hi-Hat Closed
    21            --> 44 Hi-Hat Pedal
    17 18 19 20   --> 46 Hi-Hat Open
    22            --> 55 Splash Cymbal

The Examples directory contains two example Genos styles. Be sure to read the READ_THIS.TXT file in that directory, too!

Example command lines

Map the notes for channel 10 in the MIDI file named “Mr.Soul_factory.T552.mid”.

    java MapNotes 10 Mr.Soul_factory.T552.mid

Write the default keymap.txt, velmap.txt and hhmap.txt files before mapping:

    java MapNotes -w 10 Mr.Soul_factory.T552.mid

The default keymap.txt and velmap.txt files do not change/map notes, i.e.,
they are the “identity mapping.”

How to use note mapper to change a style

To use the note mapper on a style, you must split the style into its MIDI and non-MIDI parts using Jørgen Sørensen’s Split/Splice tool. Note mapper, like most commercial MIDI tools, does not recognize or retain non-MIDI data. Thus, you need to run the style through Split/Splice to save the non-MIDI information.

After splitting the style, run the style through the note mapper. The note mapper writes a file named “mapped.txt”. Splice mapped.txt with the non-MIDI data produced in the preceding step. Splicing the mapped MIDI data with the non-MIDI data produces a complete style file (MIDI+CASM+OTS).

Transfer the style file to your PSR/Tyros and revoice the style parts, test the style, edit the OTS, and so forth.

If you don’t like how the mapped file sounds, then you can reuse the non-MIDI data and do another map/splice, assuming that you didn’t modify the OTS.

Compiling

The distribution comes with source code (*.java files) and precompiled class files (*.class files).

You can, of course, modify the source code and recompile. You need the Java development kit which includes the Java compiler, package definitions, and so forth. To recompile, just enter:

    javac MapNotes.java
    javac NoteMapper.java

I have included source for a quick and dirty MIDI file dumper:

    javac QuickDumper.java
    javac QuickDump.java

You may prefer to dump MIDI files using one of the much better tools written by Jørgen Sørensen or Michael Bedesem. See:

The Examples directory

The Examples directory contains two example styles: Mr.Soul and SoulSupreme. Each style has several files, so here’s a little guide.

    Mr.Soul_factory.T552.prs    Original Genos factory style
    Mr.Soul_factory.T552.mid    Original Genos MIDI part
    Mr.Soul_factory.T552.nmi    Original Genos non-MIDI part
    Mr.Soul_mapped.T552.mid     MIDI with mapped hi-hats
    Mr.Soul_mapped.T552.sty     New style file with mapped hi-hats

The *.class files are the Java executable files. Example command line:

    java MapNotes 10 Mr.Soul_factory.T552.mid

The note mapper produces a file named “mapped.mid” which you may rename to something else, e.g., Mr.Soul_mapped.T552.mid.

keymap.txt and velmap.txt are the key (note number) and velocity map files needed by note mapper. hhmap.txt is my initial hi-hat note map.

Workflow

The overall workflow is:

               Mr.Soul_factory.T552.prs
                          |
                          |
                          V
              Jørgen's Split/Slice (split)
              |                          |
              |                          |
              V                          V
  Mr.Soul_factory.T552.mid   Mr.Soul_factory.T552.nmi
              |                          |
              |                          |
              V                          |
         Note mapper                     |
              |                          |
              V                          |
      Rename mapped.mid                  |
              |                          |
              V                          |
  Mr.Soul_mapped.T552.mid                |
              |                          |
              |                          |
              V                          V
             Jørgen's Split/Slice  (splice)
                          |
                          |
                          V
               Mr.Soul_mapped.T552.sty

Copyright (c) 2017 Paul J. Drongowski