Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIDI device configuration? #74

Closed
tomrow opened this issue Feb 7, 2020 · 3 comments · May be fixed by #193
Closed

MIDI device configuration? #74

tomrow opened this issue Feb 7, 2020 · 3 comments · May be fixed by #193

Comments

@tomrow
Copy link

tomrow commented Feb 7, 2020

On my Windows PC, I have multiple MIDI drivers installed that allow for better sounds. However, FreeJ2ME seems to default to the Microsoft GS Wavetable Synth with no apparent way to change it. Is there a configuration file entry that can be changed to modify which MIDI device is used?

@recompileorg
Copy link
Collaborator

No. It doesn't look like something that's easy (or possible?) to do in java: https://docs.oracle.com/javase/7/docs/api/javax/sound/midi/MidiSystem.html

You could try changing the Windows default MIDI sequencer. You need to make a registry change, because no one care about MIDI any more and Microsoft removed the option from the sound control panel. Maybe when MIDI 2.0 comes out, we'll get better options in Windows.

Anyhow, here's a video explaining how to do it. Apparently, the author thinks that written instructions are too easy to follow: https://www.youtube.com/watch?v=RfbbzN9XuPw Why is everything a video these days? Ridiculous.

@Nokia64
Copy link
Contributor

Nokia64 commented Feb 11, 2020

@tomrow As far as I'm aware, JRE haves both an internal MIDI synthesizer, and a system synth passthrough mode.

On my JRE8, there's this file at sound/sound.properties. It's got some examples:

# Example 2:
# Specify the default Synthesizer by its name "InternalSynth".
# javax.sound.midi.Synthesizer=#InternalSynth

looks like you are able to enable the internal synth there.

EDIT: In JRE8/Windows, there's a file called lib/audio/soundbank.gm in the JRE installation directory. This might be all you need to replace.
On installing the soundfont, this is for an very old version of Java, but may still work:
https://www.oracle.com/technetwork/java/soundbanks-135798.html

@AShiningRay
Copy link
Contributor

Turns out this can be done, or at least it can but in a different way which i consider to be better: Instead of relying on system MIDI drivers, we can change the soundfont used by FreeJ2ME at runtime (requires a restart to apply though, unless you change the soundfont before the app loads any midi streams) by manipulating which soundfont gets loaded by JVM's MIDI synth.

The pull request above proposes a way of doing that by adding a config to set if the user wants to run the default soundfont or a custom one, which can be added to <working_dir>/freej2me_system/customMIDI/. File naming isn't an issue since PlatformPlayer will load the very first soundfont it finds in there that matches the expected .sf2 format... and in cases where the user enables custom soundfont usage but doesn't provide any fonts in there, FreeJ2ME simply uses the default one.

Support for that on libretro cores is also there and it is confirmed to be working on my windows and linux machines as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants