Hubi's LoopBack device Version 2.5 March 25, 1997 virtual MIDI driver for Windows3x/95 to connect multiple MIDI-programs. _____________________________________________________________________________ TO PREVENT YOUR SYSTEM FROM VIRUSES THIS FILE IS PLAIN ASCI. no Wizards, no Macros, no ActiveX, no Java. _____________________________________________________________________________ This package may be of use for You, if you * work simultaneous with multiple MIDI programs in Windows (or want to do it). * hate the Message "the MIDI device is currently in use by another ...". * simply want to hear the OPL2-FM chips of your SoundBlaster when you play your Waldorf Wave keyboard (can't get that noiz out). do you? :-) * Use your favorite Synth-Editor together with your favourite MIDI-Sequencer, Combine the best of all MIDI programs. This package is NOT for You, if you * ask now "What is MIDI ?" * laugh with pleasure about Microsofts error messages and their funny translations ( some are at http://www.mydesktop.com ) * won't hear a PC ventilator fan near your Waldorf Wave. * your only MIDI application is a MIDI Jukebox player. Changes sice v2.4 + bugfix for crashes with some MIDI drivers + internal FIFO to prevent hanging notes during SysEx transfers + some optimisations for Fuse, and SysEx. _____________________________________________________________________________ Highlights up to 4 new MIDI In/Outputs Multi client feature allows mixing and duplication of MIDI messages full SysEx support Very low memory requirements (about 5K fixed / 4k discardable Windows memory) No hardware required (except your Windows-PC) Port names can be edited Fuse mechanism to prevent MIDI-short curcuit (dumb safe!) CAN EXTEND YOUR MIDI-DRIVER TO MULTI-CLIENT FASCILITY ! comes with hwmdcabl.exe - the realtime SysEx-thru icon. program source is available IT'S FREEWARE _____________________________________________________________________________ Table of Contents Overview Installation Updating from a Previous Version Making a MIDI port Multi Client able Simple Example Setup How "Hubi's LoopBack works" How "Hubi's MidiCable works" Hints and Warnings : Midi-Thru, Cubase, CTL3D.DLL History Future Enhancements - What YOU can do About the Author __________________________________________________________________________ Overview The package contains two programs: + A MIDI driver, "Hubi's LoopBack Device", which must be installed via control panel. The driver offers virtual MIDI Ports (up to 4), which act as both, Input and Output MIDI device. All MIDI data sent to the output (a typical sequencer program) is sent to all programs at the input side (eg. a MIDI monitor program). The ports are named "LB1" to "LB4" by default and can be renamed + A MIDI-Thru application, "Hubi's MIDI Cable", which connects Midi-Inputs with Midi Outputs. It is useful for quick connections between LoopBack- Ports and Hardware Ports, or to play your Soundcard Synth from external MIDI keyboard. The two programs work independent, you can use only Midi-Loopback, or only Midi-Cable. _____________________________________________________________________________ Installation Unzip to an empty directory pkunzip mdlpbk24 -d c:\tmp (option -d is not required) Copy the files HWMDCABL.EXE and HWMDCB.DLL to another directory. If you use Windows FileManager, use the Drag&Drop feature to install a ProgramManager icon. or use WinZip, "Extract" command. Start Windows, select "Control Panel" from the "Main" group, select Drivers, select Add button, select "unlisted driver", OK, enter your directory (eg. C:\TMP). Now you should see "Hubis Loopback V2.4", and press OK. Now the configuration dialog comes up and you must select the number of ports to use. 2 should be a good starting point, but WARNING: Windows(3.1) cannot handle more than 10 midiports (+Midimapper). Win95 detto! After Restart, the new MIDI In and Outputs will be available then. If you have no CTL3DV2.DLL in your \windows or \windows\system directory (nearly impossible) then you must install one manually. Windows 95: Start->Settings->ControlPanel->Hardware Continue-> [No] ->Continue -> [ Audio/Video/Game Controller ] ->Continue ->Diskette -> [ enter the unzipped directory (c:\tmp) ] ... Then you will see a list with "Hubi's Loopback v250", select this, some ok and resteart Windows when asked about it. ______________________________________________________________________________ MAKING A MIDI PORT MULTI-CLIENT-ABLE (there is a easier to handle alternative at http://netbase.t0.or.at/~seib/midi.htm ) You can use a loopback-port together with HWMDCABL.EXE to make a Hardware MIDI port (eg. SoundBlaster) able to handle with multiple clients. There exist already several MIDI drivers which are able to deal with more than one client. I know of many, but I know of two which CAN NOT handle more than one client: Creative Labs Soundblaster 16 Creative Labs AWE32 (both, Microsoft and Creative Labs drivers) These are the "mainstream" cards. A test if your driver supports multi-client access is simple: - start 2 instances of HWMDCABL.EXE - try to open one port (in or output) simultaneous by both midicable-icons. If this works without an error message box, the port supports multi-client access. If an error message box comes with "the midi port is already in use..", multi client access is not supported. - IN and OUT - ports are independent of each other, so you must check both. To make a standard MIDI port multi client able, you must combine a LoopBack node with MIDI-Cable: [LB1]--->{hwmdcabl.exe}--->[SB16 Midi Out (330)] all MIDI sent to LB1 output is sent to SB MIDI out. The advantage is that LB1 can be opened from multiple programs, and SB-MIDI-out is only opened from MIDI cable. LB1 can be used like SB-MIDI-Out now. If you start MIDI-Cable, and press the right mouse button (left under Win3.1) on it in the taskbar, you will see a menu with 3 parts. - Windows system commands - MIDI Input ports - MIDI Output ports The active In/Outputs are checked, and also displayed as Icon Title, You have to select "LB1" as Input, and "SB16 MIDI Out(330)" as Output. The Startup-Group should contain the MIDI-cable shortcut with the proper command line IN= and OUT= nubers, which can be copied to clipboard with "cmd to clipbrd" menu item. e.g "C:\PROGRA~1\MDLPBK25\HWMDCABL.EXE OUT=7 IN=2" and then pasted to the Icon properties. To make MIDI-Input Multiclient, use [SB16 Midi In (330)]--->{hwmdcabl.exe}--->[LB2] all MIDI received external from SB MIDI In is sent to MIDI-Cable, then to LB2, and delivered to all attached client programs. The advantage is that LB2 can be opened from multiple programs, and SB-MIDI-In is only opened from MIDI cable. LB2 can be used like SB-MIDI-Out now. It is a good idea to rename "LB1" to "v-SB-Out" and "LB2" to "v-SB-In" now. _____________________________________________________________________________ Updating from a previous version The main difference to the previous versions 1.0 and 1.1 is, that midlpbk.dll now can deal with multiple clients. Each port can be opened by up to 4 MIDI-In clients and up to 10 MIDI-Out clients. This feature makes the old matrix configuration now unnecessary, and allows a more powerful and flexible configuration that is also easier to maintain. Removed features are: - IN- and OUT ports now have the same name - Matrix-setup removed - No more a Control Panel Applet This means you have to remove your ProgMan-Icons for "control midlpbk.dll", remove from control.ini, Section [MMCPL] the line Hubis LoopBack=c:\windows\system\midlpbk.dll Please remove the old driver before installing the new one. This saves some space in system.ini. The new features are + Multi Client + Port Name Dialog The setup dialog is now only available from SytemControl->Drivers->Configure. Between the versions 2.0 to 2.3 is no functional difference, only peripheral smoothing. Version 2.4 adds a fusing mechanism. Version 2.5: NEW: MIDLPBK.DLL is now named MIDLPBK.DRV Please deinstall via ControlPanel/Multimedia/Extended before installing the new driver. ______________________________________________________________________________ How "Hubi's LoopBack" works: There is a MIDI output port and a MIDI input port. All data sent to the output will be available at the input port, that is the MIDI output from one program is the input of another program. Prog1 >--[ LB1 ]--> Prog2 You should think about a MIDI node, which can be opened as output from several programs and input of others. Each of this programs is named "a client". The output of all OUT-clients is merged and sent to all IN-clients. Multi-Client means, that each node can have up to 4 IN-clients and 10 OUT-clients (hard coded). Hubi's LoopBack can serve up to 4 nodes, but changing the number of active ports (=nodes) requires to restart Windows. Fuse Mechanism: The main drawback of pre-2.4 versions was the possible system-hangup on MIDI short-curcuit. Attaching the same Node as Input and Output of a MIDI application can cause circling MIDI messages (w/ MIDI thru). The first invention was: + Do not send the same message twice. But to let MIDICLOCK work, a time limit was added, and to allow the generation of Flanger Effects (all notes played twice - i.e. with two "Hubi's MIDI cable" in parallel), a more general formula was used: ++ Do not send a Message more than N times within M milliseconds. N and M are adjustable in the Configuration Dialog as Duplicates: max N (default 1) in ms M (default 2) To enable "Flanger effects", N must be setted to 2. MIDICLOCK (F8 hex) appears 24 times per quarter note, that is every 10.4 ms at 240bpm. Setting M to 10 could eat up some MIDICLOCKs then. But another "Crash" situation still exist: the Cubase "Reset Devices" command. It sends Controller Reset Commands on all 16 channels (6 x 16 = 96 messages), and the "thru" feature would cause a system hangup. This was solved with following formula: ++ Do not send more than X messages per time period T. X and T are adjustable in the Configuration Dialog as Fuse: max X (default 128) in ms T (default 100) The default values seems lower than the MIDI rate of about 1500 per second (2 byte messages, i.e. Controller with running status at full use of 31250 baud), but only SysEx transmission uses such a high data rate, and SysEx-Input in Windows is usually handled with blocks of several hundred bytes. _____________________________________________________________________________ Simple (?) Example Setup: The symbol >>>> means a running HWMDCABL.EXE instance. [SB MIDI In]--->>>>---[LB1]---{Cubase}---[LB2]--->>>>--[SB MIDI out] / / \\_{SynthEditor}_// \ MidiJoy_/ / \{CakeWalk}____/ \{MidiMonitor} virtual Keyboard_/ \{MidiMonitor} Note what's possible with only 2 nodes activated, and now imagine how complicated your setup could be with all 4 nodes activated... But if Creative Labs makes their SB16 MIDI Driver with multi client support, most would work without midlpbk.dll - - - - Sometimes it is a better choice to have a "serial" connection: [SB MIDI In]-->{SynthEditor}-->[LB1]---{Sequencer}--->[SB MIDI out] Synth-Setup-Data could so be recorded with Sequencer. - - - - Synchronizing Samplitude with Sequencer: {Samplitude Studio}--------->[LB1]------>{Sequencer} sent MTC to LB1 sync to SMPTE/MTC from LB1 Midi Time Code (MTC) is preferrable over MIDI clock. Audio program should always be the Master (better performance). _____________________________________________________________________________ Compatibility: MMSYSTEM : most Windows programs. Use LB1 (or the nickname) like any other input or output, but do not use the same device as both, input and output. It won't crash, but it also won't work proper. OMS : The Opcode Vision 2.5 demo comes with a prerelease of OMS for Windows. To use MIDI Loopback with it, Uncheck 'Global Off' in the configutation dialog during the OMS-configuration step. Don't forget to turn on after this is done. (ControlPanel/Multimedia/Extended/LB1/configure) Also turn off the unused inputs in Vision. MidiShare: This is a Mac-Ported (?) free Toolkit for Programmers, available at http://www.grame.fr/english/ It is nearly impossible to use it together with other (non-Midishare) programs until a configurable port-mapper will be written. ______________________________________________________________________________ How "Hubi's MIDI cable" works It's a simple MIDI-thru program with following features: - All MIDI processing in realtime (at Interrupt time!)- no Windows/Message delays - Full SysEx support - unlimited SysEx Message size - low resource requirements (I could start it 57 times! -V2.1 in Win3.1 with i/o none) Usage: - Start - Search icon, then select MIDI-in port and MIDI-out port. - .... play your attached MIDI keyboard - Close - the settings are remembered for the next start (in win.ini). Usage for advanced users: The pro's need more than one instance running (I tried once 57!), so I gave the program the option to pass the ports on the command line. e.g. HWMDCABL.EXE IN=1 OUT=1 Create an own program manager icon for each needed MIDI-connection and edit the appropriate command line. The numbers are the same as in the icon menu. If it should start at startup, copy the program manager icons into the Autostart program group (hold down the key while dragging with the mouse). Filter Option: The filter can be setted only from the command line, there is no default setting from ini-settings because of the very confusing behaviour if not all MIDI messages go through by default. The format is hwmdcabl.exe FILT=Channs,ChanMsgs,SysMsgs where Chans,ChanMsgs and SysMsgs are a hexadecimal number each. Chans: 8000 : Channel 16 4000 : Channel 15 2000 .... 0002 : Channel 2 0001 : Channel 1 i.e. to filter out channels 12,11 and 1, use 0800+0400+0001 = 0C01 FILT=C01,..... (leading zeros are optional) ChanMsgs: 0100 : Note Off 0200 : Note Off 0400 : Poly Key Pressure (key aftertouch) 0800 : Control Change 1000 : Program Change 2000 : Channel Pressure (channel Aftertouch) 4000 : Pitch Bend i.e. to filter out channels 12,11 and 1, PitchBend and Polyphone Aftertouch FILT=C01,4400 SysMsgs: 0001 : System exclusive 0002 : Midi Time code (MTC) 0004 : Song Position Pointer 0008 : Song Select 0040 : Tune Request 0080 : ( End of SysEx - will be received as SysEx or MM_MIM_ERROR) realtime messages: 0100 : Midi Clock 0400 : Start 0800 : Continue 1000 : Stop 4000 : Active Sense 8000 : System Reset When you hold down the key while clicking the checkbox, you can send the clicked system message to the MIDI output (have you ever tried what reset does ?). i.e. to filter out channels 12,11 and 1, PitchBend and Polyphone Aftertouch, Midi Clock, Active Sense and MTC FILT=C01,4400,4102 All filtered is: FILT=FFFF,7F00,DDCF Note: use the "Cmd to Clipbrd" menu item to copy the current settings to clipboard (and insert it to the command line of the icon) Transformation options: (experimental state) TRx=mask,trigger,value,func with x=1..4, mask, trigger, value and func are Hex numbers The hex bytes represent the MIDI bytes. Example: Transform Midi Controller #5 to Start/Stop messages mask=FFFF80 - only MSB of Data 2 trigger=B00540 value=FA (Start) mask=FFFF80 - only MSB of Data 2 trigger=B00500 value=FC (Stop) ... TR1=FFFF80,B00540,FA,01 TR2=FFFF80,B00500,FC,01 see transform.txt for more examples _____________________________________________________________________________ Integrating MIDIMAPPER in setup (Win3.1) Example: a Yamaha PSS790 + Cakewalk Homestudio - PSS790 sends all MIDI IN unchanged to MIDI OUT (merged with Keys) - Cakewalk Homestudio has no Input Channel Filter. - If you want to sequence a song using the PSS790 Synth during record, you'll get all MIDI data back at the MIDI-In and will record all 16 MIDI channels (echoed from PSS790 out) at the current track. [PSS790]-[MPU]-->>>--[MidiMapper]--[LB1]--[Sequencer]--[MPU]--[PSS790] * enable one virtual Node LB1 * Setup MidiMapper: Only channel 1 is enabled and sent to LB1, rest off. * MidiCable with IN=MPU and OUT=MidiMapper * Only LB1 as Input in Sequencer Now the Sequencer receives only channel 1 ! And you can record track by track now. _____________________________________________________________________________ HINTS & WARNINGS: MIDI THRU Midi short curcuit is no problem now - FUSE MECHANISM. CTL3D.DLL midlpbk.dll uses ctl3dv2.dll for their dialogs if installed. If this file is missing, dialogs are black/white. If Win3.1 shows an error ignore this. _____________________________________________________________________________ History: V 0.x Jan 94 : 1st working version, but nearly unused due to Cubase problems. V 1.0 Feb 95 : first upload (Steinberg released set_mme-utility) V 1.1 Code segment made fixed. MidiOutShortMsg can be reentered 4 times now (should be enough) Device Names can be edited in system.ini V 2.0 Jun 95 : Multi-Client version. Remove all beautiful features (no more necessary). Source splitted in fixed- and discardable code. Packaged with HWMDCABL.EXE V 2.1 Aug 95 : Fix for SB16 with TB-Rio, IN- and OUT- names can be different (required for TB-WavePatch - see wfpatch.wri ) V 2.2 Oct 95 : dynamic load of Ctl3dV2.dll, only if installed. priv. V 2.2a Nov 95 : Filter dialog with Midi Cable priv. V 2.2b Jan 96 : Workaround for AWE32 driver bug on close, V 2.3 Apr 96 : Fixed a Win95 bug with 32bit Window-Callback V 2.4 Aug/Sep 96 : Fuse mechanism, Reviewed transform and filter V 2.5 Mar 97: internal FIFO, reviewed Fuse, Global ON ------------------------------------------------------------------------------ Future enhancements: Configurable realtime transformations. A finished program exist, but due to OO-technology it's 450 kB + some DLLs. This will be an own package. WHAT OTHER PROGRAMMERS CAN DO : I think it should now be easy for musical programmers to enhance their system with small MIDI utilities, like random note generators, midi message translation applications, problem specific input dialogs. Or Physical modeling software Synthesizers, virtual 303s, spectral synthesis, ... ...I wish Intel Processors have the Power-Mac CPU-performance. ------------- Note: In the documentation of version 1.1, I said that the MMSYSTEM design of Microsoft would not allow full featured multi-client drivers. I was wrong! It was indeed very simple to implement it. As a hobby programmer, I can't afford MSDN Level 1 or 2, so I'm always behind in getting information. Fortunately I got a MS Multemedia Jumpstart CDROM in a 10 pack, which contained information for writing MIDI drivers. But I don't know why Microsoft has not impelemented this very useful feature in their own drivers and their DDK SoundBlaster example. BTW, I've bought a Microsoft Home Mouse. It contains some funny programs for modifying the Windows-cursor. After installation of the 2 floppies, one of the directories contains 457 cursor files with 326 bytes length each. But if you install this onto a harddisk partition with more than 1 GB, 15 MB of your C: drive is occupied (a 32 kB cluster per file). What I want to say is, only Microsoft is able to copy 15 MB uncompressed to a floppy. ______________________________________________________________________________ Undocemented features: WIN.INI: [Hubi's MIDI cable] ; size of one (of three) SysEx buffer SysExSize=1024 ; should we use CTL3DV2.DLL ? Use3D=1 SYSTEM.INI: [midlpbk.drv] LB1=name for LB1 ports LB1IN=name for LB1 input port (default to LB1= entry) LB2=..... ; Entries for software which is fixed to a special ; manufacturer or product Id (currently unnecessary) MfIdIN=0 PrIdIN=0 MfIdOUT=0 PrIdOUT=0 Use3D=1 DupeTime=2 MaxDupe=2 FusePeriod=100 FuseLimit=128 The last 4 match M,N,T and X in the documentation of Fuse Mechanism. ______________________________________________________________________________ The following programs should be available at the same where place you got this file. On the internet, look at ftp://ftp.cs.ruu.nl/pub/MIDI/PROGRAMS/MSWINDOWS or ftp://ftp.winsite.com/win3/sounds or http://www.simtel.net/pub/win3/music MDUTLS10.ZIP : MIDI_MON: "MIDI MONITOR" - show received MIDI messages, (with SysEx!) ( MIDICONN: "MIDI CABLE" - simple MIDI Thru application (with SysEx!) SYX_OUT: an Iconized-Application for sending .SYX dumps to Synthesizers, with File Manager Drag and Drop Interface. ==> The file hwmdcb.dll in mdutls10.zip is an older version of the one included in mdlpbk20.zip. Please replace the old with the new one to avoid problems. Also MIDICONN.EXE is superseeded by HWMDCABL.EXE. MDJSTK10.ZIP: MIDI-Joystick. Use a PC-Joystick as MIDI controller. X,Y and 2 Buttons configurable. (send email for Joystick2 version) SIMSAM10.ZIP: Hubi's Simple Sampler. Load a .WAV file Into memory, play it as MIDI intrument (w. pitch transpose and volume control) MCICOM99.ZIP: Hubi's MCI Commander, Execute MCI commands by MIDI. (HD-recording, CD-Audio, Video, ...) ______________________________________________________________________________ About the author: Dipl. Ing. Hubert Winkler Neunkirchner Str. 17 A - 2732 Willendorf Austria Email: winkler@cobra.gud.siemens.co.at (office) or Hubert.Winkler@siemens.at My Equipment: Hardware: 486DX/2-66/256k/16MB, 540MB, SB-clone (CS4232 chip), 5X-CDROM Pentium 133 / 256kPB / 32MB , 2.5+2.5+1GB EIDE HD, ET6000 VGA (2MB), 17"64kHz, Toshiba 5602 CDROM (8x, digital output and read Audio CD) AWE32 w/ 8MB, Korg 05R/W at COM2, (sounds great) Yamaha PSR300 keyboard (old...). Software: Cubase Score 3.01 Samplitude Studio 2.5 (Many thanks to SEK'D) Band In A Box XEdit 3.12 (Shareware Editor for Korg Synthesizers) AWave 4.0 (Shareware Sample Converter) AWEVbank 1020 (Shareware AWE bank manager) and many other fine utilities like AWEToy, v909, seq303, ....