Active Sense Message

Pagine

Posts: 4
Joined: 28 Dic 2018 - 12:58
Active Sense Message

Hello, I tried your VirtualMidiSynth, and I think is great.
However I note that it does not handle the ActiveSense ($FE) MIDI message (if I cease to send it from my MIDI device to VMS, I expect it stops playing notes).

Specifically, I built an Arduino Midifile player (which sends MIDI data only - and Active Sense Message too). This can be connected to one of my Roland expanders or, with a MIDI interface, to VirtualMidiSynth.
All works fine, but if someone detach MIDI cable (Five-pin male 180° DIN connector side), all Roland expanders stop sound, while VMS continue playing notes.

What about implement it? Do you think to implement it in a future release?
Thank you for your job.

Posts: 1492
Joined: 25 Mar 2012 - 01:19
Re: Active Sense Message

This seems an interesting feature to implement, but I wonder if it should be VMS in charge of handling it instead of the (I suppose) hardware MIDI/USB interface and its driver.

I mean, if your MIDI client (Arduino, MIDI Keyboard, ...) is connected to PC through a MIDI/USB interface and you detach the interface from the PC by unplugging its USB connector, then the interface driver should detect USB disconnection and send a MIDI reset to the connected device (VMS). On the other side, if you unplug the MIDI connector (5 poles DIN), then it should be the interface firmware (or again the interface driver) to detect the now missing "Active Sense" messages and silence MIDI output.

That said, VMS already has a "watchdog" to protect the IPC channel between the driver component (the DLL loaded by MIDI client process) and the synth component (VirtualMIDISynth.exe process). It's used to avoid crashed or malfunctioning MIDI clients to play forever. It should be easy for me to extend the existing watchdog by managing the "Active Sense" messages.

Now my questions:

  • what's the manifacturer and product name of your MIDI/USB interface?
  • have you checked if its drivers are the latest available and if they don't already have some kind of "internal" management of Active Sense messages?
  • could you please explain how is your MIDI chain composed?
    I mean: Arduino board --> MIDI/USB interface --> (LoopBe1, MidiOX, ???) --> VMS2
  • actual VMS watchdog sends a "watchdog" message on the IPC channel only if there was no other MIDI message in the last x milliseconds; does the Active Sense also work this way or is it always sent regardless other MIDI messages?
  • do you know which is the Active Sense sent rate, in milliseconds?
  • how is VMS supposed to detect if the connected MIDI client supports Active Sense messages?
    I mean: is there some kind of "Active Sense ON" message? Or is it the first received one that should turn the feature on, making VMS expect to receive an Active Sense messages each x milliseconds?

Finally, I see a big issue in implementing this feature: I don't have any external MIDI hardware, so no way for me to test it on my side :(
I could only test it through you (and other welcomed testers) and you could only report OK/KO without any further details.
Then build another beta version, publish, test, fix, rebuild, republish, retest and so on...
It could be a really long task :D

PS: take your time to answer my questions; I'll go out of office for a few days so I won't be able to reply soon ;)

Posts: 1492
Joined: 25 Mar 2012 - 01:19
Re: Active Sense Message

I've found some interesting documentation about Active Sense MIDI messge (0xFE), so I'll post them here for future reference.

https://www.midi.org/specifications-old/item/table-1-summary-of-midi-mes...
http://midi.teragonaudio.com/tech/midispec/sense.htm
https://www.recordingblogs.com/wiki/midi-active-sense-message
http://forum.arduino.cc/index.php?topic=40882.0

They confirm my initial thoughts about its implementation (and it's much more like I've implemented the existing VMS watchdog):

  • the first received Active Sense message tells the receiver that sender supports them, so it expects to receive more messages at 300ms rate
  • at first missed Active Sense message, receiver clears its "Active Sense mode", doesn't expect 0xFE messages anymore, mutes its synths and resets controllers
  • Active Sense messages are sent only if no other MIDI message has been sent within the last 300ms slot

