I'm developing a .NET library to work with MIDI files and MIDI devices (DryWetMIDI). I have an issue related to setting volume to Microsoft GS Wavetable Synth ( https://github.com/melanchall/drywetmidi/issues/75) using WinAPI functions. Here steps to reproduce the problem:
- call midiOutGetDevCaps to determine whether device supports volume control or not; for Microsoft GS Wavetable Synth the MIDICAPS_VOLUME flag is set;
- call midiOutSetVolume to set volume.
After that exception will be thrown. In user's case the exception is This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports. In test on my machine I get There is no driver installed on your system.
Looks like bug in Microsoft GS Wavetable Synth. Or maybe midiOutSetVolume is obsolete? Why this happens? Volume control should be supported but changing the volume throws an exception.
Does midi volume (as in 'velocity' work? Have you tried the midi master volume, what does that do?
Geoff
I think I didn't understand you 🙂
I call midiOutGetDevCaps, in returned structure I see that MIDICAPS_VOLUME flag is set, so device supports volume control (I'm talking about Microsoft GS Wavetable Synth). But when I'm trying to set volume with midiOutSetVolume I get exception. Looks strange.
Hello,
My understanding is that the Windows GS Wavetable Synth works fine, even if the actual sounds made are far from ideal, and many advise that the Windows product be replaced with something more modern. Therefore, I suspect that you are not correct to suggest there is a bug with that system, which has been around a long time, playing midi files happily?
More likely there may be a problem with the API you are using, which I guess may not be involved with normal oparation of the Synth when playing midi files from Windows?
However, I have the Charles Petzold book here to hand, and looking at the section about 'MIDI Sequencing (pp 1351 etc)I see that everything seems to follow on from the MidiOutOpen function which I guess sets everything up. No reference here to any problems.
Again, does the setup you're working on handle midi files OK, without error, that after all is what's it's supposed to do.
Geoff
Hi Geoff,
I'm the user that has reported this issue I am having to the OP, so I may be able to provide some information in regards to the setup, but please do note that my midi experience is basically nothing and some things may fly over my head because of this. I believe he is using mmeapi to handle midi playback, but that's as far as I know on that subject matter.
I am using his library for a piece of software I am working with, the user will be able to select which device to use for midi output. While I have heard that Windows GS Wavetable Synth isn't very good, it's still an option I would like to provide to users for basic use cases.
For testing purposes, I have also installed VirtualMIDISynth 2 (Which I believe is the usual replacement of choice. I can try others If you have other recommendations) to replace GS Wavetable Synth, which presents the same problem. I believe VirtualMIDISyth is the reason for the difference between the OP's error message of 'No driver installed' and my current error of 'This function is not supported', as I was getting the same no driver installed exception before I installed VirtualMIDISynth.
I have confirmed that midi playback works on this machine. Adjusting the velocity also works correctly. I have tested the same setup on another machine to also confirm this, and have quickly tested some other midi libraries which produce the same results.
I am happy to provide any other information, where I can, that may help.
Hello,
You've not said which OS you're working with, or what sort of hardware you're using, or what programming language you're using, but I'm assuming womething re windows.
On the basis of the various things that you say ARE working OK, i.e. the Virtual Midi Synth (I have or had that installed myself) and the basic Windows playback, I'd suggest that everything you need must be there and accessible. However, when you use your own system, it's not being found. I'd be pretty sure the other processes you mention are using the same API things that you are trying to use, so I'd suspect that there's nothing 'wrong' with the API components. Seems more likely that your code is either missing setting something up that needs setting up, or maybe you're trying to do all the right things, but maybe not in quite the right order (to paraphase Eric Morecome)?
The book I have has some code examples (MS VC++) and these supposedly work via the Midi Mapper. I'm sure there is other code examples you might find via the web, I tried a search re the function names mentioned above). It might be useful to check other working systems and compare which functions are being called, and in what order/sequence, and compare this with your current program. If it's not too long, you might attach your code where you are using the API functions.
Geoff
Geoff,
midiOutSetVolume is a Win API function so we are talking about Windows. In fact it looks like bug in this function (or in midiOutGetDevCaps which incorrectly says that device supports volume control). I've created thread on MSDN forum: midiOutSetVolume failes even if MIDICAPS_VOLUME set. Maybe someone from Windows development team has info about this behavior 🙂
Hello,
Using a bit of Google, I find the following link.
This seems to be from some years ago, but decoding the strange language (like someone is living in Hobbitt-world or something) I think this is someone suffering the same problem as you. He seems to have found a 'work-around', which may or may not be some help to you??
Geoff
Hi Geoff,
Thanks for your help! It's a bug in my library. I indeed forgot to call midiOutOpen before volume manipulations.
Max,
Thank you VERY much for the admission. I don't know what your code looks like, but some of the windows code blocks I've looked at, and tried to make sense of, have bits in what seems like any old order, and it's by no means easy to keep things in the right order, or check that they ARE in the right order for invoking.
I hope your system proceeds OK now.
Geoff
Geoff,
Now volume can be set. Thank you again.