BaWaMI (revision 132)

Posted on 2017-04-23 at 23:02 in Music, Programs by Robbi-985.

This biggest update ever to my MIDI software synth contains dozens of bug- and crash-fixes, improvements to live MIDI input, and a big new feature for instruments called “multi-osc” (explained below), which many instruments now take advantage of! It’s stable when clicking “Apply” to restarting the sound system, which often caused crashes in the past, and there are a couple of new features to do with overriding controls. Also, one particular system file (included since a long time ago) is now correctly checked / set up when Bawami starts, which may fix Bawami not being able to start for some people. All these improvements mean that Bawami has grown to version 0.7!

The new “multi-osc” feature for instrument files allows one note to trigger more than one sound channel, massively improving the sound of some instruments. This opens the door to having a proper Fifths instrument, octave basses, octave-stacked strings, detuned Honkey Tonk, better organs and more! Of course, I updated lots of instruments to take advantage of this, and added new GS instruments whose sounds simply weren’t possible to generate before. Multi-osc is enabled by default, but can be disabled if you want to keep CPU usage as low as possible (if you really hate the new sound, you can replace all instrument files with those from the previous version, or have fun editing them yourself!).

You can grab this shiny new version from here (7.79 MB), and view the full post to see exactly what’s changed, below:

Instruments

  • Added “multi-osc” feature to instrument files which allows one MIDI note to trigger up to 3 sound channels (all playing different pitches) instead of just 1. Using “Multiple volume bars”, each red bar now means 1 sound channel rather than 1 note. “MIDI messages” view only shows info about the main sound channel, not extra ones. Can be disabled on the “Sound system” tab to save CPU time. Doesn’t affect PC speaker.
  • Updated the following instruments to take advantage of the new “multi-osc” feature:
    • Honkey Tonk (003)
    • Dulcimer (015)
    • Drawbar Organ (016)
    • Percussive Organ (017)
    • Rock Organ (018)
    • Church Organ (019)
    • Timpani (047)
    • String Ensembles (048, 049)
    • Choir Aahs (052)
    • Fifths Lead (086)
    • Polysynth (090)
    • Goblins Effect (101)
    • [GS] Rock Rhythm Guitar (030_024_002)
    • [GS] Mg Octave Basses (039_005_003, 039_006_003)
    • [GS] Stack Strings (050_002_003)
    • [GS] JUNO Rave (087_003_003)
  • Added the following instruments ( * = uses the new “multi-osc” feature):
    • [GS] Detuned Electric Piano 2 (005_008_001) *
    • [GS] Coupled Harpsichords (006_008_001) *
    • [GS] Church Organ 2 (019_008_003) *
    • [GS] 12-string Guitar (025_008_001) *
    • [GS] Power Guitar (030_016_002) *
    • [GS] Power Guitar 2 (030_017_002) *
    • [GS] Rock Rhythm Guitar 2 (030_025_002)
    • [GS] Power Stack (090_008_003) *
  • Instruments modified only in other ways:
    • Reduced resonance of Funk Pop Guitar (028_008_001).
    • Increased volume of Bright Acoustic (001) and made it slightly velocity-sensitive.
  • Quietened open hihats a little.
  • Instrument changes where bank LSB is 004 (Roland SC-8850) are now treated the same way as ones for LSBs 001~003 regarding choosing an alternative instrument file if none exists. So, instrument changes in MIDIs explicitly made for the SC-8850 will now use the correct variation instrument (if it exists). See “BANK SELECTS” in info.txt for details.

Other new features

  • Added the ability to enable/disable all possible overrides from the main right-click menu.
  • Can now generate (copy to the clipboard) command line parameters for all manually overridden controls (right-click in empty space -> All overrides -> Copy parameters to clipboard). There’s also a menu option to do the opposite (load parameters from the clipboard).

