Hatari MIDI Mapper v1.002

I got some feedback that the original Hatari MIDI Mapper from 2021 did not work for old Sierra games (for example Police Quest 2) when enabled to play on the MT-32. Many thanks to Eugene B for the testing and feedback!

I investigated the issue and found out that I did a silly mistake handling MIDI System Exclusive messages and as the Sierra games starts to send a bunch of SysEx messages to the MT-32, probably to set up sounds etc, the connection between Hatari and the Hatari MIDI Mapper crashed.

I fixed it and have now uploaded a new version of the Hatari MIDI Mapper in the downloads area: HatariMidiMapper1.002.

As the Hatari version used for the MIDI input/output to Hatari MIDI Mapper is based on Hatari 2.4.0 and the 2.4.1 was released August 2022, I might recompile a Hatari 2.4.1 with my MIDI hooks for Hatari MIDI Mapper if there is interest for it. But I also know that the Hatari developers are working hard on a next release that doesn't look to be that far off, so I might hold off until then...

EPSS Editor v1.18.1

The latest version can be downloaded from the Downloads page.

Changes:

  • Add support of loading samples and programs from SoundFont .SF2 format. The Program Change mode has to be chosen as it will be mapped as Program Change according to the information in the SF2. Only sample, loop information, key range and root key information is imported. Bank 128 (percussion sounds) will be automatically mapped on MIDI Channel 10.
  • Undo (Ctrl-Z)/Redo (Ctrl-Y) implemented. Some limitations:
    • Rename of a sound will reset the Undo buffer as it is not supported to undo a rename in the file system.
    • Does not keep selected sound in Input Sounds nor SPI Sounds after Undo/Redo.
  • Add support of loading samples in following formats:
    • Ogg Vorbis (file extension .ogg)
    • MP3 files.
    • AIFF/AIFC files.
    • Any format that is supported by Windows Media Foundation. That basically means that it is possible to load everything as a sound that you have a audio codec installed in your system for.
  • All the additional sample formats works with:
    • Samples defined when Importing SFZ instruments
    • Drag&Drop one or many files on left side Sound list.
    • Load... button below Sounds box can load one or many files.
  • When SFZ import imports multiple SPI Sounds defined on same note, we change to play the selected SPI Sound when double clicking on it. It is therefore possible to hear differences between SPI Sounds defined on the same note.

Bug fixes:

  • Edit menu added and some functions previously on buttons moved to the Edit menu in an attempt to de-clutter the UI a bit.
  • Better response for delete operations when working with long list of sounds.
  • Corrected tooltips on MID transport buttons
  • Load Sample button crashed first time. Now defaults to My Documents.
  • Save SPI Sample button crashed first time. Now defaults to My Document.
  • One octave off when parsing note entered in custom mappings. Now it conforms to the standard that C-1 is MIDI Note 0, C3 is MIDI Note 60 and G8 is MIDI note 127. Also possible to enter number for the custom mappings to avoid any confusion. The GM Percussion mapping match this standard as well.
  • More robust SFZ import, handles groups and regions more correct. Allows spaces in sample names even when there are more parameters on the line. Reuses sounds if used in multiple regions.
  • More descriptive error messages when importing sounds and SFZ. Tries to load all sounds it can do without errors and reports the total of errors at the end of the load when using multiple sounds or multiple SFZ files.
  • Total SPI Size was broken and is now fixed and shows the projected size of the SPI again.
  • Loop now preserves loop points correct when sound is added as SPI Sound.
  • When SPI Sound is saved as WAV, the loop points are correct.
  • v1.18.1: Small fix to be able to load project files created in earlier versions.

EPSS Editor v1.17

The latest version v1.17 can be downloaded from the Downloads page.

The latest changes are:

  • Automatic detection of new version added. Link will direct you to the latest release page where you have to download and install EPSS Editor.
  • Adding of Program Change sounds for G2 patches now work.
  • Auto increase the Program Change number when adding a Program Change definition.
  • Retains the loop mode of sounds exported to WAV files when imported from SPI.
  • The G2 checkbox is disabled and is now auto detected. If any Program Change are defined, it will enabled and otherwise always disabled.
  • When importing SFZ, the Mapping mode switch is used. This then makes it possible to import SFZ as Program Change definitions.
  • Automatically increase Program Change or MIDI Channel after importing SFZ sound. Makes it possible to import multiple SFZ files at once and get them correctly mapped.
  • Midi player reworked so it is more accurate in timing when playing EPSS Songs.
  • Bar and beat counter now shows current song position when playing MID file.
  • Transport control implemented for MID player. Possible to start, stop, rewind and fast forward. Supports keyboard shortcuts (Space for start/stop, Numeric 0 for stop, Numeric Enter for start, Numeric + for fast forward, Numeric - for rewind).

