Whenever a MIDI file starts to play (which was recorded using the same sample set), Hauptwerk first resets the organ (in the same way that happens when you use 'Engine | Reset organ/MIDI', and in the same way that happens when you load the organ).
It does that to ensure that all virtual and hardware stops, expression pedals, etc. are in their default states at the start of the MIDI recording, so that playing the MIDI recording always gives the same result, regardless of what virtual/hardware registration you happened to have drawn prior to starting to play the file.
When Hauptwerk resets the organ each stop will send an 'stop off' message via MIDI (possibly more than once, depending on how the organ is configured internally). It won't send a 'stop on' message for any stop (unless you've specifically set the virtual stop always to default to on).
Perhaps you have each of your MIDI stops configured (either within its decoder hardware, or via your MIDI settings for the virtual stop in Hauptwerk) so that the 'stop on' and 'stop off' MIDI messages are the same, or (likewise) so that the same MIDI message toggles the hardware stop's state (rather than setting it directly to 'on' or 'off'), or perhaps your hardware stop is doing something unusual like sending its previous state back to Hauptwerk's virtual stop as Hauptwerk tries to turn the stop on, resulting in a loop. Alternatively, if you're using a digital organ/console that has its own built-in combination system then perhaps the console's built-in combination actions is also affecting the stop states.
If it's an off-the-shelf digital organ or MIDI organ console then please first make sure that you have the appropriate entry selected for the 'MIDI hardware/console type' setting on the 'General settings | General preferences' screen.
Then, for testing, load the St. Anne's organ (since we all have ready access to that), and use right-click auto-detection to auto-detect the Great Trumpet 8 (for example) virtual stop again, making sure that you turn the relevant hardware stop on and then off again when prompted. Hauptwerk needs to hear both your hardware stop's 'on' message and its 'off' message in order to know what the appropriate MIDI settings would be for it. Also make sure the 'toggle' option is *not* ticked when auto-detecting the stop, and that the option for sending MIDI output *is* ticked.
Now record a quick MIDI file as a test, and try playing it back. Does that stop (Great Trumpet 8) then behave normally (i.e. being turned 'off' as you start to play the MIDI file, but never turning on in that situation)?
If not, what make/model of MIDI console are you using? Or is it something you've made yourself, e.g. as I see you mentioned in this thread: viewtopic.php?f=21&t=19947
If the latter, you MIDI console's stop decoders/encoders need to be configured so that each stop sends a distinct MIDI message as it turns off (e.g. MIDI note-off on the same MIDI channel/note) from the message it sends as it turns on (e.g. MIDI note-on). Please see also this post:
viewtopic.php?f=4&t=19922&p=149443#p149443
mdyde wrote:These paragraphs from the 'MIDI implementation' section in the main Hauptwerk user guide (page 280 in the current v6.0.2 version) cover recommendations for configuring MIDI channels and event types in your MIDI encoder/decoder circuits, so that everything can then be configured solely via auto-detection, for convenience:If you are building a new MIDI organ console or new MIDI hardware for Hauptwerk then we recommend that MIDI switches and pistons use MIDI NRPN-on/off messages (on value=127, off value=0) and that if a MIDI switch supports MIDI output (for example, if it is solenoid-actuated or illuminated) then we recommend that it should receive identical MIDI messages to those it sends (thus making it possible for Hauptwerk to configure MIDI output to it automatically during auto-detection).
If you are building a new MIDI organ console for Hauptwerk using MIDI encoder circuitry that doesn't support NRPNs, then we recommend instead using MIDI note-on/off messages for switches and pistons, again ensuring that each MIDI switch receives identical MIDI messages to those it sends (if the MIDI switch supports MIDI output).
For example, if a given hardware stop sends a MIDI note-on message with MIDI note number 34 on MIDI channel 3 as it turns on, and a note-off message for that note number and channel as it turns off, then we'd recommend that the decoder be configured so that when it receives a MIDI note-on message for that same note number and channel it should turn the hardware stop on (by pulsing its 'on' solenoid briefly), and likewise for a note-off to turn the hardware stop off.
It might be easier to configure some MIDI decoders/encoders to use MIDI note on/off messages than NRPN messages, but either type is fine, since either type is 'stateful' (unlike a MIDI program change, for example).