Crash fixes

  • “SSubTmr6.dll”, which has been included with Bawami for a long time, is now copied to a system folder and has its info added to the registry if not already done. I thought this wasn’t necessary, but it fixed an “ActiveX component can’t create object” error that someone suddenly started receiving.
  • Fixed another incantation of the bug where Bawami would crash when re-initialising the sound system (when clicking “Apply” on the “Sound system” tab).
  • Attempting to skip past a CC #119 (global loop end) message no longer causes Bawami to freeze (it didn’t in the past – I’m not sure when this broke). However, it will skip to a location within the loop that’s hard to predict (related to the number of messages after the end of the loop to which the skip was requested, and the number of messages inside the loop).
  • SysEx messages to display an invalidly-long amount of text on a Sound Canvas LCD (the SC supports a maximum of 32 characters) now cause Bawami to display only the first 32 characters. Previously, Bawami would crash if the message implied that the text should be longer than about 247 characters.
  • Removed Ctrl-Alt-F11 shortcut (for typing stats) because it apparently broke a long time ago, often just causing Bawami to crash when triggered.

Live MIDI input improvements

  • Improved timing accuracy!
  • Fixed bug where some SysEx messages (especially ones whose first data bytes were low values such as 00) were completely misread. Such messages aren’t understood, but they now appear correctly on the MIDI Messages view.
  • No longer interprets message value FF (system realtime reset) as a meta message (only possible in files, not live MIDI).
  • No longer crashes when no MIDI is loaded and the following CC messages are received on live MIDI input: 111 / 118 (GLOBAL LOOP START POINT), 116 (SECTION LOOP START POINT).
  • “MIDI IN” text doesn’t disappear from main window when “Rewind” is clicked or when playback reaches the end.
  • “midiio2k.ocx” is no longer included or used. Bawami now does all MIDI input/output itself directly, which is what allows several of the MIDI in/out improvements in this release.

Other sound-related changes

  • Portamento is no longer wrongly-affected by pitch-bends. Portamento and pitch-bend are now applied on top of the original note as 2 completely separate stages, as they should be.
  • Fixed bug where, if portamento was only turned on after a note had already started to play, the next note would slide up/down from the wrong frequency (not the current note’s).
  • Pressing Ctrl+Right to skip forward by 10 seconds no longer causes loud sounds if skipping past percussive notes (it sounds the same as when seeking forward by clicking the playback position bar).
  • Rewrote the code that chooses the sound channel to play a note on. Now, when the sustain pedal is on, a sustained note being retriggered will cause the old sound channel to start releasing and assign a new channel to the new note, avoiding click artifacts caused by immediately re-using the old channel.
  • To avoid stuck notes (otherwise possible if an instrument uses “multi-osc”), playing notes are now released when instrument files are reloaded and when a MIDI channel changes from tone to percussion mode.

MIDI output

  • MIDI output of SysEx messages works again (broken somewhere between revision 123 and 128).
  • When using MIDI output and MIDI thru (live MIDI input to MIDI output), messages played from a file aren’t output twice.
  • “ALL NOTES OFF” is now sent on MIDI output when closing MIDI input device if “Echo live MIDI input” is ticked, to avoid stuck notes.

Other graphical / interface improvements

  • Fixed rare bug during startup where main window would become invisible or appear as a tiny glitched area of 4 corners, which happened if Bawami lost focus between appearing and rounding its window corners.
  • The “Attempt to stabilise” option (when drawing a waveform for each MIDI channel) works a bit better.
  • Fixed bug where text and position of sliders on “Override other controls” could become out-of-sync with each other (e.g. by LMB press, then RMB press+release, then LMB release).
  • When a MIDI channel is muted, the red cross is now drawn across the channel’s entire vertical area, and you can click the entire area to re-enable it.
  • When auto-unmuting MIDI channels on loading a new MIDI file, without automatically starting playback, blue vertical bars are correctly redrawn.
  • Variation instrument names in menus no longer have “- ” displayed where the line should break mid-word on the main window.
  • Instrument names are redrawn when clicking “Reload instruments” in case a language’s “instname” file has been modified (as is done when changing language). Previously, instrument-related language files were being reloaded, but the interface wasn’t automatically redrawn.
  • Added a few missing translations and deleted unused files for Japanese language.