Bug fixes:

  • Playing sounds mapped as Program Change now works. Caused crash as it was not implemented to be supported.
  • Checking correct note for overlap when adding a sound on Channel 10.
  • Can now build correct G2 SPI files.
  • When importing SPI G0G1, the Program Change are now indicated as '-' as there are only MIDI splits present in the file.
  • When importing SFZ from menu bar, the Sound and SPI Sounds are now updated correctly.
  • The imported SFZ file are saved in the defaults both for file menu load and drag&drop.
  • Save SFZ now saves non looped sounds with correct parameter (i.e. not single_shot which caused sounds to ignore MIDI Note Off).
  • Save SFZ now adds default ADSR values to correspond to how they are played in EPSS.
  • Sample names with spaces works to import for SFZ.
  • When playing sound on left pane with space bar, sounds are now played One Shot to avoid infinite looping of the sound.

Known bugs in v1.17:

  • Load sample does not work when initial directory is uninitialized. Will be fixed in next version. Workaround: Drag & Drop samples on left side.
  • Save SPI Sample does not work when initial directory is uninitialized. Will be fixed in next version. Workaround: Save as SPI and then import SPI and use the imported samples. They will be in the same quality (degraded to 8-bit 25kHz) as when using Save SPI Sample.
  • Total size is not updated with sample size information. Will be fixed in next version.

Playing EPSS songs without (!) EPSS

As I now implemented possibility to read SPI files as well as export SFZ files in EPSS Editor (see this post), the step did not feel too long to try to play the EPSS sounds with another sound engine. Especially since the new experimental MID player in v1.16 was so out of timing.

But how?

First obvious choice was to try Sforzando, as it is very good at understanding the SFZ file format. In my first tries I exported the instruments for all MIDI Channels in the Dynamite SPI (included in the EPSS for Atari releases) to one SFZ and then tried loading the MID file and play. Not that great of a success as everything played on top of each other, wrong sounds etc.

After some trial and error I found out that the only way I could get this working was:

  1. Export every MIDI Channel sound definition in the SPI as a separate SFZ file. One SFZ file can only define one instrument so there are really no way we could represent our SPI. An SPI file for EPSS could probably best be technically described as: EPSS is a polyphonic multitimbral instrument with multiple samples mapped on notes in multiple MIDI channels. So there were no way this was possible with just one SFZ file.
  2. Somehow combine the SFZ instruments into one polyphonic instrument (or multiple instruments, one per SFZ instrument).
  3. Ensure that the MID file is playing our MIDI channels on the right instrument.

EPSS Editor v1.16 now supports step 1 automatically so it is now just a matter of loading the DYNAMITE.SPI and then export it as a SFZ and we will then get each instrument created automatically as Channel 0.sfz, Channel 1.sfz etc.

Step 2 was solved by finding a SoundFont tool called Polyphone. This tool could load each of my exported SFZ files and then I could copy/paste between them to create one SoundFont containing the instruments as separate Presets, each corresponding to one unique Program Change number. Polyphone then exported it as a SF2 file, which can contain multiple present and multiple instruments.

Of course our MID files never knew anything about Program Change, as it worked on fixed mapped samples to each channel, so I had to fix that. I found MidiEditor (www.midieditor.org) which had exactly what I needed. I loaded our MID file and inserted one Program Change message on each MIDI Channel pointing to the Preset number created in Polyphone, i.e. MIDI Channel 0->Program Change 0, MIDI Channel 1->Program Change 1. The main Dynamite song only used three MIDI channels, so it was easy. Then saved the MID file as a new file.

