-
Notifications
You must be signed in to change notification settings - Fork 185
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
Add Fluidsynth/FluidLite #2250
Add Fluidsynth/FluidLite #2250
Conversation
(based on work of carstene1ns)
The FmMidi Sequencer is now mandatory and used by all libraries if applicable (all but WildMidi). Support looping for WildMidi.
…/Lite incompatibilities.
…(Midi only used on BGM channel)
The AudioDecoder will destroy it because it is stuck at "IsFinished" but the BGM must be kept alive to match RPG_RT. Fix EasyRPG#834
We may want to punt on this question until we tackle engine configuration more generally in the config PRs sequence. The midi engine and soundfont are definitely a big part of that. I'd be fine with some env var or command line parameter hack for now. Maybe also some hard coded default to search like |
With FS1 merged this is now open for review. Right now the soundfont is hardcoded to "easyrpg.soundfont", will keep it this way for now. |
Other than the minor nit, looks ok to me. |
@BSzili for you information. |
1803d23
to
6402452
Compare
There is only one location where this can happen, will take a look. thanks :) |
Problems (via IRC):
|
That's fine, I'll update them when the next version is due. Thanks for the tip about FluidLite! |
src/audio_midi.h
Outdated
#include "audio_decoder.h" | ||
#include "midisequencer.h" | ||
|
||
#define EP_MIDI_FREQ 22050 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch out. I know 22050 is less process usage but this preset (at least in my windows x86) is making melodies sounds a bit "uncoordinated" in difference with 44100.
Here's a little example with Battle3.mid and scc1t2 soundfont (sorry, github doesn't like audios =( )
With 44100:
https://drive.google.com/file/d/1ODdgq7aU0tljQwopjRmnyjY-p2kokUv_/view?usp=sharing
With 22050:
https://drive.google.com/file/d/1ti2VP5uFELNgIE7TgTlJJiJuPeV-VO1P/view?usp=sharing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to know how much less CPU usage really is this? Especially on desktop and mobile platforms?
I'm all for saving CPU cycles but 22khz is sacrificing audio quality in a big way. I would prefer to default to "reasonable" audio quality that "sounds like RPG_RT or better" and only cut back if we find we really need to on limited hardware.
Also on modern systems, using low frequencies like this for music is very uncommon and so downstream software / OS audio stacks may up-sample it poorly.
For all these conjectures about processing costs of audio features, we really need some benchmarks and performance numbers. Some of them could be costing much less or much more CPU than we think.
That being said, I also really want to see some initial version of this merged to master so I can being playing with it while testing other PRs. So I'm fine collecting the outstanding questions into a github issue, getting this into a base working state, and merging it.
Also a little observation with RTP2003 MIDIs. In channel 10 (drums) this causes troubles and FluidLite fallbacks to a non-drum instrument. If you manually remove these events from MIDI, melodies play normally. I don't know if it's related with FluidLite directly (I don't have other software reference who uses FluidLite to test), or with the interface that "connects" FluidLite and player (at least I tested the PR without soundfont and works fine). |
I will only:
Then this is ready. The stuck instruments when doing BGM Stop -> BGM play require some work I would postbone to another PR. They only happen in Fluid, not in Wildmidi or FmMidi. |
Because FluidLite is based on an older FluidSynth version it uses the old string API.
…ise notes are missing)
… Pitch changes. Fixes incorrectly pitched Midi playback (except for WildMidi because it is not sequencer based).
I'm done here. I was able to fix the incorrectly pitched Midi. This was a design issue in the Resampler (the pitch stuff was unused for years) which explains why FmMidi always had the wrong pitch. Midis play now correctly for FmMidi and FluidLite/Synth. Can't be fixed in WildMidi because it is not Midi Message based. (at least I was able to implement Midi ticks through tricks here) I postbone the following three bugs:
|
Sounds good to me, lets get those items into a github issue so we don't forget them |
Fix #1322
Fix #834
Fix #2029
Depends on FS/1 because this would cause too much rebase pain otherwise.
Features:
MidiDecoder
(similiar howAudioDecoder
works) which handles instantiation of an appropriate subclas. AGenericMidiDecoder
implements most of the API already and manages a FmMidi Sequencer and an underlying MIDI library.FillBuffer
and Midi messages must be implemented. Ticks, loops etc. are managed byGenericMidiDecoder
.WildMidi
).GenericMidiDecoder
is aware of it and will call appropriate functions and do sample counting. ForWildMidi
this means thatSeek
to implement Loops will work!TBD: Good default filenames/search locations for Soundfonts