Fixes to the “MIDI Messages” view

  • Unrecognised MIDI messages have any extra bytes displayed as their hex values (as happens with SysEx messages), instead of interpreting them as plain text (useless if they contain non-printable characters or 0-bytes).
  • Useless Data 1 and Data 2 values are no longer shown for sysex/realtime/meta messages.
  • Information about note-offs that were aborted because the sound channel is now used for a different MIDI note now mentions the correct MIDI channel (number shown was 1 too low before).
  • Nessages that are supported but ignored (e.g. due to being disabled in the config) are shown in the usual “supported” colour (e.g. bright turquoise instead of dark blue), and a more-concise “ignored” explanation is appended to the text.

Efficiency improvements

  • Slightly more efficient updating of sound channel’s pitch (one less multiplication per millisecond per sound channel if using modulation/vibrato).
  • No longer wastes time updating modulation cycle for a MIDI channel if CC #1 (Modulation) is 0 and instrument should not be using auto modulation (according to instrument file and auto mod depth).
  • Valculation of the “channels in use” horizontal bar at top of main window, drawing of MIDI channel waveforms and drawing of the main interface overall are all slightly more efficient.
  • Restructured a lot of the code related to sound channels. This reduced the EXE file size by 20 KB and will make adding new instrument features easier for me in the future.
  • Micro-optimisations throughout the code (also reduced EXE file size by 16 KB).

4 Responses to BaWaMI (revision 132)

  1. Nicholas Gower says:

    How did you get the pc speaker to play music. Everything I found claimed that the feature was disabled in Windows 7.

    • Robbi-985 says:

      It’s true that the Beep API built into Windows (which my old Bleeper Music Maker program used) doesn’t let you control the PC speaker properly on modern Windows OSes.

      Bawami uses a “virtual device driver” (inpout32 or inpoutx64: http://www.highrez.co.uk/downloads/inpout32/ ) to write to the ports of the the 8254 chip directly. This is the timer chip that the PC speaker is connected to, responsible for generating the square wave that the speaker plays. Bawami can tell it to change frequency, connect/disconnect the speaker, and also toggle the speaker directly (to generate noise for percussion). You can see more technical details here: https://en.wikipedia.org/wiki/Intel_8254

  2. Michael Moye says:

    and once again, i’m plagued with the ActiveX component can’t create object error once more, is there a possibility something i installed is causing the same error?

    • Robbi-985 says:

      Hi,

      I’m sorry for the late reply again. It’s possible that Windows 10 has lost the registry information about system files that Bawami is using, but Bawami sees that the system files themselves are still in the system folder and so it doesn’t bother to re-copy them and register them. You can try doing the following for each of Bawami’s system files:
      - Locate the file in “windows\System32″ (for 32-bit Windows) or “windows\SysWOW64″ (for 64-bit Windows). Be careful that the extension (.dll, .ocx) is correct, too.
      - Compare its size and “Date modified” to those of the same file in Bawami’s own folder.
      - If they are the same, delete the file in the system folder (better still, move it into some backup folder just in case something breaks).

      The system files to do this with are:
      - msvbvm60.dll (MS Visual Basic 6 Runtime, needed for any program made using VB6 to run)
      - SYSINFO.OCX (MS SysInfo Control, for detecting Windows suspend/resume to pause/resume playback)
      - mscomm32.OCX (MS Comm Control, for controlling motors via Arduino on serial port, not yet possible in public version)
      - msstdfmt.dll (MS Data Formatting Object Library, for formatting time, date and other numbers as text)
      - comdlg32.ocx (MS Common Dialog Control, used when browsing for files)
      - MSCOMCTL.OCX (MS Windows Common Controls, for sliders, drop-down menus, etc)
      - midifl32.ocx (Mabry MIDI File Control, for decoding .MID files)
      - SSubTmr6.dll (vbAccelerator Subclassing and Timer Assistant, for more control over elements on config window)
      - vbalHTmr6.dll (vbAccelerator High Resolution Timer, for 1000 Hz clock used as basis for MIDI playback timing)

      Then, run Bawami. It should see that all of these files are missing, and will re-copy the versions in its own folder into the system folder, but crucially, also re-run regsvr32 for each file, updating the registry so that Windows will know where to look whenever a program wants to use something from one of those system files. We make sure that the size/date are the same before deleting to avoid ending up with an older version (the one that comes with Bawami) in case a newer one was already installed, which might upset any other programs that expect the newer version.

      I really hope this works! Please let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>