After that I managed to load the SF2 and the MID into an web based SF2-player (SoundFont MIDI Player (thetimetube.herokuapp.com) and it worked and sounded closer to original, pitches were correct, sounds played in the right order etc. By some reason Polyphone added a Envelope release of 100.1s (see note below) which caused the sounds to overlap, but after manually changing all Release Envelopes to 0.001s, all sounded really good and quite close to the original actually!

Dynamite is a a bit of a technical demo so our GemTwo used our own developed effects, the VVFE, Velocity Variant Filter Emulation. It takes the velocity of the MIDI Note On message, inverts it and multiplies it with 32 (or other values in later versions of EPSS) and uses that as a start offset when playing the sample. So velocity 127 is 0 offset, velocity 64 is 32 * 64 offset etc. Doing that, it could simulate a phase shift of the sound or volume change of a faded off sound, which caused a nice sounding effect without actually having to do any processing of the samples.

EPSS's VVFE can probably be mimicked as well in SFZ/SF2 by creating velocity dependent ranges, each of them having different start offsets in the sample. Might generate too much data depending on how fine resolution is needed. Or maybe there are other techniques in SF2 that can be used? I don't know too much about SF2's advanced abilities yet...

When playing in a standard SF2 player however, the volumes are interpreted as volumes so that works as well but sounds slightly different from the original.

But all in all, Mission Accomplished with room for improvement!

Let me know if you want to try it out yourself to hear, and I can add the files I was testing with to the Download area.

NOTE: Found the cause of this: the loop_mode property was incorrectly set to "One Shot" when exporting the SFZ from EPSS Editor. This causes the sound to always play in full length and ignoring MIDI Note Off. In next version this will be adjusted to "No Loop" which corrects the issue.

EPSS Editor v1.16

The development of EPSS Editor has now been resumed and some major changes has been implemented and released in a new version.

The latest version v1.16 can be downloaded from the Downloads page.

The main changes are:

  • Import of SPI added. This supports both old generation (G0) and new generation (G1). G2 will not be supported as they can only be created from within EPSS Editor so there should always be a EPF (EPSS Project File) as a base for them. The main difference between G0 and G1 is that G1 contains more meta data about the samples so for example sample names can be extracted correctly. Loading a G0 SPI will name the samples Sample0, Sample1 etc. All details should be preserved if the Project is re-exported to SPI. See the EPSSTECH.TXT documentation for deeper information of the exposed details.
  • Import of SFZ added via menu (previously only possible via drag&drop). Also better compatibility with the SFZ file format where keywords and opcodes are placed on same line and also where lokey and hikey information is missing.
  • Export of SFZ added:
    • Exports every used MIDI channel as one unique file. The only realistic way to convert an SPI to SFZ is to see every MIDI Channel in EPSS as a separate instrument. One SFZ file can always only represent one instrument, i.e. one of the SPI:s MIDI Channels.
    • Exports information about loops
    • Note that it uses a standard Windows Save Dialog to select the location. The file name chosen/entered (minus any extension) will be used as a folder name when exporting the SFZ files.
    • The structure is as follows:
      • Folder: Name of the SFZ entered in Windows Save Dialog.
        • Folder: samples
          • File: sample0.wav
          • File: sample1.wav
          • ... If Generation 1 of SPI files is loaded, the samples maintain their original names
        • File: Channel 0.sfz
        • File: Channel 1.sfz
        • ...
  • Playback system rework:
    • Now using a "Sound Engine" approach where the sound system is started when EPSS Editor is started and not stopped until EPSS Editor is shut down and any sounds to be played are mixed in and mixed out. This avoids any clicking in beginning and end of playing sounds.
    • Possibility to play multiple selected sounds both for Sounds (left hand side).
    • Import of WAV files with loop point, when loop point is defined in an "smpl" chunk. Loop can be tested by holding down mouse button to play the sound looped. Due to the resampling of frequency, there might be clicks at beginning of loop for an SPI Sound but this is due to technical limitations when converting the sample from WAV to SPI Sound.
  • Basic MID Player implemented. Can now (sort of) play EPSS songs directly in EPSS Editor.
    • Loading a MID file starts to play it immediately.
    • Stop button stops playing.
    • VVFE on the SPI Sounds are used when playing the sounds.
  • MIDI Keyboard added by pressing the "Listen" button or double clicking on an SPI Sound.
    • Mouse click on the keys plays as long as the mouse is held down. Possible to hear looped sounds this way.
    • MIDI Volume is possible to change by the slider before playing the sound. Could be used to preview VVFE effects.
    • When playing a MID song, the notes played on the selected MIDI channel are shown.
    • When double clicking the SPI Sound, it will show its mapping if the MIDI Keyboard is open.
    • The centre note (original pitch of sound) will show highlighted in blue color.
  • EPSS have its own installer now and is not using the ClickOnce format any more. This will result in a new installation entry, so manually remove any old versions of EPSS Editor before installing the new version as you otherwise end up with two separate versions. Running a new version of the (new) installer it on top of any previously installed versions will update it to latest version. Last version of old installer was 1.0.0.15. First version of new installer is 1.16
  • General UI fixes:
    • Expose more details for a SPI Sound.
    • Saves last position and size of dialog.
    • Icon added.
    • Ctrl-A as shortcut to select all sounds in Input Sounds or SPI Sounds.
    • Delete key deletes selected SPI Sound and reselects the closest.
    • Alt+click of sound in Input Sounds to select where the sounds are used in the SPI Sounds list.
    • MIDI Mapping reworked and more informative.
    • Center note added for custom mapping (ctr). If the center note is empty, the middle note between lo and hi is used.
    • Message shown when SPI and SFZ exported successfully.
    • Error messages for SPI import and export.
    • Rename of Input Sounds can be renamed. Selecting a sample and right click brings up a separate Rename dialog.

Bug Fixes:

  • Export of SPI gone through and fixed up after realizing that exported SPI files could not be loaded with EPSS Editor. Wrong offset was used for the extended main parameter block (see EPSSTECH.TXT from EPSS for Atari distribution for deeper explanation). Also wrong number of sounds were generated if one sound was used in more than one split area.
  • Creating a SPI Sound by selecting MIDI Channel and mapping mode was not really working other than for Multi samples. This has now been checked a bit and adding single sounds works more like it should. Possible to add custom mapping etc.
  • File size of SPI now corrected and updates correct after load operations.
  • If sounds not found when loading a project, user can choose an alternative folder where the sounds are searched for.

As usual with this amount of changes, things that worked before might have stopped working. Please submit error reports on Issues ยท copsonit/EPSSEditor (github.com) and they will be followed up and fixed.

Known issues in v1.16

  • Looped sounds are note preserved when importing SPI and exporting to WAV. This will be fixed in next version.
  • Not detecting overlap correct when adding sounds on MIDI Channel 10.
  • All non looped sounds are exported to SFZ with loop_mode : one_shot. This causes Note Off to be ignored. It will be corrected to loop_mode : no_loop in next version.
  • Import of SFZ with menu does not update the Sound and SPI Sound lists. Will be fixed in next version. Use drag&drop until fixed.
  • Do not try to use to map sounds as Program Change (i.e. create G2 SPI) as playing of sounds are not working and may crash the program. Full support for G2 SPI will come in next version.
  • Samples containing space does not import correctly when importing SFZ. Incorrectly report that only Wav is supported. Workaround until next version is to remove any spaces.
  • MID Player:
    • Timing between midi event not working as we are playing with Windows real time timers. This will be improved in next version.
    • Always playing the sounds in mono. This might cause it sound different from "original" stereo-separated songs as the sounds will be added on top of each other.
    • No Tempo support. Hard coded to 120bpm.

EPSS on two floppys

A new .zip file has been added with EPSS v1.08 split up into two .ST files made for 720kB DD floppys especially aimed to our Atari friends who don't own a HD floppy for their Atari.

The first disk contains EPSS v1.08 as .ACC file and just booting with this floppy will load EPSS and the 8 channel module. The user is then prompted to change floppy to B: and after doing that, the default patch and midi song is loaded and starts automatically to play.

This should then require minimal effort to see EPSS in action on all Ataris. Of course if you have a hard disk, I recommend to follow the instructions in the README.TXT to store the files on C: for easier and faster access.

Download the file here.

EPSS Edit 1.0.0.15

I uploaded a new compiled version of EPSS Edit after Roland Zipfel kindly pointed out that the previous version needed an "EPSS Project" file to start with. I have probably done all my tests with already existing project files so this issue must have been missed.

But it is now tested on a clean install without any preferences or previous files started:

Initial startup without anything previously saved shows:

image.png

Pressing "No" will show the file selector where you have to type in what you project file should be called. EPSS need at least one project file to work with all the time, which is why you have to create it as early as possible:

image.png

After this you can start adding your samples.

Note that I now support sfz files (probably written about this before in some of the posts) so it is very quick importing existing sounds and mappings as long as you have sfz file. This needs more testing so if you encounter issues, please let me know and if possible send me sfz files that you have issues with and I will continue to improve the support for this format.

Hatari for Windows with MIDI v1.0 released

I have now put up the specialized version of Hatari that send and receives MIDI through my "Hatari Midi Mapper" as well as an installation package for "Hatari Midi Mapper".

The complete installation can be downloaded from the Downloads page.

Known issues:

  1. Hatari Midi Mapper has to be started first and then Hatari. Otherwise Hatari might not be able to find the named pipe that the mapper opens.
  2. Not possible to change MIDI device when the mapper is running and receiving data. Solution is a restart of the mapper and Hatari, i.e. stop the mapper (possibly also exit the mapper), exit Hatari, start the mapper and change to correct devices and then start Hatari.
  3. It needs some kind of MIDI input in Hatari Midi Mapper. If you dont have any devices, you can for example download and install LoopBe which is a free MIDI Virtual Device driver.

I might release some kind of bug fixes to these, but currently I think they are minor issues that has easy workarounds and once the mapper and Hatari has been started successfully, the setup works stable enough as far as I know.

MT-32

Got some feedback from the quick proof of concept video I put on YouTube: "Does it work with MUNT MT-32"?

Never heard of MUNT before but downloaded it, found the ROMs, set the output in my Hatari MIDI Mapper as "MT-32 Synth Emulator", started Hatari and Cubase and loaded up The Secret of Monkey Island.mid, which is specially made for MT-32, and it played great!

MIDI for Hatari

I have recently struggled with efficient debugging of the MIDI routines in EPSS when using virtual Atari development (Hatari).

MIDI works in Hatari running on Linux (via ELSA) and Mac (via PortMIDI, dont know how good though) but it has never worked for Windows, which is the platform I use.

I decided to do something about that and after some tests I decide the quickest way would be to develop a "mapper" that could send and receive MIDI data from Hatari and pass it on to Windows MIDI.

I made the mapper in C# under Visual Studio Community and found a great MIDI library to work with: A MIDI File Slicer and MIDI Library in C# - CodeProject. Super credits for this goes to "honey the codewitch" for her excellent work with this!

I manged quite easily to get a file based communication for sending in MIDI to Hatari. Instead of the normal behaviour in Hatari, keeping the file set as MIDI in file open all the time, I instead change this to

  1. Hatari checks if the file exists
  2. If it exists, open it and read in the contents.
  3. After all is read, remove the file.

In the MIDI mapper I can then check if the file exist, in that case wait (as Atari then is reading the file) or else, create the file and fill it with the MIDI message received from the device set as MIDI in device.

This concept seems to work fine so that really solved my problem with EPSS debugging, as I then can generate true MIDI from my MIDI controller and see how EPSS reacts in real time in Hatari.

I wanted of course also solve MIDI out from Hatari in a similar way. This was a bit trickier though as I did not want to keep polling a file in Windows. I tried to use the FileWatcher but this never was accurate enough.

So I started to look at Named Pipes which seemed to be a much better concept. As this is pure Windows behaviour I was unsure how good this would be supported in Hatari when compiling it, but it showed that it was no problem including windows.h and then access the Windows specific functionality, like CreateFile with pipe flags, file handles and so on.

I thought the best would be to act as a pipe server on the C# side and let Hatari act as the client connecting to the server when it needs to pipe data. It was quite a big mess on the c# side before I managed to get a stable implementation of the Named Pipes and lots of trial and errors and googling different approaches.

After managing to get the MIDI bytes from Atari was the next issue, MIDI on PC always works with complete MIDI messages and I have not found any way of just sending the MIDI bytes byte by byte RAW to the MIDI interface. So I now collect the bytes more intelligent in the MIDI Mapper and when I see that I have a valid MIDI message I can forward it to the MIDI device and that works fine.

I recorded a clip on how it currently works and uploaded it to YouTube with some explanatory text here: (501) Hatari for Windows and MIDI - YouTube

If anybody are interested in testing this out, I can make the repos available and do a fork of the Hatari sources and put my changes there.