To avoid aliasing, will set the Active Sense wait time >= 350ms on Windows, to avoid "false positives".

Posts: 4
Joined: 28 Dic 2018 - 12:58
Re: Active Sense Message

Here is my answers:
1) My MIDI/USB interface is a Yamaha UX-16. https://it.yamaha.com/it/products/musical_instruments/keyboards/accessor...
2) Driver are the latest available (you can find it in the Download section)
3) My MIDI chain is: MIDI Device -> Yamaha UX-16 (MIDI interface) -> MidiOX (MIDI routing) -> VMS (MIDI synth)
4) I don't have the original MIDI spec, but you can find further detail here: http://midi.teragonaudio.com/tech/midispec/sense.htm
Here, the author says that 'An Active Sense only gets sent if there is a 300 mSec "moment of silence" on the MIDI buss.'
5) In my Arduino implementation, to keep it simple, I send an "Active Sense" at every 300ms (I use a Timer), regardless the activity on the MIDI bus.
6) There is no "Active Sense-ON" message. If the synth receives a first "Active Sense", it assumes "Active Sense-ON" mode. And every time watchdog triggers (and stop all sound), you can restart with-or-without Active Sense (i.e., you can restart with "Active Sense-Off" mode).

For the test program, if you're in trouble, perhaps i can write some line of codes for you. Let me some days... and I will let you know.

Posts: 1492
Joined: 25 Mar 2012 - 01:19
Re: Active Sense Message

Posted first beta of version 2.6.0:
https://coolsoft.altervista.org/it/forum/thread/759

Please test it and post your feedback in this thread.

Posts: 4
Joined: 28 Dic 2018 - 12:58
Re: Active Sense Message

Good evening, i try your beta.

Like before, if I disconnect the cable (interrupting both MIDInotes and MIDIActiveSense) nothing happens (sound doesn't stop).

It also seems to me... that sometimes MIDI-OX crashes (using VMS as Synth, but not with Microsoft GS Synth). I repeat, it seems to me, i'm not sure.

If you want to have more information, in next beta what about write a simple log file (for debugging purpose only)? And remove it in next stable version?

Thank you

Posts: 1492
Joined: 25 Mar 2012 - 01:19
Re: Active Sense Message

One of my first doubts (see my first post in this thread) was if the 0xFE message should have been detected and managed by the USB/MIDI hardware converter (and not sent at all to the Windows world) or its driver.

I've tested the feature using a simple test program, based on the "C" one you've sent to me.
I've turned a note ON, then started sending ActiveSense messages then stopped them: the synth is stopped almost immediately.
Could you check it on your side?

Now I wonder if someone is filtering it on your MIDI chain, being it the converter firmware, the converter driver or MIDIOX.
As far as I can see MIDIOX can show Active Sense messages on its input (http://www.midiox.com/cgi-bin/yabb/YaBB.pl?board=query;action=display;nu...), but does it forward them to output?
Can you remove it from the chain and replace it with LoopBe1 or such?

Posts: 1492
Joined: 25 Mar 2012 - 01:19
Re: Active Sense Message

Found the issue: I've left some debug code in released beta1 version, leading to unexpected memory management (and crash).
Will release beta2 ASAP...

Posts: 4
Joined: 28 Dic 2018 - 12:58
Re: Active Sense Message

Hi, I didn't see any notification for your new beta. Finally today I check in the old place... And here it is!!

Well, I try beta 2 and all works fine for me, even detaching MIDI cable. What you have implemented is exactly what I request.

I hope this feature will be useful for many people.

Thank you.

Posts: 1492
Joined: 25 Mar 2012 - 01:19
Re: Active Sense Message

Good, thanks for reporting it ;)

Pagine

warning

Warning, JavaScript is disabled!

JavaScript is not available, maybe because you disabled it globally into your browser settings or you are using an addon like NoScript.

We do not have any dangerous JavaScript running here.
Please enable JavaScript; if you're using NoScript this image will help you adding CoolSoft to your whitelist.

Thanks for your comprehension and enjoy CoolSoft.